summaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.btrace/tailcall.exp
diff options
context:
space:
mode:
authorGuinevere Larsen <blarsen@redhat.com>2023-12-14 10:52:29 +0100
committerGuinevere Larsen <blarsen@redhat.com>2024-01-22 11:42:27 +0100
commit06ceae57ed4031e8a11ad7556684e1ac83477d73 (patch)
treeddc08c02e838c73aa0c19b028c88e7f09e22790e /gdb/testsuite/gdb.btrace/tailcall.exp
parentb9bdebba83fafa4ad4a2328d00880410acd922aa (diff)
gdb/testsuite: relax filename restriction in some gdb.btrace tests
The test gdb.btrace/tailcall.exp has multiple tests that include the filename in the output. When testing with gcc, only a relative path is printed, but when using clang, the full file path is printed instead. This makes most of those tests fail, with the exception of "record goto 4" which allows for more characters before the file name. The test gdb.btrace/recod_goto.exp suffers with the same issue This commit allows for text before the filename. However, instead of how the aforementioned "record goto 4", it uses a regexp that doesn't allow for newlines, just in case some off output happens. Approved-By: Tom Tromey <tom@tromey.com>
Diffstat (limited to 'gdb/testsuite/gdb.btrace/tailcall.exp')
-rw-r--r--gdb/testsuite/gdb.btrace/tailcall.exp37
1 files changed, 21 insertions, 16 deletions
diff --git a/gdb/testsuite/gdb.btrace/tailcall.exp b/gdb/testsuite/gdb.btrace/tailcall.exp
index 6d8594f43de..198cfa988dd 100644
--- a/gdb/testsuite/gdb.btrace/tailcall.exp
+++ b/gdb/testsuite/gdb.btrace/tailcall.exp
@@ -49,6 +49,11 @@ if ![runto_main] {
return -1
}
+# When GDB prints the file for a stop location, it may print the full path
+# depending on what information the compiler added. This regexp allows for
+# that path to be present, but does not require it.
+set optional_filepath {[^\n]*}
+
# we want to see the full trace for this test
gdb_test_no_output "set record function-call-history-size 0"
@@ -73,39 +78,39 @@ gdb_test "record function-call-history /c 1" [multi_line \
] "indented"
# go into bar
-gdb_test "record goto 4" ".*bar \\(\\) at .*tailcall.c:24\r\n.*"
+gdb_test "record goto 4" ".*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*"
# check the backtrace
gdb_test "backtrace" [multi_line \
- "#0.*bar \\(\\) at tailcall.c:24" \
- "#1.*foo \\(\\) at tailcall.c:29" \
- "#2.*main \\(\\) at tailcall.c:37" \
+ "#0.*bar \\(\\) at ${optional_filepath}tailcall.c:24" \
+ "#1.*foo \\(\\) at ${optional_filepath}tailcall.c:29" \
+ "#2.*main \\(\\) at ${optional_filepath}tailcall.c:37" \
"Backtrace stopped: not enough registers or memory available to unwind further" \
]
# walk the backtrace
-gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "up to foo"
-gdb_test "up" "#2\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" "up to main"
-gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" "down to foo"
+gdb_test "up" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "up to foo"
+gdb_test "up" "#2\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" "up to main"
+gdb_test "down" "#1\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" "down to foo"
# test stepping into and out of tailcalls.
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
"finish.1"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \
"reverse-step.1"
-gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
+gdb_test "reverse-finish" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \
"reverse-finish.1"
-gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \
"reverse-step.2"
gdb_test "next" "\[^\r\n\]*38.*" \
"next.1"
-gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at tailcall.c:37\r\n.*" \
+gdb_test "reverse-next" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:37\r\n.*" \
"reverse-next.1"
-gdb_test "step" "\[^\r\n\]*foo \\(\\) at tailcall.c:29\r\n.*" \
+gdb_test "step" "\[^\r\n\]*foo \\(\\) at ${optional_filepath}tailcall.c:29\r\n.*" \
"step.1"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
"finish.2"
-gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at tailcall.c:24\r\n.*" \
+gdb_test "reverse-step" "\[^\r\n\]*bar \\(\\) at ${optional_filepath}tailcall.c:24\r\n.*" \
"reverse-step.3"
-gdb_test "finish" "\[^\r\n\]*main \\(\\) at tailcall.c:38\r\n.*" \
+gdb_test "finish" "\[^\r\n\]*main \\(\\) at ${optional_filepath}tailcall.c:38\r\n.*" \
"finish.3"