[binutils-gdb] [gdb/testsuite] Extend gdb.opt/inline-cmds.exp

Tom de Vries via Gdb-cvs <[email protected]>
Newsgroups gmane.comp.gdb.cvs
Message-ID <[email protected]>
https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=3f9fba14ca39f1ec716ca7f197b45d5f61544170

commit 3f9fba14ca39f1ec716ca7f197b45d5f61544170
Author: Andrew Burgess <[email protected]>
Date:   Tue Apr 14 22:36:09 2026 +0200

    [gdb/testsuite] Extend gdb.opt/inline-cmds.exp
    
    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.
    
    Approved-By: Andrew Burgess <[email protected]>
    
    [1] https://sourceware.org/pipermail/gdb-patches/2026-March/226272.html

Diff:
---
 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
     }
 }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.