Index: gdb/testsuite/gdb.reverse/solib-precsave.exp |
diff --git a/gdb/testsuite/gdb.reverse/solib-precsave.exp b/gdb/testsuite/gdb.reverse/solib-precsave.exp |
index 4082672fb9e48fc07e2f371bcae91a98be62861e..85384c374fe43bcedc279cc050c94b4747ff2b3f 100644 |
--- a/gdb/testsuite/gdb.reverse/solib-precsave.exp |
+++ b/gdb/testsuite/gdb.reverse/solib-precsave.exp |
@@ -21,14 +21,13 @@ if ![supports_process_record] { |
return |
} |
-set testfile "solib-reverse" |
-set srcfile ${testfile}.c |
+standard_testfile solib-reverse.c |
+set precsave [standard_output_file solib.precsave] |
set libfile "shr2" |
set libsrc ${libfile}.c |
-set library ${objdir}/${subdir}/${libfile}.sl |
-set binfile ${objdir}/${subdir}/${testfile} |
+set library [standard_output_file ${libfile}.sl] |
-if [get_compiler_info ${binfile}] { |
+if [get_compiler_info] { |
return -1 |
} |
@@ -39,7 +38,13 @@ if { [gdb_compile_shlib ${srcdir}/${subdir}/${libsrc} ${library} "debug"] != "" |
set exec_opts [list debug shlib=${library}] |
-if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { |
+# Attempt to prevent -Wl,-z,relro which may happen by default with some |
+# toolchain configurations. Due to PR corefiles/11804 GDB will then produce |
+# invalid core file. |
+ |
+if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable \ |
+ [concat $exec_opts additional_flags=-Wl,-z,norelro]] != "" |
+ && [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opts] != "" } { |
untested "Could not compile $binfile." |
return -1 |
} |
@@ -48,6 +53,10 @@ if { [gdb_compile ${srcdir}/${subdir}/${srcfile} ${binfile} executable $exec_opt |
gdb_exit |
gdb_start |
+ |
+# Clear it to never find any separate system debug infos. |
+gdb_test_no_output "set debug-file-directory" |
+ |
gdb_reinitialize_dir $srcdir/$subdir |
gdb_load ${binfile} |
@@ -66,14 +75,14 @@ gdb_test "break $end_of_main" \ |
gdb_test "continue" "Breakpoint .* end of main .*" "run to end of main" |
-gdb_test "record save solib.precsave" \ |
- "Saved core file solib.precsave with execution log\." \ |
+gdb_test "record save $precsave" \ |
+ "Saved core file $precsave with execution log\." \ |
"save process recfile" |
gdb_test "kill" "" "Kill process, prepare to debug log file" \ |
"Kill the program being debugged\\? \\(y or n\\) " "y" |
-gdb_test "record restore solib.precsave" \ |
+gdb_test "record restore $precsave" \ |
"Program terminated with signal .*" \ |
"reload core file" |