Re: [PATCH 1/6] gdb/testsuite/dwarf: use single abbrev table in .dwo files

Simon Marchi
2025-11-18T17:21:07Z

On 11/18/25 11:55 AM, Andrew Burgess wrote:
>> -# Build main file.
>> -if { [build_executable "${testfile}.exp" $binfile \
>> - [list ${srcfile} ${main_asm_file}] {nodebug}] } {
>> - return
>> -}
>> -
>> -# Build DWO file.
>> -set dwo_file [standard_output_file ${testfile}.dwo]
>> -if { [gdb_compile_shlib $dwo_asm_file $dwo_file nodebug] != "" } {
>> +set obj [standard_output_file "${testfile}-dw.o"]
>> +set dwo_file [standard_output_file "${testfile}.dwo"]
>
> The name of the dwo file here is now wrong. The auto generated name
> will be '${testfile}-dw.dwo', which is what you embed in the DWARF
> above.

Oh, indeed.

> I was wondering why this wasn't causing problems for the later block in
> this file (not touched in this patch):
>
> if { [is_remote host] } {
> gdb_remote_download host $dwo_file
> }
>
> But it turns out that ...
>
>> +if {[build_executable_and_dwo_files "$testfile.exp" "${binfile}" {} \
>
> ... build_executable_and_dwo_files includes this check:
>
> # Must be run on local host due to use of objcopy.
> if {[is_remote host]} {
> return -1
> }

I don't understand why that wouldn't be possible if debugging on a
remote host. Here, we are building target objects, we have a toolchain
for the target, so we should have an objcopy for the target that we can
run. It should be possible, in theory. Am I missing something?

>
> So this test never gets past this point for remote host boards.
>
> I think you should:
>
> 1. Remove the 'set dwo_file ...' line.
>
> 2. Remove the 'gdb_remote_download host $dwo_file' line, and its
> containing 'if' block.
>
> 3. Add a 'require {!is_remote host}' line at the start of the file.

Since build_executable_and_dwo_files returns -1 if the host is remote,
causing the test to exit early an cleanly (although we could perhaps add
an untested call somewhere), do we really need the require at the top?
If we ever lift the remote host limitation of
build_executable_and_dwo_files, then we'll want the test to run.

Simon