public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] [gdb/testsuite] Fix regexp in vgdb_start
@ 2024-01-25 11:03 Tom de Vries
  2024-01-25 14:44 ` Tom Tromey
  0 siblings, 1 reply; 2+ messages in thread
From: Tom de Vries @ 2024-01-25 11:03 UTC (permalink / raw)
  To: gdb-patches

On Fedora 39 aarch64 I run into:
...
(gdb) target remote | vgdb --wait=2 --max-invoke-ms=2500 --pid=2114437^M
Remote debugging using | vgdb --wait=2 --max-invoke-ms=2500 --pid=2114437^M
relaying data between gdb and process 2114437^M
warning: remote target does not support file transfer, \
  attempting to access files from local filesystem.^M
Reading symbols from /lib/ld-linux-aarch64.so.1...^M
_start () at ../sysdeps/aarch64/dl-start.S:22^M
warning: 22     ../sysdeps/aarch64/dl-start.S: No such file or directory^M
(gdb) FAIL: gdb.base/valgrind-infcall.exp: target remote for vgdb
...

For contrast, on openSUSE Leap 15.4 x86_64 I have:
...
(gdb) target remote | vgdb --wait=2 --max-invoke-ms=2500 --pid=18797^M
Remote debugging using | vgdb --wait=2 --max-invoke-ms=2500 --pid=18797^M
relaying data between gdb and process 18797^M
warning: remote target does not support file transfer, \
  attempting to access files from local filesystem.^M
Reading symbols from /lib64/ld-linux-x86-64.so.2...^M
(No debugging symbols found in /lib64/ld-linux-x86-64.so.2)^M
0x0000000004002550 in _start () from /lib64/ld-linux-x86-64.so.2^M
(gdb) PASS: gdb.base/valgrind-infcall.exp: target remote for vgdb
...

The fail happens in vgdb_start because the regexp only matches the
"in _start ()" variant, not the "_start () at":
...
       gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
...
Which variant you get is determined by presence of debug info.

Fix this by also matching the "_start () at" variant.

Tested aarch64-linux and x86_64-linux.
---
 gdb/testsuite/lib/valgrind.exp | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/gdb/testsuite/lib/valgrind.exp b/gdb/testsuite/lib/valgrind.exp
index 11d92fff26a..2f2d58844f4 100644
--- a/gdb/testsuite/lib/valgrind.exp
+++ b/gdb/testsuite/lib/valgrind.exp
@@ -92,7 +92,10 @@ proc vgdb_start { {active_at_startup 1} } {
     set vgdbcmd "target remote | vgdb --wait=2 --max-invoke-ms=2500 --pid=$vgdbpid"
 
     if { $active_at_startup } {
-	gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
+	set start_re1 " in \\.?_start "
+	set start_re2 "\\.?_start \\(\\) at "
+	gdb_test "$vgdbcmd" "($start_re1|$start_re2).*" \
+	    "target remote for vgdb"
     } else {
 	# Let $binfile run a bit before attaching.  This is a bit of a hack,
 	# in that it lets test-case valgrind-infcall-2.exp run to the point of

base-commit: 726f209eb1b05842d816eac8b0b8f9c7f6cd9fbc
-- 
2.35.3


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

* Re: [PATCH] [gdb/testsuite] Fix regexp in vgdb_start
  2024-01-25 11:03 [PATCH] [gdb/testsuite] Fix regexp in vgdb_start Tom de Vries
@ 2024-01-25 14:44 ` Tom Tromey
  0 siblings, 0 replies; 2+ messages in thread
From: Tom Tromey @ 2024-01-25 14:44 UTC (permalink / raw)
  To: Tom de Vries; +Cc: gdb-patches

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

Tom> The fail happens in vgdb_start because the regexp only matches the
Tom> "in _start ()" variant, not the "_start () at":
Tom> ...
Tom>        gdb_test "$vgdbcmd" " in \\.?_start .*" "target remote for vgdb"
Tom> ...
Tom> Which variant you get is determined by presence of debug info.

Tom> Fix this by also matching the "_start () at" variant.

Seems reasonable to me.
Approved-By: Tom Tromey <tom@tromey.com>

Tom

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

end of thread, other threads:[~2024-01-25 14:44 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-01-25 11:03 [PATCH] [gdb/testsuite] Fix regexp in vgdb_start Tom de Vries
2024-01-25 14:44 ` 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).