gdb/gdb-bz538626-bp_location-ac...

135 lines
5.1 KiB
Diff
Raw Normal View History

Index: gdb-7.0/gdb/breakpoint.c
===================================================================
--- gdb-7.0.orig/gdb/breakpoint.c 2009-11-25 10:24:49.000000000 +0100
+++ gdb-7.0/gdb/breakpoint.c 2009-11-25 10:28:35.000000000 +0100
@@ -337,14 +337,21 @@ static int executing_startup;
B ? (TMP=B->next, 1): 0; \
B = TMP)
-/* Similar iterator for the low-level breakpoints. SAFE variant is not
- provided so update_global_location_list must not be called while executing
- the block of ALL_BP_LOCATIONS. */
-
-#define ALL_BP_LOCATIONS(B,BP_TMP) \
- for (BP_TMP = bp_location; \
- BP_TMP < bp_location + bp_location_count && (B = *BP_TMP); \
- BP_TMP++)
+/* Similar iterator for the low-level breakpoints. This iterator
+ requires a defined BP_LOCATION array and BP_LOCATION_COUNT. */
+
+#define ALL_BP_LOCATIONS_FROM(B,BP_TMP,BP_LOCATION,BP_LOCATION_COUNT) \
+ for (BP_TMP = BP_LOCATION; \
+ BP_TMP < BP_LOCATION + BP_LOCATION_COUNT && (B = *BP_TMP); \
+ BP_TMP++)
+
+/* Iterator that calls ALL_BP_LOCATIONS_FROM with the global
+ bp_locations and bp_location_count variables. SAFE variant is not
+ provided so update_global_location_list must not be called while
+ executing the block of ALL_BP_LOCATIONS. */
+
+#define ALL_BP_LOCATIONS(B,BP_TMP) \
+ ALL_BP_LOCATIONS_FROM(B,BP_TMP,bp_location, bp_location_count)
/* Iterator for tracepoints only. */
@@ -3313,6 +3320,7 @@ bpstat_check_breakpoint_conditions (bpst
bpstat
bpstat_stop_status (CORE_ADDR bp_addr, ptid_t ptid)
{
+ struct cleanup *old_chain;
struct breakpoint *b = NULL;
struct bp_location *bl, **blp_tmp;
struct bp_location *loc;
@@ -3322,8 +3330,14 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
bpstat bs = root_bs;
int ix;
int need_remove_insert, update_locations = 0;
+ struct bp_location **saved_bp_location;
+ int saved_bp_location_count = bp_location_count;
- ALL_BP_LOCATIONS (bl, blp_tmp)
+ saved_bp_location = xmalloc (sizeof (*bp_location) * bp_location_count);
+ memcpy (saved_bp_location, bp_location, sizeof (*bp_location) * bp_location_count);
+ old_chain = make_cleanup (xfree, saved_bp_location);
+
+ ALL_BP_LOCATIONS_FROM (bl, blp_tmp, saved_bp_location, saved_bp_location_count)
{
bpstat bs_prev = bs;
@@ -3460,6 +3474,7 @@ bpstat_stop_status (CORE_ADDR bp_addr, p
insert_breakpoints ();
}
+ do_cleanups (old_chain);
return root_bs->next;
}
Index: gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp
===================================================================
--- gdb-7.0.orig/gdb/testsuite/gdb.base/condbreak.exp 2009-01-03 06:58:03.000000000 +0100
+++ gdb-7.0/gdb/testsuite/gdb.base/condbreak.exp 2009-11-25 10:27:50.000000000 +0100
@@ -68,6 +68,8 @@ set bp_location1 [gdb_get_line_number "
set bp_location6 [gdb_get_line_number "set breakpoint 6 here"]
set bp_location8 [gdb_get_line_number "set breakpoint 8 here" $srcfile1]
set bp_location9 [gdb_get_line_number "set breakpoint 9 here" $srcfile1]
+set bp_location13 [gdb_get_line_number "set breakpoint 13 here" $srcfile1]
+set bp_location14 [gdb_get_line_number "set breakpoint 14 here" $srcfile1]
set bp_location15 [gdb_get_line_number "set breakpoint 15 here" $srcfile1]
set bp_location16 [gdb_get_line_number "set breakpoint 16 here" $srcfile1]
@@ -110,15 +112,23 @@ gdb_test "break marker2 if (a==43)" \
"Breakpoint.*at.* file .*$srcfile1, line.*"
#
+# Check break involving inferior function call.
+#
+gdb_test "break marker4 if (multi_line_if_conditional(1,1,1)==0)" \
+ "Breakpoint.*at.* file .*$srcfile1, line.*"
+
+#
# check to see what breakpoints are set
#
if {$hp_aCC_compiler} {
set marker1_proto "\\(void\\)"
set marker2_proto "\\(int\\)"
+ set marker4_proto "\\(long\\)"
} else {
set marker1_proto ""
set marker2_proto ""
+ set marker4_proto ""
}
gdb_test "info break" \
@@ -129,7 +139,9 @@ gdb_test "info break" \
\[0-9\]+\[\t \]+breakpoint keep y.* in main at .*$srcfile:$bp_location1.*
\[\t \]+stop only if \\(1==1\\).*
\[0-9\]+\[\t \]+breakpoint keep y.* in marker2$marker2_proto at .*$srcfile1:($bp_location8|$bp_location9).*
-\[\t \]+stop only if \\(a==43\\).*" \
+\[\t \]+stop only if \\(a==43\\).*
+\[0-9\]+\[\t \]+breakpoint keep y.* in marker4$marker4_proto at .*$srcfile1:($bp_location13|$bp_location14).*
+\[\t \]+stop only if \\(multi_line_if_conditional\\(1,1,1\\)==0\\).*" \
"breakpoint info"
@@ -220,3 +232,19 @@ gdb_expect {
fail "(timeout) run until breakpoint at marker2"
}
}
+
+send_gdb "continue\n"
+gdb_expect {
+ -re "Continuing\\..*Breakpoint \[0-9\]+, marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" {
+ pass "run until breakpoint at marker4"
+ }
+ -re "Continuing\\..*Breakpoint \[0-9\]+, $hex in marker4 \\(d=177601976\\) at .*$srcfile1:($bp_location13|$bp_location14).*($bp_location13|$bp_location14)\[\t \]+.*" {
+ xfail "run until breakpoint at marker4"
+ }
+ -re "$gdb_prompt $" {
+ fail "run until breakpoint at marker4"
+ }
+ timeout {
+ fail "(timeout) run until breakpoint at marker4"
+ }
+}