[debug] Rewrite stack tracing code, add disasm to distribution #1843
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The elkscmd/debug stack tracing code, used for future debugging of ELKS executables with symbol table support, has been enhanced and rewritten to display decent output without a symbol table present, when needed. In the future, the ELKS kernel will be enhanced to support stack and function tracing. The new code does some fancy inspection of C function prologues to determine a function start address without a symbol table.
Here's a screenshot showing the elkscmd/debug/testsym.c program performing a stack backtrace on itself:

In addition, the
disasm
8086 symbolic disassembler has been added to the distribution, which also uses the updated symbol table routines.disasm
can be used to disassemble any ELKS binary as well as disassemble the kernel itself in memory while running, using a current kernel symbol table, which is now copied to /lib/system.sym (for 2880k floppies and hard drive images only for the moment). To use this feature, rundisasm -k {kernel_text_segment}
. The kernel's text segment is shown at boot.Here's

disasm -k 2d0:0
of the running kernel's startup code at_start
: