diff --git a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
index 32ddaf4a..5b47c84c 100644
--- a/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
+++ b/gdb/testsuite/gdb.dwarf2/dw2-undefined-ret-addr.exp
@@ -30,6 +30,11 @@ if {![runto "stop_frame"]} {
     return -1
 }
 
+# If test is compiled with clang, GDB would display absolute path
+# This command keeps output consistent across toolchains.
+
+gdb_test_no_output "set filename-display basename"
+
 # stop_frame should be the outermost frame.
 
 # Check that backtrace shows only frame #0.
diff --git a/gdb/testsuite/gdb.dwarf2/fission-base.exp b/gdb/testsuite/gdb.dwarf2/fission-base.exp
index 035fe731..a73cab48 100644
--- a/gdb/testsuite/gdb.dwarf2/fission-base.exp
+++ b/gdb/testsuite/gdb.dwarf2/fission-base.exp
@@ -46,6 +46,11 @@ if {![runto_main]} {
 gdb_test "ptype main" "type = int \\(\\)"
 gdb_test "ptype func" "type = int \\(int\\)"
 
+# If test is compiled with clang, GDB would display absolute path
+# This command keeps output consistent across toolchains.
+
+gdb_test_no_output "set filename-display basename"
+
 gdb_test "frame" "#0 *main \\(\\) at $testfile\\.c:$decimal.*" \
     "frame in main"
 
