public inbox for gdb-cvs@sourceware.org
help / color / mirror / Atom feed
From: Simon Marchi <simark@sourceware.org>
To: gdb-cvs@sourceware.org
Subject: [binutils-gdb] gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver
Date: Fri, 10 Feb 2023 18:58:27 +0000 (GMT)	[thread overview]
Message-ID: <20230210185827.8F6513858414@sourceware.org> (raw)

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=71bb560755cad815f5159170822cb66df71f916f

commit 71bb560755cad815f5159170822cb66df71f916f
Author: Simon Marchi <simon.marchi@polymtl.ca>
Date:   Tue Jan 17 11:33:39 2023 -0500

    gdb/testsuite: fix gdb.gdb/selftest.exp for native-extended-gdbserver
    
    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

Diff:
---
 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
 	}
     }

                 reply	other threads:[~2023-02-10 18:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20230210185827.8F6513858414@sourceware.org \
    --to=simark@sourceware.org \
    --cc=gdb-cvs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).