How to print panic backtraces? #1394
Replies: 1 comment 3 replies
-
To get a backtrace, you can either compile with frame pointers enabled (
Yes. Basically you did have to parse the entire kernel image as ELF file, look up it's symbol table and then for each address you got from the previous step to get a backtrace you have to find the symbol with the highest address lower than or equal to this address in the backtrace. The name of the symbol should then match the name of the function that corresponds to the stack frame. If your kernel can be relocated (PIC/PIE) then you will have to add the actual offset by which the kernel is relocated to the addresses you get from the symbol table. |
Beta Was this translation helpful? Give feedback.
-
Idk how panic backtraces work, but it seems like part of printing a nice looking backtrace is resolving symbols. I can do that because I have a user space program in an
elf
and I can parse the elf to look up symbols with https://github.com/cole14/rust-elf/. What would be the steps to actually printing a nice error message on panic?Also would this be possible in the kernel itself by parsing the elf of the kernel itself inside the kernel's code?
Beta Was this translation helpful? Give feedback.
All reactions