From: Tom de Vries Date: Sat, 19 Jul 2025 15:08:44 +0000 (+0200) Subject: [gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=6ca57d1619172ff388bcd96341c999caebdfe344;p=thirdparty%2Fbinutils-gdb.git [gdb/testsuite] Fix gdb.base/backtrace-through-cu-nodebug.exp without python support With a gdb build without python support, and test-case gdb.base/backtrace-through-cu-nodebug.exp I run into: ... (gdb) bt^M Required frame unwinder may have been disabled, \ see 'maint info frame-unwinders'^M (gdb) FAIL: $exp: verify unwind fail without CFI ... With a gdb build with python support we have instead: ... (gdb) bt^M Python Exception : \ Required frame unwinder may have been disabled, \ see 'maint info frame-unwinders'^M (gdb) PASS: $exp: verify unwind fail without CFI ... but if I change the "bt" into "bt -no-filters" I get the same FAIL and corresponding output. So there are two scenarios here. In the first: - the bt command is called - frame #0 is printed - trying to get the next frame fails and an error is thrown, aborting the backtrace - the error is caught and printed In the second: - the bt command is called - the frame filter is applied - doing so triggers the same error, which is caught and printed by gdbpy_apply_frame_filter, returning EXT_LANG_BT_NO_FILTERS - frame #0 is printed - getting the next frame fails, and the backtrace stops It seems worthwhile to exercise both scenarios if possible, so add a "bt -no-filters" test. Fix the FAIL by updating the regexp to allow both scenarios. Tested on aarch64-linux. Reviewed-By: Keith Seitz --- diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp index 53bf642a92c..36a9d10a9eb 100644 --- a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp +++ b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp @@ -73,10 +73,32 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \ } if { [prepare_test false] } { - gdb_test "bt" \ + set re_msg \ + [string_list_to_regexp \ + "Required frame unwinder may have been disabled," \ + " see 'maint info frame-unwinders'"] + set hs {[^\r\n]} + set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+" + set re_bt_no_filters \ [multi_line \ - "\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \ - "#0\\s+callback \\(\\) \[^\r\n\]+"] \ + $re_bt_line \ + $re_msg] + gdb_test "bt -no-filters" \ + $re_bt_no_filters \ + "verify no-filters unwind fail without CFI" + + # Flush frame cache to retrigger the message. + gdb_test "maint flush register-cache" \ + [string_to_regexp "Register cache flushed."] + + # This output may occur when we run into the message while applying the + # frame filters. + set re_bt \ + [multi_line \ + $hs+$re_msg \ + $re_bt_line] + gdb_test "bt" \ + "($re_bt|$re_bt_no_filters)" \ "verify unwind fail without CFI" }