From: Andrew Burgess Date: Tue, 14 Apr 2026 20:36:09 +0000 (+0200) Subject: [gdb/testsuite] Extend gdb.opt/inline-cmds.exp X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3f9fba14ca39f1ec716ca7f197b45d5f61544170;p=thirdparty%2Fbinutils-gdb.git [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 [1] https://sourceware.org/pipermail/gdb-patches/2026-March/226272.html --- 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 } }