diff options
author | Tom de Vries <tdevries@suse.de> | 2025-07-19 17:08:44 +0200 |
---|---|---|
committer | Tom de Vries <tdevries@suse.de> | 2025-07-19 17:08:44 +0200 |
commit | 6ca57d1619172ff388bcd96341c999caebdfe344 (patch) | |
tree | 1192cb9ecf227b402a229d42445dd70f68a2f676 | |
parent | d60ae6437b59d638c9b60c544b8943d413bbb1c3 (diff) | |
download | binutils-6ca57d1619172ff388bcd96341c999caebdfe344.zip binutils-6ca57d1619172ff388bcd96341c999caebdfe344.tar.gz binutils-6ca57d1619172ff388bcd96341c999caebdfe344.tar.bz2 |
[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 <class 'gdb.error'>: \
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 <keiths@redhat.com>
-rw-r--r-- | gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp | 28 |
1 files changed, 25 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp b/gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp index 53bf642..36a9d10 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" } |