[PATCH v3 1/2] gdb/testsuite: Add libc_has_debug_info require helper

Thiago Jung Bauermann thiago.bauermann@linaro.org
Fri Apr 26 03:00:33 GMT 2024


Hello Bernd,

Bernd Edlinger <bernd.edlinger@hotmail.de> writes:

> Hi Thiago,
>
> On 4/24/24 18:25, Thiago Jung Bauermann wrote:
>>>
>> Thank you! Pushed as commit f5ef12c3f1af.
>
> I think I have an issue with this commmit.
> I use a self-built riscv-unknown-elf toolchain with newlib,
> so there is no libc at all, regardless of debug info.
> since today, I see messages like:
> Running /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp ...
> FAIL: gdb.base/relativedebug.exp: info sharedlibrary libc.so
> ERROR: tcl error sourcing /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp.
> ERROR: tcl error code TCL READ VARNAME
> ERROR: can't read "libc_has_debug_info": no such variable
>     while executing
> "verbose "$me: returning $libc_has_debug_info" 2"
>     (procedure "gdb_real__libc_has_debug_info" line 47)
>     invoked from within
> "gdb_real__libc_has_debug_info"

<snip>

Sorry for the trouble. I should have simulated a situation where GDB
can't find libc.so in the inferior. I was able to reproduce the error
above when I did.

Could you please test the patch that I just sent?

> while previously that looked like:
>
> gdb compile failed, /home/ed/gnu/riscv64-unknown-elf/lib/gcc/riscv64-unknown-elf/14.0.1/../../../../riscv64-unknown-elf/bin/ld: /tmp/ccjr19GC.o: in function `main':
> /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:30:(.text+0x28): undefined reference to `alarm'
> /home/ed/gnu/riscv64-unknown-elf/lib/gcc/riscv64-unknown-elf/14.0.1/../../../../riscv64-unknown-elf/bin/ld:
> /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:31:(.text+0x30):
> undefined reference to `pause'
> /home/ed/gnu/riscv64-unknown-elf/lib/gcc/riscv64-unknown-elf/14.0.1/../../../../riscv64-unknown-elf/bin/ld:
> /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.c:31:(.text+0x38):
> undefined reference to `pause'
> collect2: error: ld returned 1 exit status
> UNTESTED: gdb.base/relativedebug.exp: failed to compile
>
> so not very noisy, newlib does apparently not have alarm, pause, sleep, and similar,
> but much easier to understand the output...

On the plus side, with this problem fixed gdb.base/relativedebug.exp
should exit early with:

(gdb) info sharedlibrary libc.so
No shared libraries matched.
(gdb) UNSUPPORTED: gdb.base/relativedebug.exp: require failed: libc_has_debug_info (libc not found in the inferior)

Which will be even easier to understand the output. :-)

-- 
Thiago


More information about the Gdb-patches mailing list