]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
[gdb/testsuite] Use -nostdlib in gdb.base/list-dot-nodebug.exp
authorTom de Vries <tdevries@suse.de>
Thu, 6 Feb 2025 14:57:08 +0000 (15:57 +0100)
committerTom de Vries <tdevries@suse.de>
Thu, 6 Feb 2025 14:57:08 +0000 (15:57 +0100)
commit9a7ed136a9b405408ab20e01f2cab415e7a39b5b
tree5d5afaaedaaf85678186d6ec712c3f7d390d5dc3
parentad8677bc8995af992f39d5cce39a818354d26ef7
[gdb/testsuite] Use -nostdlib in gdb.base/list-dot-nodebug.exp

When running test-case gdb.base/list-dot-nodebug.exp with target board
cc-with-gnu-debuglink, I run into:
...
(gdb) list .^M
warning: 1      ../sysdeps/x86_64/crtn.S: No such file or directory^M
(gdb) FAIL: gdb.base/list-dot-nodebug.exp: debug=none: print before start
...

The problem is that the call to gdb_gnu_strip_debug in
gdb.base/list-dot-nodebug.exp has no effect, because the target board makes
sure that compilation delivers an executable that is already stripped, with a
.gnu_debuglink section linking to the debug info.

Fix this by using -nostdlib instead of static, which means the call to
gdb_gnu_strip_debug can be removed.

This also allows us to extend the test-case to excercise "list ." before
starting the inferior, for the debug=some scenario, which is currently
skipped:
...
# We don't test "list ." before starting with some debug info
# because GDB will choose the symtab that has debuginfo, and
# print the copyright blurb.  This test isn't interested (yet?)
# in checking if this default location choice is consistent.
...

While we're at it, make the effect of "list ." on the current source location
explicit using "info source" before and after "list .".

While we're at it, make sure when running with target board
cc-with-gdb-index or cc-with-debug-names, that the failure to compile the
debug=none variant due to:
...
Error while writing index ...: No debugging symbols
...
doesn't stop the test-case from running the debug=some variant.

Tested on x86_64-linux.

Reviewed-By: Guinevere Larsen <guinevere@redhat.com>
gdb/testsuite/gdb.base/list-dot-nodebug.c
gdb/testsuite/gdb.base/list-dot-nodebug.exp