]> git.pld-linux.org Git - packages/gdb.git/blame - gdb-exit-warning.patch
- updated (performance fixes).
[packages/gdb.git] / gdb-exit-warning.patch
CommitLineData
f412e1b4
PS
1http://sourceware.org/ml/gdb-patches/2012-02/msg00664.html
2Subject: RFA: fix PR breakpoints/13776
3
4I'd appreciate comments on this patch.
5I have no idea whether it is the best way to fix the problem.
6
7Bug 13776 concerns 'next'ing over an exit. For the trivial:
8
9 #include <stdlib.h>
10 int
11 main (void)
12 {
13 exit (0);
14 }
15
16We get this behavior:
17
18 (gdb) start
19 Temporary breakpoint 1, main () at exit0.c:5
20 5 exit (0);
21 (gdb) next
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
26
27The bug is that exit_inferior ends up calling delete_longjmp_breakpoint,
28which tries to delete the longjmp breakpoints -- but as the inferior is
29dead, this fails.
30
31This patch fixes this problem by moving the breakpoint_init_inferior
32call earlier in generic_mourn_inferior. This causes the breakpoints to
33be marked as uninserted before they are deleted.
34
35While doing this I noticed that after the inferior exits, we are left
36with a step-resume breakpoint:
37
38(gdb) maint info b
39Num Type Disp Enb Address What
40[...]
410 step resume dstp y 0x00000000004004d2 inf 1 thread 1
42 stop only in thread 1
43
44The breakpoint.c patch causes this to be removed as well.
45
46Built and regtested on x86-64 Fedora 16.
47
48Tom
49
502012-02-28 Tom Tromey <tromey@redhat.com>
51
52 PR breakpoints/13776:
53 * target.c (generic_mourn_inferior): Call breakpoint_init_inferior
54 earlier.
55 * breakpoint.c (breakpoint_init_inferior): Delete step-resume
56 breakpoints.
57
58diff --git a/gdb/breakpoint.c b/gdb/breakpoint.c
59index 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.
64 */
65
66+ case bp_step_resume:
67+
68+ /* Also remove step-resume breakpoints. */
69+
70 delete_breakpoint (b);
71 break;
72
73diff --git a/gdb/target.c b/gdb/target.c
74index 1f408f6..65a6c23 100644
75--- a/gdb/target.c
76+++ b/gdb/target.c
77@@ -3583,13 +3583,14 @@ generic_mourn_inferior (void)
78 ptid = inferior_ptid;
79 inferior_ptid = null_ptid;
80
81+ breakpoint_init_inferior (inf_exited);
82+
83 if (!ptid_equal (ptid, null_ptid))
84 {
85 int pid = ptid_get_pid (ptid);
86 exit_inferior (pid);
87 }
88
89- breakpoint_init_inferior (inf_exited);
90 registers_changed ();
91
92 reopen_exec_file ();
93
This page took 0.194671 seconds and 4 git commands to generate.