]>
Commit | Line | Data |
---|---|---|
ab050a48 BZ |
1 | Index: gdb-7.0/gdb/breakpoint.c |
2 | =================================================================== | |
3 | --- gdb-7.0.orig/gdb/breakpoint.c 2009-11-25 10:24:49.000000000 +0100 | |
4 | +++ gdb-7.0/gdb/breakpoint.c 2009-11-25 10:28:35.000000000 +0100 | |
5 | @@ -337,14 +337,21 @@ static int executing_startup; | |
6 | B ? (TMP=B->next, 1): 0; \ | |
7 | B = TMP) | |
8 | ||
9 | -/* Similar iterator for the low-level breakpoints. SAFE variant is not | |
10 | - provided so update_global_location_list must not be called while executing | |
11 | - the block of ALL_BP_LOCATIONS. */ | |
12 | - | |
13 | -#define ALL_BP_LOCATIONS(B,BP_TMP) \ | |
14 | - for (BP_TMP = bp_location; \ | |
15 | - BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \ | |
16 | - BP_TMP++) | |
17 | +/* Similar iterator for the low-level breakpoints. This iterator | |
18 | + requires a defined BP_LOCATION array and BP_LOCATION_COUNT. */ | |
19 | + | |
20 | +#define ALL_BP_LOCATIONS_FROM(B,BP_TMP,BP_LOCATION,BP_LOCATION_COUNT) \ | |
21 | + for (BP_TMP = BP_LOCATION; \ | |
22 | + BP_TMP < BP_LOCATION + BP_LOCATION_COUNT && (B = *BP_TMP); \ | |
23 | + BP_TMP++) | |
24 | + | |
25 | +/* Iterator that calls ALL_BP_LOCATIONS_FROM with the global | |
26 | + bp_locations and bp_location_count variables. SAFE variant is not | |
27 | + provided so update_global_location_list must not be called while | |
28 | + executing the block of ALL_BP_LOCATIONS. */ | |
29 | + | |
30 | +#define ALL_BP_LOCATIONS(B,BP_TMP) \ | |
31 | + ALL_BP_LOCATIONS_FROM(B,BP_TMP,bp_location, bp_location_count) | |
32 | ||
33 | /* Iterator for tracepoints only. */ | |
34 | ||
35 | @@ -3313,6 +3320,7 @@ bpstat_check_breakpoint_conditions (bpst | |
36 | bpstat | |
37 | bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid) | |
38 | { | |
39 | + struct cleanup *old_chain; | |
40 | struct breakpoint *b = NULL; | |
41 | struct bp_location *bl, **blp_tmp; | |
42 | struct bp_location *loc; | |
43 | @@ -3322,8 +3330,14 @@ bpstat_stop_status (CORE_ADDR bp_addr, p | |
44 | bpstat bs = root_bs; | |
45 | int ix; | |
46 | int need_remove_insert, update_locations = 0; | |
47 | + struct bp_location **saved_bp_location; | |
48 | + int saved_bp_location_count = bp_location_count; | |
49 | ||
50 | - ALL_BP_LOCATIONS (bl, blp_tmp) | |
51 | + saved_bp_location = xmalloc (sizeof (*bp_location) * bp_location_count); | |
52 | + memcpy (saved_bp_location, bp_location, sizeof (*bp_location) * bp_location_count); | |
53 | + old_chain = make_cleanup (xfree, saved_bp_location); | |
54 | + | |
55 | + ALL_BP_LOCATIONS_FROM (bl, blp_tmp, saved_bp_location, saved_bp_location_count) | |
56 | { | |
57 | bpstat bs_prev = bs; | |
58 | ||
59 | @@ -3460,6 +3474,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p | |
60 | insert_breakpoints (); | |
61 | } | |
62 | ||
63 | + do_cleanups (old_chain); | |
64 | return root_bs->next; | |
65 | } | |
66 | \f | |
67 | Index: gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp | |
68 | =================================================================== | |
69 | --- gdb-7.0.orig/gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100 | |
70 | +++ gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp 2009-11-25 10:27:50.000000000 +0100 | |
71 | @@ -68,6 +68,8 @@ set bp_location1 [gdb_get_line_number " | |
72 | set bp_location6 [gdb_get_line_number "set breakpoint 6 here"] | |
73 | set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1] | |
74 | set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1] | |
75 | +set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1] | |
76 | +set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1] | |
77 | set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1] | |
78 | set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1] | |
79 | ||
80 | @@ -110,15 +112,23 @@ gdb_test "break marker2 if (a==43)" \ | |
81 | "Breakpoint.*at.* file .*$srcfile1, line.*" | |
82 | ||
83 | # | |
84 | +# Check break involving inferior function call. | |
85 | +# | |
86 | +gdb_test "break marker4 if (multi_line_if_conditional(1,1,1)==0)" \ | |
87 | + "Breakpoint.*at.* file .*$srcfile1, line.*" | |
88 | + | |
89 | +# | |
90 | # check to see what breakpoints are set | |
91 | # | |
92 | ||
93 | if {$hp_aCC_compiler} { | |
94 | set marker1_proto "\\(void\\)" | |
95 | set marker2_proto "\\(int\\)" | |
96 | + set marker4_proto "\\(long\\)" | |
97 | } else { | |
98 | set marker1_proto "" | |
99 | set marker2_proto "" | |
100 | + set marker4_proto "" | |
101 | } | |
102 | ||
103 | gdb_test "info break" \ | |
104 | @@ -129,7 +139,9 @@ gdb_test "info break" \ | |
105 | \[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.* | |
106 | \[\t \]+stop only if \\(1==1\\).* | |
107 | \[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).* | |
108 | -\[\t \]+stop only if \\(a==43\\).*" \ | |
109 | +\[\t \]+stop only if \\(a==43\\).* | |
110 | +\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).* | |
111 | +\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*" \ | |
112 | "breakpoint info" | |
113 | ||
114 | ||
115 | @@ -220,3 +232,19 @@ gdb_expect { | |
116 | fail "(timeout) run until breakpoint at marker2" | |
117 | } | |
118 | } | |
119 | + | |
120 | +send_gdb "continue\n" | |
121 | +gdb_expect { | |
122 | + -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" { | |
123 | + pass "run until breakpoint at marker4" | |
124 | + } | |
125 | + -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" { | |
126 | + xfail "run until breakpoint at marker4" | |
127 | + } | |
128 | + -re "$gdb_prompt $" { | |
129 | + fail "run until breakpoint at marker4" | |
130 | + } | |
131 | + timeout { | |
132 | + fail "(timeout) run until breakpoint at marker4" | |
133 | + } | |
134 | +} |