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

stack backtrace #105

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

stack backtrace #105

wants to merge 2 commits into from

Conversation

Godones
Copy link

@Godones Godones commented Feb 9, 2023

  1. Update the stack backtrace method
  2. Turn off the -C force-frame-pointers flag, which may cause unnecessary overhead.
  3. The new method should be able to run normally on the alloc-enabled branch

A simple test looks like this:

[kernel] Panicked at src/mm/page_table.rs:178 translated_str: not implemented
---START BACKTRACE---
0x80010a64 (+638) backtrace
0x80010914 (+188) rust_begin_unwind
0x80021624 (+44) core::panicking::panic_fmt
0x8000fb1c (+364) os::mm::page_table::translated_str
0x800072ee (+44) os::syscall::process::sys_exec
0x800067f4 (+456) trap_handler
---END   BACKTRACE---

Use riscv's code generation rules for stack backtraces.
1. Compile the source code in the first pass to generate an executable file, and use the nm tool to extract symbol information
2. The second pass compiles the source code to link the symbolic information into the executable file.
Points to note:
1. backtrace needs to support alloc
2. If the kernel panics before alloc initialization, it will cause an error
@chyyuu
Copy link
Member

chyyuu commented Feb 15, 2023

Very Good! @Godones

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.

None yet

2 participants