2003-09-09 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / infcmd.c
index 5867655b98e541600eb6ca238de8f2fb0021d0e0..6831d6be8f93504118d9c9d9a8b1bd4a444fe550 100644 (file)
@@ -81,6 +81,8 @@ static void float_info (char *, int);
 
 static void detach_command (char *, int);
 
+static void disconnect_command (char *, int);
+
 static void unset_environment_command (char *, int);
 
 static void set_environment_command (char *, int);
@@ -1500,8 +1502,8 @@ default_print_registers_info (struct gdbarch *gdbarch,
 {
   int i;
   const int numregs = NUM_REGS + NUM_PSEUDO_REGS;
-  char *raw_buffer = alloca (MAX_REGISTER_RAW_SIZE);
-  char *virtual_buffer = alloca (MAX_REGISTER_VIRTUAL_SIZE);
+  char raw_buffer[MAX_REGISTER_SIZE];
+  char virtual_buffer[MAX_REGISTER_SIZE];
 
   if (DEPRECATED_DO_REGISTERS_INFO_P ())
     {
@@ -1551,9 +1553,9 @@ default_print_registers_info (struct gdbarch *gdbarch,
          The function frame_register_read() should have returned the
          pre-cooked register so no conversion is necessary.  */
       /* Convert raw data to virtual format if necessary.  */
-      if (REGISTER_CONVERTIBLE (i))
+      if (DEPRECATED_REGISTER_CONVERTIBLE (i))
        {
-         REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i),
+         DEPRECATED_REGISTER_CONVERT_TO_VIRTUAL (i, register_type (current_gdbarch, i),
                                       raw_buffer, virtual_buffer);
        }
       else
@@ -1649,7 +1651,8 @@ registers_info (char *addr_exp, int fpregs)
 
       /* A register name?  */
       {
-       int regnum = frame_map_name_to_regnum (start, end - start);
+       int regnum = frame_map_name_to_regnum (deprecated_selected_frame,
+                                              start, end - start);
        if (regnum >= 0)
          {
            gdbarch_print_registers_info (current_gdbarch, gdb_stdout,
@@ -1674,24 +1677,24 @@ registers_info (char *addr_exp, int fpregs)
 
       /* A register group?  */
       {
-       struct reggroup *const *group;
-       for (group = reggroups (current_gdbarch);
-            (*group) != NULL;
-            group++)
+       struct reggroup *group;
+       for (group = reggroup_next (current_gdbarch, NULL);
+            group != NULL;
+            group = reggroup_next (current_gdbarch, group))
          {
            /* Don't bother with a length check.  Should the user
               enter a short register group name, go with the first
               group that matches.  */
-           if (strncmp (start, reggroup_name ((*group)), end - start) == 0)
+           if (strncmp (start, reggroup_name (group), end - start) == 0)
              break;
          }
-       if ((*group) != NULL)
+       if (group != NULL)
          {
            int regnum;
            for (regnum = 0; regnum < NUM_REGS + NUM_PSEUDO_REGS; regnum++)
              {
                if (gdbarch_register_reggroup_p (current_gdbarch, regnum,
-                                                (*group)))
+                                                group))
                  gdbarch_print_registers_info (current_gdbarch,
                                                gdb_stdout, deprecated_selected_frame,
                                                regnum, fpregs);
@@ -1876,6 +1879,26 @@ detach_command (char *args, int from_tty)
     detach_hook ();
 }
 
+/* Disconnect from the current target without resuming it (leaving it
+   waiting for a debugger).
+
+   We'd better not have left any breakpoints in the program or the
+   next debugger will get confused.  Currently only supported for some
+   remote targets, since the normal attach mechanisms don't work on
+   stopped processes on some native platforms (e.g. GNU/Linux).  */
+
+static void
+disconnect_command (char *args, int from_tty)
+{
+  dont_repeat ();              /* Not for the faint of heart */
+  target_disconnect (args, from_tty);
+#if defined(SOLIB_RESTART)
+  SOLIB_RESTART ();
+#endif
+  if (detach_hook)
+    detach_hook ();
+}
+
 /* Stop the execution of the target while running in async mode, in
    the backgound. */
 void
@@ -2014,6 +2037,11 @@ to specify the program, and to load its symbol table.");
 If a process, it is no longer traced, and it continues its execution.  If\n\
 you were debugging a file, the file is closed and gdb no longer accesses it.");
 
+  add_com ("disconnect", class_run, disconnect_command,
+          "Disconnect from a target.\n\
+The target will wait for another debugger to connect.  Not available for\n\
+all targets.");
+
   add_com ("signal", class_run, signal_command,
           "Continue program giving it signal specified by the argument.\n\
 An argument of \"0\" means continue program without giving it a signal.");
This page took 0.024402 seconds and 4 git commands to generate.