]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Extend gdb.opt/inline-cmds.exp
authorAndrew Burgess <aburgess@redhat.com>
Tue, 14 Apr 2026 20:36:09 +0000 (22:36 +0200)
committerTom de Vries <tdevries@suse.de>
Tue, 14 Apr 2026 20:36:09 +0000 (22:36 +0200)
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 <aburgess@redhat.com>
[1] https://sourceware.org/pipermail/gdb-patches/2026-March/226272.html

gdb/testsuite/gdb.opt/inline-cmds.exp

index 12db0709fe691c9130a9aea0369556e37bc46a2c..9bfc32f58b3f12fa7b976f97f0cad2640325671c 100644 (file)
@@ -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
     }
 }