inf_ttrace_follow_fork: detach_breakpoints called twice for child.
authorJoel Brobecker <brobecker@gnat.com>
Thu, 16 Aug 2012 23:54:37 +0000 (23:54 +0000)
committerJoel Brobecker <brobecker@gnat.com>
Thu, 16 Aug 2012 23:54:37 +0000 (23:54 +0000)
When debugging a program that forks with follow-fork set to follow
the parent, we end up calling detach_breakpoints for the child twice.
On ia64-hpux, this leads to a warning when trying to remove the
breakpoints the second time around, because the ia64 code detects
that the address does not point to a breakpoint instruction.

gdb/ChangeLog:

        * inf-ttrace.c (inf_ttrace_follow_fork): When following the
        parent, only call detach_breakpoints if tts.tts_event ==
        TTEVT_VFORK.

gdb/ChangeLog
gdb/inf-ttrace.c

index 3c83d5d8d678a02250d1323b1410168857543873..f40d5979646e73b51d2e2be5cef35ba05ba00b3b 100644 (file)
@@ -1,3 +1,9 @@
+2012-08-16  Joel Brobecker  <brobecker@adacore.com>
+
+       * inf-ttrace.c (inf_ttrace_follow_fork): When following the
+       parent, only call detach_breakpoints if tts.tts_event ==
+       TTEVT_VFORK.
+
 2012-08-16  Joel Brobecker  <brobecker@adacore.com>
 
        * dwarf2-frame.c (dwarf2_frame_cache): Use
index 2c620d58fe5ba75365ff00de48e2f9a5c70c5829..ddcbd428b8b15c0e53b1140adf55f139724599f2 100644 (file)
@@ -467,7 +467,11 @@ inf_ttrace_follow_fork (struct target_ops *ops, int follow_child)
   else
     {
       inferior_ptid = ptid_build (pid, lwpid, 0);
-      detach_breakpoints (fpid);
+      /* Detach any remaining breakpoints in the child.  In the case
+        of fork events, we do not need to do this, because breakpoints
+        should have already been removed earlier.  */
+      if (tts.tts_event == TTEVT_VFORK)
+       detach_breakpoints (fpid);
 
       target_terminal_ours ();
       fprintf_unfiltered (gdb_stdlog,