Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Tom de Vries <tdevries@suse.de>
To: gdb-patches@sourceware.org
Subject: [PATCH v4 1/4] [gdb/testsuite] Extend gdb.opt/inline-cmds.exp
Date: Fri, 10 Apr 2026 12:12:49 +0200	[thread overview]
Message-ID: <20260410101252.1805303-2-tdevries@suse.de> (raw)
In-Reply-To: <20260410101252.1805303-1-tdevries@suse.de>

From: Andrew Burgess <aburgess@redhat.com>

When using this tentative patch [1], GDB regresses like this in test-case
gdb.opt/inline-cmds.exp:
...
 Temporary breakpoint 1, main () at inline-cmds.c:64
 64	  y = 8; /* set mi break here */
 (gdb) s
+main () at inline-cmds.c:66
 66	  result = func1 ();
 (gdb) s
 func1 () at inline-cmds.c:35
 35	  bar ();
 (gdb)
...
but the regression doesn't produce a FAIL.

The regression does produce a FAIL during the part of the test that runs in MI
mode.

Extend the test so the regression also produces a FAIL in CLI mode.

[1] https://sourceware.org/pipermail/gdb-patches/2026-March/226272.html
---
 gdb/testsuite/gdb.opt/inline-cmds.exp | 33 ++++++++++++++++++---------
 1 file changed, 22 insertions(+), 11 deletions(-)

diff --git a/gdb/testsuite/gdb.opt/inline-cmds.exp b/gdb/testsuite/gdb.opt/inline-cmds.exp
index 12db0709fe6..9bfc32f58b3 100644
--- a/gdb/testsuite/gdb.opt/inline-cmds.exp
+++ b/gdb/testsuite/gdb.opt/inline-cmds.exp
@@ -176,24 +176,35 @@ if { $bt_test == 0 } {
 # "stop" at the call sites before entering them.
 runto_main
 
-set msg "step into func1"
-set saw_call_site 0
-gdb_test_multiple "list" $msg {
-    -re "($first|$opt).*$gdb_prompt $" {
+set saw_call_site false
+set saw_main_frame false
+# Don't send the command using gdb_test_multiple, as it will be
+# injected into the regexp that start with '^' and use '-wrap', and we
+# send a different command using 'send_gdb' within the gdb_test_multiple.
+send_gdb "list\r"
+gdb_test_multiple "" "step into func1" {
+    -re "^(list|step)\r\n" {
+	exp_continue
+    }
+    -re -wrap "^\[^\r\n\]*($first|$opt)\[^\r\n\]*" {
 	send_gdb "step\r"
 	exp_continue
     }
-    -re "result = func1.*$gdb_prompt $" {
-	set saw_call_site 1
+    -re -wrap "^\[^\r\n\]*y = 8\[^\r\n\]*" {
+	send_gdb "step\r"
+	exp_continue
+    }
+    -re "^main \\(\\) at \[^\r\n\]+\r\n" {
+	set saw_main_frame true
+	exp_continue
+    }
+    -re -wrap "^\[^\r\n\]*result = func1 \\(\\);" {
+	set saw_call_site true
 	send_gdb "step\r"
 	exp_continue
     }
     -re "func1 \\\(\\\) at .*\r\n$decimal.*bar \\\(\\\);\r\n$gdb_prompt $" {
-	if { $saw_call_site } {
-	    pass $msg
-	} else {
-	    fail $msg
-	}
+	gdb_assert { $saw_call_site && !$saw_main_frame } $gdb_test_name
     }
 }
 
-- 
2.51.0


  reply	other threads:[~2026-04-10 10:14 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-04-10 10:12 [PATCH v4 0/4] [gdb] Fix missing print frame when stepping out of function Tom de Vries
2026-04-10 10:12 ` Tom de Vries [this message]
2026-04-10 10:12 ` [PATCH v4 2/4] [gdb] Add thread_control_state::step_start_function methods Tom de Vries
2026-04-10 10:12 ` [PATCH v4 3/4] gdb: fix missing print frame when stepping out of function Tom de Vries
2026-04-10 10:12 ` [PATCH v4 4/4] gdb: use get_current_frame consistently in print_stop_location Tom de Vries
2026-04-14 16:32 ` [PATCH v4 0/4] [gdb] Fix missing print frame when stepping out of function Andrew Burgess
2026-04-14 20:41   ` Tom de Vries

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=20260410101252.1805303-2-tdevries@suse.de \
    --to=tdevries@suse.de \
    --cc=gdb-patches@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