rcore-os / rCore-Tutorial-v3

Let's write an OS which can run on RISC-V in Rust from scratch!
https://rcore-os.github.io/rCore-Tutorial-Book-v3/index.html
GNU General Public License v3.0
1.58k stars 452 forks source link

fix: bug in backtrace #131

Closed n9wx closed 8 months ago

n9wx commented 8 months ago

fix a bug in backtrace,now it won't execute infinitely recursively in the panic handle function if kernel panic before call task::run_tasks()

wyfcyx commented 8 months ago

Have you ever tried if it works as expected? I think you should return the current value of the sp register(or something like that) rather than the address of the boot_stack_top symbol which does not change as the kernel runs. It seems that the boot_stack_top is not a good start point of the stack backtrace.

n9wx commented 8 months ago

I have tried my solution and it just works。Maybe you are misunderstanding,current_kstack_top not return the start ptr of stack backtrace,it returns the end address of stack region,it just used as a optional stop flag

wyfcyx commented 8 months ago

Sorry, it has been a long period of time and I just forgot what is going on here. Thanks!