public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver
@ 2023-01-17 16:33 Simon Marchi
  2023-02-10 17:31 ` Tom Tromey
  0 siblings, 1 reply; 3+ messages in thread
From: Simon Marchi @ 2023-01-17 16:33 UTC (permalink / raw)
  To: gdb-patches; +Cc: Simon Marchi

From: Simon Marchi <simon.marchi@polymtl.ca>

Following commit 4e2a80ba606 ("gdb/testsuite: expect SIGSEGV from top
GDB spawn id"), the next failure I get in gdb.gdb/selftest.exp, using
the native-extended-gdbserver, is:

    (gdb) PASS: gdb.gdb/selftest.exp: send ^C to child process
    signal SIGINT
    Continuing with signal SIGINT.
    FAIL: gdb.gdb/selftest.exp: send SIGINT signal to child process (timeout)

The problem is that in this gdb_test_multiple:

    set description "send SIGINT signal to child process"
    gdb_test_multiple "signal SIGINT" "$description" {
	-re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n.* $" {
	    pass "$description"
	}
    }

The "Continuing with signal SIGINT" portion is printed by the top GDB,
while the Quit portion is printed by the bottom GDB.  As the
gdb_test_multiple is written, it expects both the the top GDB's spawn
id.

Fix this by splitting the gdb_test_multiple in two.  The first one
expects the "Continuing with signal SIGINT" from the top GDB.  The
second one expect "Quit"  and the "(xgdb)" prompt from
$inferior_spawn_id.  When debugging natively, this spawn id will be the
same as the top GDB's spawn id, but it's different when debugging with
GDBserver.

Change-Id: I689bd369a041b48f4dc9858d38bf977d09600da2
---
 gdb/testsuite/gdb.gdb/selftest.exp | 15 +++++++++++----
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/gdb/testsuite/gdb.gdb/selftest.exp b/gdb/testsuite/gdb.gdb/selftest.exp
index df12602b64b..ac3f3fc2f6a 100644
--- a/gdb/testsuite/gdb.gdb/selftest.exp
+++ b/gdb/testsuite/gdb.gdb/selftest.exp
@@ -114,11 +114,18 @@ proc test_with_self { } {
 	    }
 	}
     }
-    
+
     set description "send SIGINT signal to child process"
-    gdb_test_multiple "signal SIGINT" "$description" {
-	-re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\nQuit\r\n.* $" {
-	    pass "$description"
+    gdb_test_multiple "signal SIGINT" "$description, top GDB message" {
+	-re "^signal SIGINT\r\nContinuing with signal SIGINT.\r\n" {
+	    pass $gdb_test_name
+	}
+    }
+
+    gdb_test_multiple "" "$description, bottom GDB message" {
+	-i $inferior_spawn_id
+	-re "Quit\r\n\\(xgdb\\) $" {
+	    pass $gdb_test_name
 	}
     }
 

base-commit: 4e2a80ba606fdb48018d06b510ff7873a10e43ae
-- 
2.39.0


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

* Re: [PATCH] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver
  2023-01-17 16:33 [PATCH] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver Simon Marchi
@ 2023-02-10 17:31 ` Tom Tromey
  2023-02-10 18:56   ` Simon Marchi
  0 siblings, 1 reply; 3+ messages in thread
From: Tom Tromey @ 2023-02-10 17:31 UTC (permalink / raw)
  To: Simon Marchi via Gdb-patches; +Cc: Simon Marchi, Simon Marchi

>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:

Simon> Fix this by splitting the gdb_test_multiple in two.  The first one
Simon> expects the "Continuing with signal SIGINT" from the top GDB.  The
Simon> second one expect "Quit"  and the "(xgdb)" prompt from
Simon> $inferior_spawn_id.  When debugging natively, this spawn id will be the
Simon> same as the top GDB's spawn id, but it's different when debugging with
Simon> GDBserver.

Did this go in?  It looks reasonable to me FWIW.

Tom

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

* Re: [PATCH] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver
  2023-02-10 17:31 ` Tom Tromey
@ 2023-02-10 18:56   ` Simon Marchi
  0 siblings, 0 replies; 3+ messages in thread
From: Simon Marchi @ 2023-02-10 18:56 UTC (permalink / raw)
  To: Tom Tromey, Simon Marchi via Gdb-patches; +Cc: Simon Marchi

On 2/10/23 12:31, Tom Tromey wrote:
>>>>>> "Simon" == Simon Marchi via Gdb-patches <gdb-patches@sourceware.org> writes:
> 
> Simon> Fix this by splitting the gdb_test_multiple in two.  The first one
> Simon> expects the "Continuing with signal SIGINT" from the top GDB.  The
> Simon> second one expect "Quit"  and the "(xgdb)" prompt from
> Simon> $inferior_spawn_id.  When debugging natively, this spawn id will be the
> Simon> same as the top GDB's spawn id, but it's different when debugging with
> Simon> GDBserver.
> 
> Did this go in?  It looks reasonable to me FWIW.

No, thanks for reminding me!  I'll re-test and push.

Simon

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

end of thread, other threads:[~2023-02-10 18:56 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-01-17 16:33 [PATCH] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver Simon Marchi
2023-02-10 17:31 ` Tom Tromey
2023-02-10 18:56   ` Simon Marchi

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).