Skip to content

How to print panic backtraces? #1394

Discussion options

You must be logged in to vote

Seems like unwinding is overkill after all. If you just want to print backtraces, look at https://github.com/tsatke/devos/blob/935889f66944201bb70986bb753b96cac99ad66d/kernel/src/main.rs#L79 . Basically jump base-pointers until that's 0 and resolve the addresses to symbols (like @bjorn3 said). You'll need a mapping of your elf file in virtual memory, which limine conveniently provides.

This will give you something like

If you want filenames and line numbers, you'll have to dive into DWARF parsing. You could look at the addr2line crate together with gimli for that.

Replies: 2 comments 10 replies

Comment options

You must be logged in to vote
3 replies
@tsatke
Comment options

@ChocolateLoverRaj
Comment options

@bjorn3
Comment options

Comment options

You must be logged in to vote
7 replies
@ChocolateLoverRaj
Comment options

@tsatke
Comment options

@ChocolateLoverRaj
Comment options

@tsatke
Comment options

@ChocolateLoverRaj
Comment options

Answer selected by ChocolateLoverRaj
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
3 participants