]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
* config/i386/nm-cygwin.h (ATTACH_NO_WAIT): Delete.
authorPedro Alves <palves@redhat.com>
Thu, 3 Jul 2008 17:38:08 +0000 (17:38 +0000)
committerPedro Alves <palves@redhat.com>
Thu, 3 Jul 2008 17:38:08 +0000 (17:38 +0000)
* config/i386/nm-i386gnu.h (ATTACH_NO_WAIT): Delete.

* target.h (struct target_ops): Add to_attach_no_wait member.
(target_attach_no_wait): New.
* target.c (update_current_target): Inherit to_attach_no_wait.

* infcmd.c: Replace ATTACH_NO_WAIT compile time check by
target_attach_no_wait runtime check.

* gnu-nat.c (init_gnu_ops): Set to_attach_no_wait in gnu_ops.
* win32-nat.c (init_win32_ops): Set to_attach_no_wait in
win32_ops.

gdb/ChangeLog
gdb/config/i386/nm-cygwin.h
gdb/config/i386/nm-i386gnu.h
gdb/gnu-nat.c
gdb/infcmd.c
gdb/target.c
gdb/target.h
gdb/win32-nat.c
gdb/windows-nat.c

index 182a7d6f6c3d507463a929012b996aa7f4cc44c1..0cdd9355707cd74180f15d5d8bddf7454c07e6af 100644 (file)
@@ -1,3 +1,19 @@
+2008-07-03  Pedro Alves  <pedro@codesourcery.com>
+
+       * config/i386/nm-cygwin.h (ATTACH_NO_WAIT): Delete.
+       * config/i386/nm-i386gnu.h (ATTACH_NO_WAIT): Delete.
+
+       * target.h (struct target_ops): Add to_attach_no_wait member.
+       (target_attach_no_wait): New.
+       * target.c (update_current_target): Inherit to_attach_no_wait.
+
+       * infcmd.c: Replace ATTACH_NO_WAIT compile time check by
+       target_attach_no_wait runtime check.
+
+       * gnu-nat.c (init_gnu_ops): Set to_attach_no_wait in gnu_ops.
+       * win32-nat.c (init_win32_ops): Set to_attach_no_wait in
+       win32_ops.
+
 2008-07-03  Pedro Alves  <pedro@codesourcery.com>
 
        * i386-tdep.c (i386_displaced_step_fixup): Condition log printing
index 5222b60debbf48adf496bdd9465cc224d72b2989..b273439d6f98f1eed2a7c7a7540dcb8eabf8638b 100644 (file)
@@ -16,7 +16,6 @@
    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
 
-#define ATTACH_NO_WAIT
 #define ADD_SHARED_SYMBOL_FILES dll_symbol_command
 void dll_symbol_command (char *, int);
 
index 2be95b4ac1bba0303a74312d8559aa1f442feec7..ee1fe73fe212fa4961104376a762b2ea3b0ec5b9 100644 (file)
@@ -26,9 +26,6 @@
 
 extern char *gnu_target_pid_to_str (int pid);
 
-/* Don't do wait_for_inferior on attach.  */
-#define ATTACH_NO_WAIT
-
 /* Thread flavors used in re-setting the T bit.  */
 #define THREAD_STATE_FLAVOR            i386_REGS_SEGS_STATE
 #define THREAD_STATE_SIZE              i386_THREAD_STATE_COUNT
index 5f9a405dd37d32f9870ddcf8c847ba92226b1a3a..558e3578c05f3e5173037e6bf6f9f222954edce2 100644 (file)
@@ -2592,6 +2592,7 @@ init_gnu_ops (void)
   gnu_ops.to_doc = "GNU Hurd process"; /* to_doc */
   gnu_ops.to_open = gnu_open;          /* to_open */
   gnu_ops.to_attach = gnu_attach;      /* to_attach */
+  gnu_ops.to_attach_no_wait = 1;       /* to_attach_no_wait */
   gnu_ops.to_detach = gnu_detach;      /* to_detach */
   gnu_ops.to_resume = gnu_resume;      /* to_resume */
   gnu_ops.to_wait = gnu_wait;          /* to_wait */
index d9c9cb758340cd8c9eb17209c77f85e195138d28..fead6d16a7aa8cd953d48325495c4ef6aadc8f4e 100644 (file)
@@ -2015,38 +2015,40 @@ attach_command (char *args, int from_tty)
   init_wait_for_inferior ();
   clear_proceed_status ();
 
