]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commitdiff
[gdb/testsuite] Restructure gdb.base/backtrace-through-cu-nodebug.exp
authorTom de Vries <tdevries@suse.de>
Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)
committerTom de Vries <tdevries@suse.de>
Sat, 19 Jul 2025 15:08:44 +0000 (17:08 +0200)
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 <keiths@redhat.com>
gdb/testsuite/gdb.base/backtrace-through-cu-nodebug.exp

index 36a9d10a9ebc25e1324dd7901c538505ceaec908..fce6d679b898ae249cac86fcd8d3d3458091d8b6 100644 (file)
@@ -31,7 +31,7 @@ proc prepare_test {has_cfi} {
             "${objcallerfile}" \
             object [list {additional_flags=-fomit-frame-pointer \
                 -funwind-tables -fasynchronous-unwind-tables}]] != "" } {
-           untested "couldn't compile with cfi"
+           untested "couldn't compile"
            return false
       }
     } else {
@@ -41,7 +41,7 @@ proc prepare_test {has_cfi} {
             object [list {additional_flags=-fomit-frame-pointer \
                 -fno-unwind-tables \
                 -fno-asynchronous-unwind-tables}]] != "" } {
-           untested "couldn't compile without cfi"
+           untested "couldn't compile"
            return false
       }
     }
@@ -54,15 +54,12 @@ proc prepare_test {has_cfi} {
 
     clean_restart "$binfile-${extension}"
 
-    with_test_prefix "${extension}" {
-
-       if ![runto callback] then {
-          fail "has_cfi=$has_cfi: Can't run to callback"
-          return false
-       }
-       gdb_test_no_output "maint frame-unwinder disable ARCH"
-       return true
+    if ![runto callback] then {
+       fail "has_cfi=$has_cfi: Can't run to callback"
+       return false
     }
+    gdb_test_no_output "maint frame-unwinder disable ARCH"
+    return true
 }
 
 if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
@@ -72,7 +69,11 @@ if {[gdb_compile "${srcdir}/${subdir}/${srcfile2}" \
     return
 }
 
-if { [prepare_test false] } {
+proc_with_prefix no-cfi {} {
+    if { ![prepare_test false] } {
+       return
+    }
+
     set re_msg \
        [string_list_to_regexp \
             "Required frame unwinder may have been disabled," \
@@ -85,7 +86,7 @@ if { [prepare_test false] } {
             $re_msg]
     gdb_test "bt -no-filters" \
        $re_bt_no_filters \
-       "verify no-filters unwind fail without CFI"
+       "verify no-filters unwind fail"
 
     # Flush frame cache to retrigger the message.
     gdb_test "maint flush register-cache" \
@@ -99,10 +100,14 @@ if { [prepare_test false] } {
             $re_bt_line]
     gdb_test "bt" \
        "($re_bt|$re_bt_no_filters)" \
-       "verify unwind fail without CFI"
+       "verify unwind fail"
 }
 
-if { [prepare_test true] } {
+proc_with_prefix cfi {} {
+    if { ![prepare_test true] } {
+       return
+    }
+
     if { [istarget "arm*-*-*"] } {
        setup_kfail backtrace/31950 *-*-*
     }
@@ -111,6 +116,12 @@ if { [prepare_test true] } {
     # #1  0x00000000004004e9 in caller ()
     # #2  0x00000000004004cd in main () at ...
     gdb_test "bt" \
-       "#0 +callback $text\r\n#1 $text in caller $text\r\n#2 $text in main $text" \
-       "Verify unwinding works based only on CFI information"
+       [multi_line \
+            "#0 +callback $text" \
+            "#1 $text in caller $text" \
+            "#2 $text in main $text"] \
+       "Verify unwinding works"
 }
+
+no-cfi
+cfi