public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix fail in gdb.dap/sources.exp
@ 2024-02-13 10:08 Tom de Vries
  2024-02-13 14:50 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-02-13 10:08 UTC (permalink / raw)
  To: gdb-patches; +Cc: Tom Tromey

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.

PR testsuite/31374
https://sourceware.org/bugzilla/show_bug.cgi?id=31374
---
 gdb/testsuite/gdb.dap/sources.exp | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/gdb/testsuite/gdb.dap/sources.exp b/gdb/testsuite/gdb.dap/sources.exp
index f601190d6f5..9b56337e5a8 100644
--- a/gdb/testsuite/gdb.dap/sources.exp
+++ b/gdb/testsuite/gdb.dap/sources.exp
@@ -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]]

base-commit: 4dad3c1e1c9e789addc0d196cef8e8ea22ddbeda
-- 
2.35.3


^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [PATCH] [gdb/testsuite] Fix fail in gdb.dap/sources.exp
  2024-02-13 10:08 [PATCH] [gdb/testsuite] Fix fail in gdb.dap/sources.exp Tom de Vries
@ 2024-02-13 14:50 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-02-13 14:50 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches, Tom Tromey

>>>>> "Tom" == Tom de Vries <tdevries@suse.de> writes:

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

Thanks for the patch.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2024-02-13 14:50 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-13 10:08 [PATCH] [gdb/testsuite] Fix fail in gdb.dap/sources.exp Tom de Vries
2024-02-13 14:50 ` Tom Tromey

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).