'add-symbol-file for MCU app with offset on flash not showing any function names
I have an app running on a imx-rt-1024 nxp chip. I have a bootloader and the actual firmware app. My bootloader sits at 0x60000000 and my firmware app typically sits at 0x60020000.
But the app is compiled with -fPIC (position independent code) so I can also flash it to any offset location in flash. It's also deployed on 0x600b0000.
I can connect my JLink debugger to the application when it's running in the offset application, but, it will not break on any breakpoints because it doesn't know how to map the symbols (since the elf file will have all addresses mapped to compile time addresses: 0x60020000).
After reading a bit, I should be able to load the symbols of my elf file with an offset like so:
gdb> add-symbol-file Debug/iobox-imx-rt-1020.axf 90000
My elf file is `iobox-imx-rt-1020.axf', and the offset between 0x60020000 and 0x600b0000 is 0x90000.
gdb claims to have loaded the symbols, but afterwards I still can't break or see any symbols / function names.
remove-symbol-file Debug/iobox-imx-rt-1020.axf
No symbol file found
add-symbol-file Debug/iobox-imx-rt-1020.axf 90000
add symbol table from file "Debug/iobox-imx-rt-1020.axf" at
.text_addr = 0x15f90
(y or n) [answered Y; input not from terminal]
Reading symbols from Debug/iobox-imx-rt-1020.axf...
What am I doing wrong? Am I misunderstanding the offset? Should it be something different than 90000?
Solution 1:[1]
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.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Employed Russian |

