Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[debug] Rewrite stack tracing code, add disasm to distribution #1843

Merged
merged 2 commits into from
Apr 4, 2024
Merged

Conversation

ghaerr
Copy link
Owner

@ghaerr ghaerr commented Apr 4, 2024

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:
Screen Shot 2024-04-02 at 5 48 15 PM

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, run disasm -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:
disasm

@ghaerr ghaerr merged commit 96ed606 into master Apr 4, 2024
2 checks passed
@ghaerr ghaerr deleted the debug branch April 4, 2024 22:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant