aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite')
-rw-r--r--gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp8
-rw-r--r--gdb/testsuite/gdb.mi/user-selected-context-sync.exp14
-rw-r--r--gdb/testsuite/gdb.multi/bp-thread-specific.exp7
-rw-r--r--gdb/testsuite/gdb.multi/inferior-specific-bp.exp12
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-continue.exp2
-rw-r--r--gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp4
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp6
-rw-r--r--gdb/testsuite/gdb.multi/pending-bp.exp206
-rw-r--r--gdb/testsuite/gdb.multi/tids.exp6
9 files changed, 229 insertions, 36 deletions
diff --git a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
index f736994..938e6de 100644
--- a/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
+++ b/gdb/testsuite/gdb.mi/new-ui-bp-deleted.exp
@@ -76,8 +76,12 @@ foreach_mi_ui_mode mode {
set loc2 [make_bp_loc "$::decimal\\.2"]
# Create the inferior-specific breakpoint.
- mi_create_breakpoint_multi "-g i2 foo" "create breakpoint in inferior 2" \
- -inferior "2" -locations "\\\[$loc1,$loc2\\\]"
+ mi_create_breakpoint "-g i2 foo" "create breakpoint in inferior 2" \
+ -number "$decimal" \
+ -type "breakpoint" \
+ -enabled "y" \
+ -func "foo" \
+ -inferior "2"
set bpnum [mi_get_valueof "/d" "\$bpnum" "INVALID"]
if {$mode eq "separate"} {
diff --git a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
index 93b91b4..e168a5e 100644
--- a/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
+++ b/gdb/testsuite/gdb.mi/user-selected-context-sync.exp
@@ -364,15 +364,9 @@ proc test_continue_to_start { mode inf } {
# Consume MI output.
with_spawn_id $mi_spawn_id {
- if { $inf == 1} {
- mi_expect_stop "breakpoint-hit" "child_sub_function" \
- "" "$srcfile" "$decimal" {"" "disp=\"del\""} \
- "thread $inf.2 stops MI"
- } else {
- mi_expect_stop "breakpoint-hit" "child_sub_function" \
- "" "$srcfile" "$decimal" {"" "disp=\"del\"" "locno=\"[0-9]+\""} \
- "thread $inf.2 stops MI"
- }
+ mi_expect_stop "breakpoint-hit" "child_sub_function" \
+ "" "$srcfile" "$decimal" {"" "disp=\"del\""} \
+ "thread $inf.2 stops MI"
}
}
}
@@ -439,7 +433,7 @@ proc_with_prefix test_setup { mode } {
with_spawn_id $mi_spawn_id {
mi_expect_stop "breakpoint-hit" "main" "" "$srcfile" "$decimal" \
- {"" "disp=\"del\"" "locno=\"[0-9]+\""} "main stop"
+ {"" "disp=\"del\""} "main stop"
}
# Consume CLI output.
diff --git a/gdb/testsuite/gdb.multi/bp-thread-specific.exp b/gdb/testsuite/gdb.multi/bp-thread-specific.exp
index 7635e84..c1d8752 100644
--- a/gdb/testsuite/gdb.multi/bp-thread-specific.exp
+++ b/gdb/testsuite/gdb.multi/bp-thread-specific.exp
@@ -50,7 +50,7 @@ gdb_test "info threads" \
# locations ('foo' in both inferiors) even though only one of those
# locations will ever trigger ('foo' in inferior 2).
gdb_test "break foo thread 2.1" \
- "Breakpoint $decimal at $hex: foo\\. \\(2 locations\\)"
+ "Breakpoint $decimal at $hex: file \[^\r\n\]+$srcfile, line $decimal\\."
set bpnum [get_integer_valueof "\$bpnum" "INVALID"]
@@ -58,10 +58,7 @@ set bpnum [get_integer_valueof "\$bpnum" "INVALID"]
# earlier breakpoint. Check that the thread-id used when describing
# the earlier breakpoints is correct.
gdb_test "break foo thread 1.1" \
- [multi_line \
- "Note: breakpoint $bpnum \\(thread 2.1\\) also set at pc $hex\\." \
- "Note: breakpoint $bpnum \\(thread 2.1\\) also set at pc $hex\\." \
- "Breakpoint $decimal at $hex: foo\\. \\(2 locations\\)"]
+ "Breakpoint $decimal at $hex: file \[^\r\n\]+$srcfile, line $decimal\\."
# Save the breakpoints into a file.
if {[is_remote host]} {
diff --git a/gdb/testsuite/gdb.multi/inferior-specific-bp.exp b/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
index 46efe6f..52f8418 100644
--- a/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
+++ b/gdb/testsuite/gdb.multi/inferior-specific-bp.exp
@@ -105,16 +105,8 @@ proc check_info_breakpoints { testname bp_number expected_loc_count } {
# Create an inferior-specific breakpoint. Use gdb_test instead of
# gdb_breakpoint here as we want to check the breakpoint was placed in
# multiple locations.
-#
-# Currently GDB still places inferior specific breakpoints into every
-# inferior, just like it does with thread specific breakpoints.
-# Hopefully this will change in the future, at which point, this test
-# will need updating.
-#
-# Two of these locations are in inferior 1, while the third is in
-# inferior 2.
gdb_test "break foo inferior 1" \
- "Breakpoint $decimal at $hex: foo\\. \\(3 locations\\)"
+ "Breakpoint $decimal at $hex: foo\\. \\(2 locations\\)"
set bp_number [get_integer_valueof "\$bpnum" "INVALID" \
"get b/p number for inferior specific breakpoint"]
@@ -123,7 +115,7 @@ set location_count 0
set saw_inf_cond false
check_info_breakpoints "first check for inferior specific breakpoint" \
- $bp_number 3
+ $bp_number 2
# Create a multi-inferior breakpoint to stop at.
gdb_breakpoint "stop_breakpt" message
diff --git a/gdb/testsuite/gdb.multi/multi-target-continue.exp b/gdb/testsuite/gdb.multi/multi-target-continue.exp
index d220106..d4b2fc2 100644
--- a/gdb/testsuite/gdb.multi/multi-target-continue.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-continue.exp
@@ -30,7 +30,7 @@ proc test_continue {non-stop} {
proc set_break {inf} {
gdb_test "break function${inf} thread ${inf}.1" \
- "Breakpoint .* function${inf}\\..*"
+ "Breakpoint ${::decimal} at ${::hex}: file .*, line ${::decimal}\\."
}
# Select inferior INF, and then run to a breakpoint on inferior
diff --git a/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp b/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
index 0aff708..36f9d24 100644
--- a/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
+++ b/gdb/testsuite/gdb.multi/multi-target-ping-pong-next.exp
@@ -52,12 +52,12 @@ proc test_ping_pong_next {} {
gdb_test "thread 1.1" "Switching to thread 1.1 .*"
gdb_test "break $srcfile:$line1 thread 1.1" \
- "Breakpoint .*$srcfile:$line1\\..*"
+ "Breakpoint .*$srcfile, line $line1\\."
gdb_test "continue" "hit Breakpoint .*"
gdb_test "break $srcfile:$line2 thread 2.1" \
- "Breakpoint .*$srcfile:$line2\\..*"
+ "Breakpoint .*$srcfile, line $line2\\."
# Now block inferior 1 and issue "next". We should stop at the
# breakpoint for inferior 2, given schedlock off.
diff --git a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
index 5fcd1ef..12c0a84 100644
--- a/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp-del-inferior.exp
@@ -129,10 +129,8 @@ proc do_bp_test { bp_type bp_pending } {
} else {
set bp_pattern_before \
[multi_line \
- "$bp_number\\s+breakpoint\\s+keep\\s+y\\s+<MULTIPLE>\\s*" \
- "\\s+stop only in [string_to_regexp $bp_restriction]" \
- "$bp_number\\.1\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 1" \
- "$bp_number\\.2\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 2"]
+ "$bp_number\\s+breakpoint\\s+keep\\s+y\\s+$::hex in $bp_func at \[^\r\n\]+ inf 1" \
+ "\\s+stop only in [string_to_regexp $bp_restriction]"]
set bp_pattern_after \
[multi_line \
diff --git a/gdb/testsuite/gdb.multi/pending-bp.exp b/gdb/testsuite/gdb.multi/pending-bp.exp
index 13f76f4..2a0644b 100644
--- a/gdb/testsuite/gdb.multi/pending-bp.exp
+++ b/gdb/testsuite/gdb.multi/pending-bp.exp
@@ -72,6 +72,48 @@ proc do_test_setup { inf_1_stop inf_2_stop } {
return true
}
+# Create a breakpoint on the function 'foo' in THREAD. It is expected
+# that the breakpoint created will be pending, this is checked by
+# running the 'info breakpoints' command.
+#
+# Returns the number for the newly created breakpoint.
+proc do_create_pending_foo_breakpoint { {thread "1.1"} } {
+ gdb_test "break foo thread $thread" \
+ [multi_line \
+ "Function \"foo\" not defined\\." \
+ "Breakpoint $::decimal \\(foo\\) pending\."] \
+ "set pending thread-specific breakpoint"
+ set bpnum [get_integer_valueof "\$bpnum" "*INVALID*" \
+ "get number for thread-specific breakpoint on foo"]
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+<PENDING>\\s+foo" \
+ "\\s+stop only in thread [string_to_regexp $thread]"] \
+ "check thread-specific breakpoint is initially pending"
+
+ return $bpnum
+}
+
+# Create a breakpoint on the function 'foo' in THREAD. It is expected
+# that the breakpoint created will not be pending, this is checked by
+# running the 'info breakpoints' command.
+#
+# Returns the number for the newly created breakpoint.
+proc do_create_foo_breakpoint { {thread "1.1"} } {
+ gdb_test "break foo thread $thread" \
+ "Breakpoint $::decimal at $::hex" \
+ "set thread-specific breakpoint"
+ set bpnum [get_integer_valueof "\$bpnum" "*INVALID*" \
+ "get number for thread-specific breakpoint on foo"]
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex\\s+<foo\[^>\]*> inf $::decimal" \
+ "\\s+stop only in thread [string_to_regexp $thread]"] \
+ "check thread-specific breakpoint is initially pending"
+
+ return $bpnum
+}
+
# Check that when a breakpoint is in the pending state, but that breakpoint
# does have some locations (those locations themselves are pending), GDB
# doesn't display the inferior list in the 'info breakpoints' output.
@@ -122,5 +164,169 @@ proc_with_prefix test_no_inf_display {} {
"check info breakpoints while breakpoint is pending"
}
+# Setup two inferiors. In #1 the symbol 'foo' has not yet been
+# loaded, while in #2 the symbol 'foo' has been loaded.
+#
+# Create a thread-specific breakpoint on 'foo' tied to a thread in
+# inferior #1, the breakpoint should be pending -- 'foo' is not yet
+# loaded in #1.
+#
+# Now move inferior #1 forward until 'foo' is loaded, check the
+# breakpoint is no longer pending.
+#
+# Move inferior #1 forward more until 'foo' is unloaded, check that
+# the breakpoint returns to the pending state.
+proc_with_prefix test_pending_toggle { } {
+
+ do_test_setup "Break before open" "Break before close"
+
+ set bpnum [do_create_pending_foo_breakpoint]
+
+ # Now return to inferior 1 and continue until the shared library is
+ # loaded, the breakpoint should become non-pending.
+ gdb_test "inferior 1" "Switching to inferior 1 .*" \
+ "switch back to inferior 1"
+ gdb_continue_to_breakpoint "stop in foo in inferior 1" "foo \\(\\) .*"
+
+ gdb_test "info breakpoint $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex <foo\[^>\]*> inf 1" \
+ "\\s+stop only in thread 1\\.1" \
+ "\\s+breakpoint already hit 1 time"] \
+ "check thread-specific breakpoint is no longer pending"
+
+ gdb_breakpoint [gdb_get_line_number "Break after close"] temporary
+ gdb_continue_to_breakpoint "close library"
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+<PENDING>\\s+foo" \
+ "\\s+stop only in thread 1\\.1" \
+ "\\s+breakpoint already hit 1 time"] \
+ "check thread-specific breakpoint is pending again"
+}
+
+# Create a Python variable VAR and set it to the gdb.Breakpoint object
+# corresponding to the breakpoint numbered BPNUM. If THREAD is not
+# the empty string then THREAD should be an integer, check that
+# gdb.Breakpoint.thread is set to the value of THREAD. Otherwise, if
+# THREAD is the empty string, check that gdb.Breakpoint.thread is set
+# to None.
+proc py_find_breakpoint { var bpnum {thread ""} } {
+ gdb_test_no_output \
+ "python ${var}=\[b for b in gdb.breakpoints() if b.number == $bpnum\]\[0\]" \
+ "find Python gdb.Breakpoint object"
+ if { $thread ne "" } {
+ gdb_test_no_output "python assert(${var}.thread == ${thread})" \
+ "check thread attribute is currently correct"
+ } else {
+ gdb_test_no_output "python assert(${var}.thread is None)" \
+ "check thread attribute is currently correct"
+ }
+}
+
+# Setup two inferiors. In #1 the symbol 'foo' has not yet been
+# loaded, while in #2 the symbol 'foo' has been loaded.
+#
+# Create a thread-specific breakpoint on 'foo' tied to a thread in
+# inferior #1, the breakpoint should be pending -- 'foo' is not yet
+# loaded in #1.
+#
+# Use Python to change the thread of the thread-specific breakpoint to
+# a thread in inferior #2, at this point the thread should gain a
+# location and become non-pending.
+#
+# Set the thread back to a thread in inferior #1, the breakpoint
+# should return to the pending state.
+proc_with_prefix py_test_toggle_thread {} {
+ do_test_setup "Break before open" "Break after open"
+
+ set bpnum [do_create_pending_foo_breakpoint]
+
+ py_find_breakpoint "bp" $bpnum 1
+
+ gdb_test_no_output "python bp.thread = 2" \
+ "change thread on thread-specific breakpoint"
+ gdb_test "info breakpoint $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+$::hex <foo\[^>\]*> inf 2" \
+ "\\s+stop only in thread 2\\.1"] \
+ "check thread-specific breakpoint now has a location"
+
+ gdb_test_no_output "set call_count = 2" "set call_count in inferior 2"
+ gdb_continue_to_breakpoint "stop at foo in inferior 2" "foo \\(\\) .*"
+
+ gdb_test_no_output "python bp.thread = 1" \
+ "restore thread on thread-specific breakpoint"
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "$bpnum\\s+breakpoint\\s+keep\\s+y\\s+<PENDING>\\s+foo" \
+ "\\s+stop only in thread 1\\.1" \
+ "\\s+breakpoint already hit 1 time"] \
+ "check thread-specific breakpoint has returned to pending"
+
+ gdb_breakpoint [gdb_get_line_number "Break after close"] temporary
+ gdb_continue_to_breakpoint "stop after close in inferior 2" \
+ ".* Break after close\\. .*"
+
+ gdb_test "inferior 1" "Switching to inferior 1 .*" \
+ "switch to inferior 1"
+ gdb_continue_to_breakpoint "stop at foo in inferior 1" "foo \\(\\) .*"
+}
+
+# Setup two inferiors. Both inferiors have the symbol 'foo'
+# available.
+#
+# Create a thread-specific breakpoint on 'foo' tied to a thread in
+# inferior #1, the breakpoint should not be pending, but will only
+# have a single location, the location in inferior #1.
+#
+# Use Python to change the thread of the thread-specific breakpoint to
+# None. At this point the breakpoint should gain a second location, a
+# location in inferior #2.
+proc_with_prefix py_test_clear_thread {} {
+ do_test_setup "Break after open" "Break after open"
+
+ set bpnum [do_create_foo_breakpoint]
+
+ py_find_breakpoint "bp" $bpnum 1
+
+ gdb_test_no_output "python bp.thread = None" \
+ "clear thread on thread-specific breakpoint"
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "${bpnum}\\s+breakpoint\\s+keep y\\s+<MULTIPLE>\\s*" \
+ "${bpnum}\\.1\\s+y\\s+${::hex}\\s+<foo\[^>\]*> inf $::decimal" \
+ "${bpnum}\\.2\\s+y\\s+${::hex}\\s+<foo\[^>\]*> inf $::decimal"] \
+ "check for a location in both inferiors"
+
+ gdb_continue_to_breakpoint "stop at foo in inferior 2" "foo \\(\\) .*"
+ gdb_test_no_output "set call_count = 2" "set call_count in inferior 2"
+
+ gdb_test "inferior 1" "Switching to inferior 1 .*" \
+ "switch to inferior 1"
+ gdb_continue_to_breakpoint "stop at foo in inferior 1" "foo \\(\\) .*"
+ gdb_test_no_output "set call_count = 2" "set call_count in inferior 1"
+
+ gdb_test_no_output "python bp.thread = 2"
+ gdb_test "info breakpoints $bpnum" \
+ [multi_line \
+ "${bpnum}\\s+breakpoint\\s+keep y\\s+${::hex}\\s+<foo\[^>\]*> inf 2" \
+ "\\s+stop only in thread 2\\.1" \
+ "\\s+breakpoint already hit 2 times"] \
+ "check for a location only in inferior 2"
+
+ gdb_breakpoint [gdb_get_line_number "Break after close"] temporary
+ gdb_continue_to_breakpoint "stop after close in inferior 1" \
+ ".* Break after close\\. .*"
+
+ gdb_test "inferior 2" "Switching to inferior 2 .*" \
+ "switch back to inferior 2"
+ gdb_continue_to_breakpoint "stop at foo again in inferior 2" \
+ "foo \\(\\) .*"
+}
+
# Run all the tests.
test_no_inf_display
+test_pending_toggle
+py_test_toggle_thread
+py_test_clear_thread
diff --git a/gdb/testsuite/gdb.multi/tids.exp b/gdb/testsuite/gdb.multi/tids.exp
index 573b02f..4f78884 100644
--- a/gdb/testsuite/gdb.multi/tids.exp
+++ b/gdb/testsuite/gdb.multi/tids.exp
@@ -433,11 +433,13 @@ if { [allow_python_tests] } {
gdb_py_test_silent_cmd "python bp = gdb.breakpoints()\[0\]" \
"get python breakpoint" 0
- gdb_test "python bp.thread = 6" "thread = 6" \
+ gdb_test_no_output "python bp.thread = 6" \
"make breakpoint thread-specific with python"
# Check that the inferior-qualified ID is correct.
gdb_test "info breakpoint" \
- "stop only in thread 1.3\r\n.*" \
+ [multi_line \
+ "$decimal\\s+\[^\r\n\]+ in thread_function1 at \[^\r\n\]+" \
+ "\\s+stop only in thread 1\\.3"] \
"thread specific breakpoint right thread"
}
}