aboutsummaryrefslogtreecommitdiff
path: root/gdb/testsuite/lib/gdb.exp
diff options
context:
space:
mode:
authorAndrew Burgess <aburgess@redhat.com>2024-05-18 10:50:23 +0100
committerAndrew Burgess <aburgess@redhat.com>2024-06-04 13:33:31 +0100
commit3e35b4deae28d3653226403452328c680ef7f5b2 (patch)
tree065ce3ee8b936c6316b0e0d9115c416b7ba22faa /gdb/testsuite/lib/gdb.exp
parent9543c37620c9483f77f0f728f32e6517987c7b4c (diff)
downloadbinutils-3e35b4deae28d3653226403452328c680ef7f5b2.zip
binutils-3e35b4deae28d3653226403452328c680ef7f5b2.tar.gz
binutils-3e35b4deae28d3653226403452328c680ef7f5b2.tar.bz2
gdb/testsuite: tests for debug lookup within the sysroot
Add tests for looking up debug information within the sysroot via both build-id and gnu_debuglink. I wanted to ensure that the gnu_debuglink test couldn't make use of build-ids, so I added the 'no-build-id' flag to gdb_compile. As these tests rely on setting the sysroot, if I'm running a dynamically linked executable, GDB will try to find all shared libraries within the sysroot. This would mean I'd have to figure out and copy all shared libraries the executable uses, certainly possible, but a bit of a pain. So instead, I've just compiled the test executable as a static binary. Now there are no shared library dependencies. I can now split the debug information out from the test binary, and place it within the sysroot. When GDB is started and the executable loaded, we can check that GDB is finding the debug information within the sysroot. Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31804 Approved-By: Tom de Vries <tdevries@suse.de>
Diffstat (limited to 'gdb/testsuite/lib/gdb.exp')
-rw-r--r--gdb/testsuite/lib/gdb.exp13
1 files changed, 13 insertions, 0 deletions
diff --git a/gdb/testsuite/lib/gdb.exp b/gdb/testsuite/lib/gdb.exp
index 0fab866..5aeaa8d 100644
--- a/gdb/testsuite/lib/gdb.exp
+++ b/gdb/testsuite/lib/gdb.exp
@@ -5238,6 +5238,7 @@ proc quote_for_host { args } {
# debug information
# - text_segment=addr: Tell the linker to place the text segment at ADDR.
# - build-id: Ensure the final binary includes a build-id.
+# - no-build-id: Ensure the final binary does not include a build-id.
# - column-info/no-column-info: Enable/Disable generation of column table
# information.
#
@@ -5349,6 +5350,18 @@ proc gdb_compile {source dest type options} {
lappend new_options "additional_flags=-Wl,--build-id"
}
+ # If the 'no-build-id' option is used then disable the build-id.
+ if {[lsearch -exact $options no-build-id] > 0} {
+ lappend new_options "additional_flags=-Wl,--build-id=none"
+ }
+
+ # Sanity check. If both 'build-id' and 'no-build-id' are used
+ # then what is expected from us!
+ if {[lsearch -exact $options build-id] > 0
+ && [lsearch -exact $options no-build-id] > 0} {
+ error "cannot use build-id and no-build-id options"
+ }
+
# Treating .c input files as C++ is deprecated in Clang, so
# explicitly force C++ language.
if { !$getting_compiler_info