-  /* No traps are generated when attaching to inferior under Mach 3
-     or GNU hurd.  */
-#ifndef ATTACH_NO_WAIT
-  /* Careful here. See comments in inferior.h.  Basically some OSes
-     don't ignore SIGSTOPs on continue requests anymore.  We need a
-     way for handle_inferior_event to reset the stop_signal variable
-     after an attach, and this is what STOP_QUIETLY_NO_SIGSTOP is for.  */
-  stop_soon = STOP_QUIETLY_NO_SIGSTOP;
-
-  if (target_can_async_p ())
+  /* Some system don't generate traps when attaching to inferior.
+     E.g. Mach 3 or GNU hurd.  */
+  if (!target_attach_no_wait)
     {
-      /* sync_execution mode.  Wait for stop.  */
-      struct continuation_arg *arg1, *arg2, *arg3;
+      /* Careful here. See comments in inferior.h.  Basically some
+        OSes don't ignore SIGSTOPs on continue requests anymore.  We
+        need a way for handle_inferior_event to reset the stop_signal
+        variable after an attach, and this is what
+        STOP_QUIETLY_NO_SIGSTOP is for.  */
+      stop_soon = STOP_QUIETLY_NO_SIGSTOP;
 
-      arg1 =
-       (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg2 =
-       (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg3 =
-       (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
-      arg1->next = arg2;
-      arg2->next = arg3;
-      arg3->next = NULL;
-      arg1->data.pointer = args;
-      arg2->data.integer = from_tty;
-      arg3->data.integer = async_exec;
-      add_continuation (attach_command_continuation, arg1);
-      return;
-    }
+      if (target_can_async_p ())
+       {
+         /* sync_execution mode.  Wait for stop.  */
+         struct continuation_arg *arg1, *arg2, *arg3;
+
+         arg1 =
+           (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
+         arg2 =
+           (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
+         arg3 =
+           (struct continuation_arg *) xmalloc (sizeof (struct continuation_arg));
+         arg1->next = arg2;
+         arg2->next = arg3;
+         arg3->next = NULL;
+         arg1->data.pointer = args;
+         arg2->data.integer = from_tty;
+         arg3->data.integer = async_exec;
+         add_continuation (attach_command_continuation, arg1);
+         return;
+       }
 
-  wait_for_inferior (0);
-#endif
+      wait_for_inferior (0);
+    }
 
   attach_command_post_wait (args, from_tty, async_exec);
 }
index 7c1d6fd1e2c1a08f25476a2990b70cca90ba5ec9..af430bdc215ddec983353266a445c133f5e84faf 100644 (file)
@@ -405,6 +405,7 @@ update_current_target (void)
       INHERIT (to_close, t);
       INHERIT (to_attach, t);
       INHERIT (to_post_attach, t);
+      INHERIT (to_attach_no_wait, t);
       INHERIT (to_detach, t);
       /* Do not inherit to_disconnect.  */
       INHERIT (to_resume, t);
index 9641f0d62c872407300c40f98cc721028155de09..a7b2bb9fa0d2293292a9a9af7ce8489e0970b3d1 100644 (file)
@@ -412,6 +412,7 @@ struct target_ops
     int to_has_registers;
     int to_has_execution;
     int to_has_thread_control; /* control thread execution */
+    int to_attach_no_wait;
     struct section_table
      *to_sections;
     struct section_table
@@ -564,6 +565,13 @@ void target_close (struct target_ops *targ, int quitting);
 #define        target_attach(args, from_tty)   \
      (*current_target.to_attach) (args, from_tty)
 
+/* Some targets don't generate traps when attaching to the inferior,
+   or their target_attach implementation takes care of the waiting.
+   These targets must set to_attach_no_wait.  */
+
+#define target_attach_no_wait \
+     (current_target.to_attach_no_wait)
+
 /* The target_attach operation places a process under debugger control,
    and stops the process.
 
index 07c7b60d53b4981522263c9be86f7dbc1e0aa952..eb15c97142291a09347859ca601d4426ccbd9a2b 100644 (file)
@@ -2085,6 +2085,7 @@ init_win32_ops (void)
   win32_ops.to_open = win32_open;
   win32_ops.to_close = win32_close;
   win32_ops.to_attach = win32_attach;
+  win32_ops.to_attach_no_wait = 1;
   win32_ops.to_detach = win32_detach;
   win32_ops.to_resume = win32_resume;
   win32_ops.to_wait = win32_wait;
index 07c7b60d53b4981522263c9be86f7dbc1e0aa952..eb15c97142291a09347859ca601d4426ccbd9a2b 100644 (file)
@@ -2085,6 +2085,7 @@ init_win32_ops (void)
   win32_ops.to_open = win32_open;
   win32_ops.to_close = win32_close;
   win32_ops.to_attach = win32_attach;
+  win32_ops.to_attach_no_wait = 1;
   win32_ops.to_detach = win32_detach;
   win32_ops.to_resume = win32_resume;
   win32_ops.to_wait = win32_wait;