Skip to content

Commit 2f108d5

Browse files
committed
[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp
I noticed that the test names in test-case gdb.base/backtrace-through-cu-nodebug.exp are a bit inconsistent: ... PASS: $exp: no-cfi: maint frame-unwinder disable ARCH PASS: $exp: verify no-filters unwind fail without CFI PASS: $exp: maint flush register-cache PASS: $exp: verify unwind fail without CFI PASS: $exp: cfi: maint frame-unwinder disable ARCH PASS: $exp: Verify unwinding works based only on CFI information ... There's both a no-cfi prefix, and "without CFI". Fix this by using proc_with_prefix, getting us a consistent prefix: ... PASS: $exp: no-cfi: maint frame-unwinder disable ARCH PASS: $exp: no-cfi: verify no-filters unwind fail PASS: $exp: no-cfi: maint flush register-cache PASS: $exp: no-cfi: verify unwind fail PASS: $exp: cfi: maint frame-unwinder disable ARCH PASS: $exp: cfi: Verify unwinding works ... While we're at it, use multi_line to make a regexp more readable. Tested on aarch64-linux. Reviewed-By: Keith Seitz <[email protected]>
1 parent 6ca57d1 commit 2f108d5

File tree

1 file changed

+27
-16
lines changed

1 file changed

+27
-16
lines changed

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

Lines changed: 27 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ proc prepare_test {has_cfi} {
3131
"${objcallerfile}" \
3232
object [list {additional_flags=-fomit-frame-pointer \
3333
-funwind-tables -fasynchronous-unwind-tables}]] != "" } {
34-
untested "couldn't compile with cfi"
34+
untested "couldn't compile"
3535
return false
3636
}
3737
} else {
@@ -41,7 +41,7 @@ proc prepare_test {has_cfi} {
4141
object [list {additional_flags=-fomit-frame-pointer \
4242
-fno-unwind-tables \
4343
-fno-asynchronous-unwind-tables}]] != "" } {
44-
untested "couldn't compile without cfi"
44+
untested "couldn't compile"
4545
return false
4646
}
4747
}
@@ -54,15 +54,12 @@ proc prepare_test {has_cfi} {
5454

5555
clean_restart "$binfile-${extension}"
5656

57-
with_test_prefix "${extension}" {
58-
59-
if ![runto callback] then {
60-
fail "has_cfi=$has_cfi: Can't run to callback"
61-
return false
62-
}
63-
gdb_test_no_output "maint frame-unwinder disable ARCH"
64-
return true
57+
if ![runto callback] then {
58+
fail "has_cfi=$has_cfi: Can't run to callback"
59+
return false
6560
}
61+
gdb_test_no_output "maint frame-unwinder disable ARCH"
62+
return true
6663
}
6764

6865
if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
@@ -72,7 +69,11 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
7269
return
7370
}
7471

75-
if { [prepare_test false] } {
72+
proc_with_prefix no-cfi {} {
73+
if { ![prepare_test false] } {
74+
return
75+
}
76+
7677
set re_msg \
7778
[string_list_to_regexp \
7879
"Required frame unwinder may have been disabled," \
@@ -85,7 +86,7 @@ if { [prepare_test false] } {
8586
$re_msg]
8687
gdb_test "bt -no-filters" \
8788
$re_bt_no_filters \
88-
"verify no-filters unwind fail without CFI"
89+
"verify no-filters unwind fail"
8990

9091
# Flush frame cache to retrigger the message.
9192
gdb_test "maint flush register-cache" \
@@ -99,10 +100,14 @@ if { [prepare_test false] } {
99100
$re_bt_line]
100101
gdb_test "bt" \
101102
"($re_bt|$re_bt_no_filters)" \
102-
"verify unwind fail without CFI"
103+
"verify unwind fail"
103104
}
104105

105-
if { [prepare_test true] } {
106+
proc_with_prefix cfi {} {
107+
if { ![prepare_test true] } {
108+
return
109+
}
110+
106111
if { [istarget "arm*-*-*"] } {
107112
setup_kfail backtrace/31950 *-*-*
108113
}
@@ -111,6 +116,12 @@ if { [prepare_test true] } {
111116
# #1 0x00000000004004e9 in caller ()
112117
# #2 0x00000000004004cd in main () at ...
113118
gdb_test "bt" \
114-
"#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \
115-
"Verify unwinding works based only on CFI information"
119+
[multi_line \
120+
"#0 +callback $text" \
121+
"#1 $text in caller $text" \
122+
"#2 $text in main $text"] \
123+
"Verify unwinding works"
116124
}
125+
126+
no-cfi
127+
cfi

0 commit comments

Comments
 (0)