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>
}
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"
}