1 http://sourceware.org/ml/gdb-patches/2012-02/msg00664.html
2 Subject: RFA: fix PR breakpoints/13776
4 I'd appreciate comments on this patch.
5 I have no idea whether it is the best way to fix the problem.
7 Bug 13776 concerns 'next'ing over an exit. For the trivial:
19 Temporary breakpoint 1, main () at exit0.c:5
22 [Inferior 1 (process 2428) exited normally]
23 warning: Error removing breakpoint 0
24 warning: Error removing breakpoint 0
25 warning: Error removing breakpoint 0
27 The bug is that exit_inferior ends up calling delete_longjmp_breakpoint,
28 which tries to delete the longjmp breakpoints -- but as the inferior is
31 This patch fixes this problem by moving the breakpoint_init_inferior
32 call earlier in generic_mourn_inferior. This causes the breakpoints to
33 be marked as uninserted before they are deleted.
35 While doing this I noticed that after the inferior exits, we are left
36 with a step-resume breakpoint:
39 Num Type Disp Enb Address What
41 0 step resume dstp y 0x00000000004004d2 inf 1 thread 1
44 The breakpoint.c patch causes this to be removed as well.
46 Built and regtested on x86-64 Fedora 16.
50 2012-02-28 Tom Tromey <tromey@redhat.com>
53 * target.c (generic_mourn_inferior): Call breakpoint_init_inferior
55 * breakpoint.c (breakpoint_init_inferior): Delete step-resume
58 diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
59 index db05b97..048cc63 100644
60 --- a/gdb/breakpoint.c
61 +++ b/gdb/breakpoint.c
62 @@ -3341,6 +3341,10 @@ breakpoint_init_inferior (enum inf_context context)
63 (gdb) tar rem :9999 # remote Windows gdbserver.
66 + case bp_step_resume:
68 + /* Also remove step-resume breakpoints. */
70 delete_breakpoint (b);
73 diff --git a/gdb/target.c b/gdb/target.c
74 index 1f408f6..65a6c23 100644
77 @@ -3583,13 +3583,14 @@ generic_mourn_inferior (void)
79 inferior_ptid = null_ptid;
81 + breakpoint_init_inferior (inf_exited);
83 if (!ptid_equal (ptid, null_ptid))
85 int pid = ptid_get_pid (ptid);
89 - breakpoint_init_inferior (inf_exited);