aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/gdb.base/gnu-debugdata.exp
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/testsuite/gdb.base/gnu-debugdata.exp')
-rw-r--r--gdb/testsuite/gdb.base/gnu-debugdata.exp22
1 files changed, 19 insertions, 3 deletions
diff --git a/gdb/testsuite/gdb.base/gnu-debugdata.exp b/gdb/testsuite/gdb.base/gnu-debugdata.exp
index f34e4e8..55aa3c6 100644
--- a/gdb/testsuite/gdb.base/gnu-debugdata.exp
+++ b/gdb/testsuite/gdb.base/gnu-debugdata.exp
@@ -127,14 +127,30 @@ if {[run "strip" [transform strip] \
return -1
}
+# Separate full debug info into ${binfile}.debug.
+remote_file host delete ${binfile}.debug
+if {[run "copydebug" [transform objcopy] \
+ "--only-keep-debug ${binfile} ${binfile}.debug"]} {
+ return -1
+}
+
+# Add the .gnu_debuglink section to the .gnu_debugdata file.
+# .gnu_debuglink is normally not present in the .gnu_debugdata section but in
+# some files there may be PT_NOTE with NT_GNU_BUILD_ID and GDB could look up
+# the .debug file from it.
+if {[run "addlink" [transform objcopy] \
+ "--add-gnu-debuglink=${binfile}.debug ${binfile}.mini_debuginfo ${binfile}.mini_debuginfo-debuglink"]} {
+ return -1
+}
+
# Inject the compressed data into the .gnu_debugdata section of the
# original binary.
-remote_file host delete ${binfile}.mini_debuginfo.xz
-if {[run "xz" "xz" "${binfile}.mini_debuginfo"]} {
+remote_file host delete ${binfile}.mini_debuginfo-debuglink.xz
+if {[run "xz" "xz" "-k ${binfile}.mini_debuginfo-debuglink"]} {
return -1
}
remote_file host delete ${binfile}.test
-if {[run "objcopy 2" [transform objcopy] "--add-section .gnu_debugdata=${binfile}.mini_debuginfo.xz ${binfile}.strip ${binfile}.test"]} {
+if {[run "objcopy 2" [transform objcopy] "--add-section .gnu_debugdata=${binfile}.mini_debuginfo-debuglink.xz ${binfile}.strip ${binfile}.test"]} {
return -1
}