]>
Commit | Line | Data |
---|---|---|
f412e1b4 PS |
1 | http://sourceware.org/ml/gdb-patches/2012-03/msg00357.html |
2 | Subject: [patch 1/2] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #5 | |
3 | ||
4 | Hi, | |
5 | ||
6 | posted as a new thread. | |
7 | ||
8 | As described in | |
9 | cancel: [patch] Fix gdb.cp/gdb2495.exp regression with gcc-4.7 #4 [Re: [revert] Regression on PowerPC] | |
10 | http://sourceware.org/ml/gdb-patches/2012-03/msg00322.html | |
11 | just ON_STACK had some regressions. | |
12 | ||
13 | The expectations in that mail were wrong (at least that cleanup/fix is not | |
14 | required for gdb.cp/gdb2495.exp). | |
15 | ||
16 | The problem is that the inferior call return pad breakpoint instruction is | |
17 | never removed even after inferior call finishes. It is even still visible in | |
18 | "maintenance info breakpoints". This does not matter much for AT_ENTRY_POINT | |
19 | but for ON_STACK it just corrupts stack. | |
20 | ||
21 | No regressions on | |
22 | {x86_64,x86_64-m32,i686}-fedora(15-rawhide)/rhel(5-6)-linux-gnu and for | |
23 | gdbsever non-extended mode. | |
24 | ||
25 | ||
26 | Thanks, | |
27 | Jan | |
28 | ||
29 | ||
30 | gdb/ | |
31 | 2012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com> | |
32 | ||
33 | Remove momentary breakpoints for completed inferior calls. | |
34 | * dummy-frame.c: Include gdbthread.h. | |
35 | (pop_dummy_frame_bpt): New function. | |
36 | (pop_dummy_frame): Initialie DUMMY earlier. Call pop_dummy_frame_bpt. | |
37 | ||
38 | gdb/testsuite/ | |
39 | 2012-03-09 Jan Kratochvil <jan.kratochvil@redhat.com> | |
40 | ||
41 | Remove momentary breakpoints for completed inferior calls. | |
42 | * gdb.base/call-signal-resume.exp (maintenance print dummy-frames) | |
43 | (maintenance info breakpoints): New tests. | |
44 | ||
45 | --- a/gdb/dummy-frame.c | |
46 | +++ b/gdb/dummy-frame.c | |
47 | @@ -29,6 +29,7 @@ | |
48 | #include "gdbcmd.h" | |
49 | #include "gdb_string.h" | |
50 | #include "observer.h" | |
51 | +#include "gdbthread.h" | |
52 | ||
53 | /* Dummy frame. This saves the processor state just prior to setting | |
54 | up the inferior function call. Older targets save the registers | |
55 | @@ -108,19 +109,36 @@ remove_dummy_frame (struct dummy_frame **dummy_ptr) | |
56 | xfree (dummy); | |
57 | } | |
58 | ||
59 | +/* Delete any breakpoint B which is a momentary breakpoint for return from | |
60 | + inferior call matching DUMMY_VOIDP. */ | |
61 | + | |
62 | +static int | |
63 | +pop_dummy_frame_bpt (struct breakpoint *b, void *dummy_voidp) | |
64 | +{ | |
65 | + struct dummy_frame *dummy = dummy_voidp; | |
66 | + | |
67 | + if (b->disposition == disp_del && frame_id_eq (b->frame_id, dummy->id) | |
68 | + && b->thread == pid_to_thread_id (inferior_ptid)) | |
69 | + delete_breakpoint (b); | |
70 | + | |
71 | + /* Continue the traversal. */ | |
72 | + return 0; | |
73 | +} | |
74 | + | |
75 | /* Pop *DUMMY_PTR, restoring program state to that before the | |
76 | frame was created. */ | |
77 | ||
78 | static void | |
79 | pop_dummy_frame (struct dummy_frame **dummy_ptr) | |
80 | { | |
81 | - struct dummy_frame *dummy; | |
82 | + struct dummy_frame *dummy = *dummy_ptr; | |
83 | + | |
84 | + restore_infcall_suspend_state (dummy->caller_state); | |
85 | ||
86 | - restore_infcall_suspend_state ((*dummy_ptr)->caller_state); | |
87 | + iterate_over_breakpoints (pop_dummy_frame_bpt, dummy); | |
88 | ||
89 | /* restore_infcall_control_state frees inf_state, | |
90 | all that remains is to pop *dummy_ptr. */ | |
91 | - dummy = *dummy_ptr; | |
92 | *dummy_ptr = dummy->next; | |
93 | xfree (dummy); | |
94 | ||
95 | --- a/gdb/testsuite/gdb.base/call-signal-resume.exp | |
96 | +++ b/gdb/testsuite/gdb.base/call-signal-resume.exp | |
97 | @@ -101,6 +101,18 @@ gdb_test "frame $frame_number" ".*" | |
98 | gdb_test_no_output "set confirm off" | |
99 | gdb_test_no_output "return" | |
100 | ||
101 | +# Verify there are no remains of the dummy frame. | |
102 | +gdb_test_no_output "maintenance print dummy-frames" | |
103 | +set test "maintenance info breakpoints" | |
104 | +gdb_test_multiple $test $test { | |
105 | + -re "call dummy.*\r\n$gdb_prompt $" { | |
106 | + fail $test | |
107 | + } | |
108 | + -re "\r\n$gdb_prompt $" { | |
109 | + pass $test | |
110 | + } | |
111 | +} | |
112 | + | |
113 | # Resume execution, the program should continue without any signal. | |
114 | ||
115 | gdb_test "break stop_two" "Breakpoint \[0-9\]* at .*" |