diff options
Diffstat (limited to 'gdb/testsuite')
-rw-r--r-- | gdb/testsuite/gdb.base/save-bp.exp | 16 | ||||
-rw-r--r-- | gdb/testsuite/gdb.multi/bp-thread-specific.exp | 46 |
2 files changed, 62 insertions, 0 deletions
diff --git a/gdb/testsuite/gdb.base/save-bp.exp b/gdb/testsuite/gdb.base/save-bp.exp index 41d71837fb6..68933d36427 100644 --- a/gdb/testsuite/gdb.base/save-bp.exp +++ b/gdb/testsuite/gdb.base/save-bp.exp @@ -89,3 +89,19 @@ gdb_test_sequence "info break" "info break" [list \ "\[\r\n\]+\[ \t\]+printf" \ "\[\r\n\]+$disabled_row_start main at \[^\r\n\]*$srcfile:$loc_bp8" \ ] + +# Copy the saved breakpoints file to the local machine (if necessary), +# and then check its contents. +if {[is_remote host]} { + set bps [remote_upload host bps [standard_output_file bps]] +} +set fh [open $bps] +set lines [split [read $fh] "\n"] +close $fh + +with_test_prefix "in bps file" { + gdb_assert {[lsearch -regexp $lines "break ${srcfile}:${loc_bp2}$"] != -1} \ + "check for general breakpoint" + gdb_assert {[lsearch -regexp $lines "break ${srcfile}:${loc_bp3} thread 1\\.1"] != -1} \ + "check for thread-specific breakpoint" +} diff --git a/gdb/testsuite/gdb.multi/bp-thread-specific.exp b/gdb/testsuite/gdb.multi/bp-thread-specific.exp index 777fcf85ab0..85c08f44a2c 100644 --- a/gdb/testsuite/gdb.multi/bp-thread-specific.exp +++ b/gdb/testsuite/gdb.multi/bp-thread-specific.exp @@ -15,6 +15,9 @@ # Check that GDB uses the correct thread-id when describing multiple # thread specific breakpoints at the same location. +# +# Also check that the correct thread-ids are used in the saved +# breakpoints file. # The plain remote target can't do multiple inferiors. require !use_gdb_stub @@ -59,3 +62,46 @@ gdb_test "break foo thread 1.1" \ "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\\)"] + +# Save the breakpoints into a file. +if {[is_remote host]} { + set bps bps +} else { + set bps [standard_output_file bps] +} + +remote_file host delete "$bps" +gdb_test "save breakpoints $bps" "" "save breakpoint to bps" + +if {[is_remote host]} { + set bps [remote_upload host bps [standard_output_file bps]] +} + +# Now dig through the saved breakpoints file and check that the +# thread-ids were written out correctly. First open the saved +# breakpoints and read them into a list. +set fh [open $bps] +set lines [split [read $fh] "\n"] +close $fh + +# Except the list created from the saved breakpoints file will have a +# blank line entry at the end, so remove it now. +gdb_assert {[string equal [lindex $lines end] ""]} \ + "check last item was an empty line" +set lines [lrange $lines 0 end-1] + +# These are the lines we expect in the saved breakpoints file, in the +# order that we expect them. These are strings, not regexps. +set expected_results \ + [list \ + "break -qualified main" \ + "break foo thread 2.1" \ + "break foo thread 1.1"] + +# Now check that the files contents (in LINES) matches the +# EXPECTED_RESULTS. +gdb_assert {[llength $lines] == [llength $expected_results]} \ + "correct number of lines in saved breakpoints file" +foreach a $lines b $expected_results { + gdb_assert {[string equal $a $b]} "line '$b'" +} |