Warning when using separate debug info file

Tom Tromey tom@tromey.com
Thu Apr 25 13:46:00 GMT 2019


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

Eli> So you are saying that if you create a separate debug info file with
Eli> .gnu_debuglink on GNU/Linux, then GDB will display the same warning
Eli> when debugging the stripped binary?  I think someone said this didn't
Eli> happen on GNU/Linux.

I tried and it doesn't give a warning.

I did this with a simple test program:

    gcc -g -o q q.c -Wl,--build-id=none
    objcopy --only-keep-debug q q.debug
    strip -g q
    objcopy --add-gnu-debuglink=q.debug q

Then in gdb:

    (gdb) file ./q
    Reading symbols from ./q...Reading symbols from /tmp/q.debug...done.
    done.

>> So I suppose this is just a bug but the cause remains unknown.

Eli> The place where this happens, addr_info_make_relative, maps addresses
Eli> to BFD addresses, and I wonder why .gnu_debuglink appears in the array
Eli> of sections the GDB looks up in the separate debug file.  Any ideas
Eli> why this happens?

Try looking at the section headers:

    $ objdump -h -j .gnu_debuglink q

    q:     file format elf64-x86-64

    Sections:
    Idx Name          Size      VMA               LMA               File off  Algn
     25 .gnu_debuglink 0000000c  0000000000000000  0000000000000000  000013cc  2**2
                      CONTENTS, READONLY

I don't recall which but probably the section is either loadable or
allocatable in your situation.

Tom



More information about the Gdb-patches mailing list