Forums » Using the ECS »
Possible to recreate .elf file with dwarf info for debugging purpose?
Added by Runar Tenfjord about 2 years ago
Hi,
I was wondering if there is any possibility to merge the .dbg file with
the raw binary created for debugging purposes?
Currently I just run this:
objcopy.exe --input-target=binary --output-target=elf32-little test.rom test.elf
in order to create a .elf file for gdb.
The dbgdwarf command creates dwarf information which might be
merged with the .elf file (or perhaps loaded into gdb as a separate step)?
I tried to search for a solution, but could not find any. Likely due to the
common terms "elf" and "dwarf" which trigger a lot of false searches or
google has degraded in quality.
Best regards
Replies (5)
RE: Possible to recreate .elf file with dwarf info for debugging purpose? - Added by Florian Negele about 2 years ago
Sorry, but DWARF debugging information is only available when linking against a runtime that directly generates ELF files at the moment. Maybe it is possible the other way round: Use objcopy to extract the binary from a generated ELF file that contains debugging information?
RE: Possible to recreate .elf file with dwarf info for debugging purpose? - Added by Runar Tenfjord about 2 years ago
Excellent.
I will try this and creating a runtime
from the code in armt32linuxrun.asm
to create the .elf file with debug information.
The target is an MCU (STM32) and it should be
possible to write to flash memory from the .elf file.
If that does not work I can just create the .rom file separately
and flash that separately as I do now.
RE: Possible to recreate .elf file with dwarf info for debugging purpose? - Added by Runar Tenfjord about 1 month ago
I failed to create a .elf file, but after some investigation I found GDB has support for Python extension.
- A command
maploadwhich read and parse.mapfiles to extract symbols. - A command
mapinfowith autocomplete which prints information about symbols. - Install a stop handler which searches for the procedure and prints this if found.
The script is found here : https://github.com/tenko/ECSMicroLib/blob/main/tools/gdb.py
For embedded development this is very useful and also opens up possibility for further
automation of the debug process.
RE: Possible to recreate .elf file with dwarf info for debugging purpose? - Added by Florian Negele about 1 month ago
This is now natively supported by a new tool that converts map files back into object files which can then be linked again together with the debugging information to generate a separate symbol file, see New development version available. For more information see sections Remote Debugging and Debugging Programs in the manual. Thank you for your valuable investigation and patience.
RE: Possible to recreate .elf file with dwarf info for debugging purpose? - Added by Runar Tenfjord about 1 month ago
Excellent news!
I will have a try again to get this to work.