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

Bernd Edlinger bernd.edlinger@hotmail.de
Thu Apr 25 19:39:14 GMT 2024


Hi Thiago,

On 4/24/24 18:25, Thiago Jung Bauermann wrote:
> 
> Hello Kevin,
> 
> Kevin Buettner <kevinb@redhat.com> writes:
> 
>> On Mon, 22 Apr 2024 20:06:59 -0300
>> Thiago Jung Bauermann <thiago.bauermann@linaro.org> wrote:
>>
>>> Factor the test for libc debug info out of gdb.base/relativedebug.exp to
>>> a new procedure.
>>>
>>> Also, change the "info sharedlibrary" test to explicitly detect when
>>> libc has debug info.
>>> ---
>>>
>>> As mentioned in the cover letter, the new testcase doesn't use this helper
>>> procedure anymore so this is an optional patch.  I think it's a nice
>>> cleanup, though I didn't find any other testcase that need it so perhaps
>>> the new helper is not as useful as I imagine it to be. I'm fine with not
>>> committing this patch.
>>>
>>> Changes in v3:
>>> - Include <stdio.h> in test program to avoid error when using clang
>>>   (suggested by Kevin).
>>
>> I agree that it's a nice cleanup and I think that it should go in.
>>
>> I've retested with CC_FOR_TARGET set to clang and also gcc.  It works
>> for both.
>>
>> Approved-by: Kevin Buettner <kevinb@redhat.com>
> 
> 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"
    ("uplevel" body line 1)
    invoked from within
"uplevel 2 [list $real_name {*}$args]"
    invoked from within
"gdb_do_cache_wrap $real_name {*}$args"
    (procedure "gdb_do_cache" line 48)
    invoked from within
"gdb_do_cache libc_has_debug_info"
    (procedure "libc_has_debug_info" line 1)
    invoked from within
"libc_has_debug_info"
    ("uplevel" body line 1)
    invoked from within
"uplevel 1 $fn"
    (procedure "require" line 11)
    invoked from within
"require {!target_info exists gdb,nosignals} libc_has_debug_info"
    (file "/home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp" line 16)
    invoked from within
"source /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp"
    ("uplevel" body line 1)
    invoked from within
"uplevel #0 source /home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp"
    invoked from within
"catch "uplevel #0 source $test_file_name" msg"
UNRESOLVED: gdb.base/relativedebug.exp: testcase '/home/ed/gnu/binutils-build-riscv64/gdb/testsuite/../../../binutils-gdb/gdb/testsuite/gdb.base/relativedebug.exp' aborted due to Tcl error
PATH: gdb.base/relativedebug.exp: testcase '/home/ed/gnu/

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...


Regards,
Bernd.



More information about the Gdb-patches mailing list