]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Fix fail in gdb.dap/sources.exp
authorTom de Vries <tdevries@suse.de>
Tue, 13 Feb 2024 14:53:28 +0000 (15:53 +0100)
committerTom de Vries <tdevries@suse.de>
Tue, 13 Feb 2024 14:53:28 +0000 (15:53 +0100)
With test-case gdb.dap/sources.exp, I run into:
...
{"request_seq": 4, "type": "response", "command": "source", \
  "success": false, "message": "notStopped", \
  "seq": 11}FAIL: gdb.dap/sources.exp: get source success
...

The fail happens because the request races with the stopping at main as
requested by:
...
if {[dap_launch $testfile stop_at_main 1] == ""} {
...

Fix this by waiting for the stop, in the same way that is done in other
test-cases that use stop_at_main.

Tested on x86_64-linux.

Approved-By: Tom Tromey <tom@tromey.com>
PR testsuite/31374
https://sourceware.org/bugzilla/show_bug.cgi?id=31374

gdb/testsuite/gdb.dap/sources.exp

index f601190d6f53748d2ae437dea35343b23842f071..9b56337e5a8b1486afa349b1ce753ec8c3ccdaa9 100644 (file)
@@ -46,6 +46,9 @@ if {$path == ""} {
 } else {
     pass "sources.c in loadedSources"
 
+    dap_wait_for_event_and_check "stopped at function breakpoint" stopped \
+       "body reason" breakpoint
+
     set obj [dap_check_request_and_response "get source" source \
                 [format {o source [o path [s %s]] \
                            sourceReference [i 0]} $path]]