GDB not always able to show source.
Nicolas Noble <[email protected]>
| Newsgroups | gmane.comp.gdb.devel |
|---|---|
| Message-ID | <CAAkR8+toYk+3rXG_4LzYnS0TAw=+N9vaqJRrFdzhn0S4oFTmEQ@mail.gmail.com> |
Hello, I've been having a really strange issue lately. I'm cross compiling binaries targeting MIPS I, and sometimes, gdb can't display source information. The same binary will work with some versions of gdb, and not with others. I'm just confused at this point, and if anyone can enlighten me, I'd be really grateful. Here's a small rundown. I'll use this binary here: https://static.grumpycoder.net/pixel/test-gdb.elf First things first, the binary can be properly disassembled and show all of its source information using objdump: mipsel-linux-gnu-objdump --disassemble -S -l test-gdb.elf The output of the command above will display properly all of the file and line number information. Now, on my Ubuntu 24.04.1 LTS machine, using its gdb binary, I can also display line information properly: pixel@Jowy:~/Downloads$ gdb ./test-gdb.elf GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git Reading symbols from ./test-gdb.elf... (gdb) info line *0x800334b0 Line 44 of "src/application.cpp" starts at address 0x800334b0 <_ZN5psyqo11Application3runEv> and ends at 0x800334bc <_ZN5psyqo11Application3runEv+12>. But when using its gdb-multiarch binary, I can't: pixel@Jowy:~/Downloads$ gdb-multiarch ./test-gdb.elf GNU gdb (Ubuntu 15.0.50.20240403-0ubuntu1) 15.0.50.20240403-git Reading symbols from ./test-gdb.elf... (gdb) info line *0x800334b0 No line number information available for address 0x800334b0 <_ZN5psyqo11Application3runEv> Now, to eliminate a potential problem with the Ubuntu packages, I built gdb 16.2 myself, using the following flags, and I also am unable to see the line information for this address: configure --disable-gdbtk --disable-shared --disable-readline --with-system-readline --with-expat --with-system-zlib --without-guile --without-babeltrace --enable-tui --with-lzma --without-python --with-xxhash --enable-64-bit-bfd --enable-targets=all --disable-sim pixel@Jowy:~/sources/gdb-16.2/build/gdb$ ./gdb ~/Downloads/test-gdb.elf GNU gdb (GDB) 16.2 Reading symbols from /home/pixel/Downloads/test-gdb.elf... (gdb) info line *0x800334b0 No line number information available for address 0x800334b0 <_ZN5psyqo11Application3runEv> At this point, I'm confused as to why some versions of gdb (which aren't built in "multiarch" mode) will properly display the line information, and why some others (which are built in "multiarch" mode) will not. Anyone has any clue about what am I missing? Did I stumble upon a gdb bug? Thanks, -- Nicolas Noble