diff options
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/testsuite/gdb.dap/sources.exp | 41 |
1 files changed, 24 insertions, 17 deletions
diff --git a/gdb/testsuite/gdb.dap/sources.exp b/gdb/testsuite/gdb.dap/sources.exp index 9b56337..ee853cc 100644 --- a/gdb/testsuite/gdb.dap/sources.exp +++ b/gdb/testsuite/gdb.dap/sources.exp @@ -33,30 +33,37 @@ if {[dap_launch $testfile stop_at_main 1] == ""} { return } -set obj [dap_check_request_and_response loadedSources loadedSources] -set path "" -foreach src [dict get [lindex $obj 0] body sources] { - if {[file tail [dict get $src name]] == "sources.c"} { - set path [dict get $src path] - } -} - -if {$path == ""} { - fail "sources.c in loadedSources" -} else { - pass "sources.c in loadedSources" - +proc do_tests {} { dap_wait_for_event_and_check "stopped at function breakpoint" stopped \ "body reason" breakpoint + set obj [dap_check_request_and_response loadedSources loadedSources] + if { $obj == "" } { + return + } + + set path "" + foreach src [dict get [lindex $obj 0] body sources] { + if {[file tail [dict get $src name]] == "sources.c"} { + set path [dict get $src path] + } + } + gdb_assert {$path != "" } "sources.c in loadedSources" + if {$path == ""} { + return + } + set obj [dap_check_request_and_response "get source" source \ [format {o source [o path [s %s]] \ - sourceReference [i 0]} $path]] - if { $obj != "" } { - set text [dict get [lindex $obj 0] body content] - gdb_assert {[string first "Distinguishing comment" $text] != -1} + sourceReference [i 0]} $path]] + if { $obj == "" } { + return } + + set text [dict get [lindex $obj 0] body content] + gdb_assert {[string first "Distinguishing comment" $text] != -1} } +do_tests dap_shutdown |