The Address Where Filename Has Been Loaded Is Missing [Gdb]

The address where filename has been loaded is missing [GDB]


objcopy --only-keep-debug a.out a.out.sym

If you want GDB to load the a.out.sym automatically, follow the steps outlined here (note in particular that you need to do the "add .gnu_debuglink" step).

This address is representing WHAT

The address GDB wants is the location of .text section of the binary. To find it, use readelf -WS a.out. E.g.

$ readelf -WS /bin/date
There are 28 section headers, starting at offset 0xe350:

Section Headers:
[Nr] Name Type Address Off Size ES Flg Lk Inf Al
[ 0] NULL 0000000000000000 000000 000000 00 0 0 0
[ 1] .interp PROGBITS 0000000000400238 000238 00001c 00 A 0 0 1
...
[13] .text PROGBITS 0000000000401900 001900 0077f8 00 AX 0 0 16

Here, you want to give GDB 0x401900 as the load address.

add-symbol-file for MCU app with offset on flash not showing any function names


Am I misunderstanding the offset?

Likely. The offset should be the address of .text at runtime, which 90000 == 0x15f90 isn't.

Use readelf -WS Debug/iobox-imx-rt-1020.axf | grep .text to find out where .text starts (probably some low value in a PIE binary), and (assuming your loader maps the file at 0x600b0000) use 0x600b0000 + $text_start in the add-symbol-file command.

GDB symbols work for break and print, but list fails with No debugging symbols found


I have a .elf file with debugging symbols. I can verify this by doing objdump, and seeing a disassembly with the subroutine labels being present.

Debugging symbols are not the same as symbols. For disassembly, you only need the latter. For source listing you need the former.

I can still do things like break main or p/x global_cntr!

These also require only the symbol table.

You can confirm that you don't have debug symbols using objdump -g progmem.elf or readelf -wi progmem.elf.

Your command lines look like debug symbols should be included, but there is no telling what you do with .debug_* sections in your sections.lds linker script. Probably you discard them, which would explain why they aren't there.

Update:

Do you by any chance has an example sections.lds file that has them included?

ld --verbose should print the default linker script. Here is one example.

GDB - map address to line and column in source code

Answering my guestion, I found one way to get the information using lldb and image lookup command:

(lldb) image lookup --address 0x134adc
Address: libaaa.so[0x0000000000134adc] (libaaa.so.PT_LOAD[0]..text + 1030908)
Summary: libaaa.so`test() + 272 at test.cpp:1842:124

GDB's No symbol table is loaded when trying to strace

The strace you are looking for is a command-line tool, not a GDB command. Exit GDB to run it.



Related Topics



Leave a reply



Submit