Skip to content

Commit 6ca57d1

Browse files
committed
[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 <[email protected]>
1 parent d60ae64 commit 6ca57d1

File tree

1 file changed

+25
-3
lines changed

1 file changed

+25
-3
lines changed

gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp

Lines changed: 25 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -73,10 +73,32 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
7373
}
7474

7575
if { [prepare_test false] } {
76-
gdb_test "bt" \
76+
set re_msg \
77+
[string_list_to_regexp \
78+
"Required frame unwinder may have been disabled," \
79+
" see 'maint info frame-unwinders'"]
80+
set hs {[^\r\n]}
81+
set re_bt_line "#0\\s+[string_to_regexp {callback ()}] $hs+"
82+
set re_bt_no_filters \
7783
[multi_line \
78-
"\[^\r\n\]+Required frame unwinder may have been disabled, \[^\r\n\]+" \
79-
"#0\\s+callback \\(\\) \[^\r\n\]+"] \
84+
$re_bt_line \
85+
$re_msg]
86+
gdb_test "bt -no-filters" \
87+
$re_bt_no_filters \
88+
"verify no-filters unwind fail without CFI"
89+
90+
# Flush frame cache to retrigger the message.
91+
gdb_test "maint flush register-cache" \
92+
[string_to_regexp "Register cache flushed."]
93+
94+
# This output may occur when we run into the message while applying the
95+
# frame filters.
96+
set re_bt \
97+
[multi_line \
98+
$hs+$re_msg \
99+
$re_bt_line]
100+
gdb_test "bt" \
101+
"($re_bt|$re_bt_no_filters)" \
80102
"verify unwind fail without CFI"
81103
}
82104

0 commit comments

Comments
 (0)