Generate core dump from crashed pods
- Dominant language
- Python
- Stars
- 14
- Forks
- 7
- PR merge metrics
- No merged PRs in 30d
Description
### Background
We should be able to save a core dump of a halted POD so that we can continue debugging when the device is no longer attached to the debugger.
### Goal
Be able to run a dump tool like so...
`iotile hw --port jlink connect_direct device=nrf52 debug dump_core `
Where you can then do
`arm-none-eabi-gdb --core `
And then debug from there.
### Implementation
A core dump file is pretty much an `.elf` file of the program with certain sections modified with memory contents of the device at the time of crash.
A more in depth analysis can be read [here](https://www.gabriel.urdhr.fr/2015/05/29/core-file/).
The following implementation steps will be referencing to [this article](https://en.wikipedia.org/wiki/Executable_and_Linkable_Format).
- Use an existing compiled `.elf` file of a controller and modify its properties
- The `e_type` of the `ELF header` should be set to `0x04` to indicate that the `.elf` file is a core file
- ELF files are not expected to have section headers
- `SHT_NOBITS` are not present in core files
- `SHT_PROGBITS` section are present in core file
- `SHT_NOTE` section header mapd to the `PT_NOTE` program header... this is important, this will point us to the saved register information that the core file will use
- Use the `jlink` adapter's `flash_forensic` tool to `dump_memory` of the device's register information
- Fill the `PT_NOTE` section and format it accordingly with dumped register information
Contributor guide
Assessment
This issue has not been assessed yet.