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

esp-backtrace does not print backtrace in certain situations. #2270

Open
t-moe opened this issue Oct 3, 2024 · 1 comment
Open

esp-backtrace does not print backtrace in certain situations. #2270

t-moe opened this issue Oct 3, 2024 · 1 comment
Labels
bug Something isn't working package:esp-backtrace Issues related to the esp-backtrace package

Comments

@t-moe
Copy link
Contributor

t-moe commented Oct 3, 2024

I wanted to use esp_backtrace::arch::backtrace() to obtain a backtrace in my watchdog interrupt handler, so that I can print a backtrace of where the watchdog occurred. To my surprise the backtrace was empty (even though I have force-frame-pointers enabled).

Apparently the issue was that some stack-frames around the interrupt handling code where not 16-byte aligned, which would cause the printing to be aborted (due to esp_backtrace::is_valid_ram_addr returning false).

https://github.com/esp-rs/esp-hal/blob/e033162ffd1994c46c478de2de5ec1eed3869762/esp-backtrace/src/lib.rs#L214C1-L217C6

When I removed the 16-byte alignment check, I got a correct backtrace back until main.

I'm not sure if there are also other situations where the stackframes are not 16-byte aligned, or whether that's just because I'm inside an interrupt handler. I just wanted to share my discovery, not sure if its of any help to you.

Thank you

@t-moe t-moe added bug Something isn't working status:needs-attention This should be prioritized labels Oct 3, 2024
@jessebraham jessebraham added package:esp-backtrace Issues related to the esp-backtrace package and removed status:needs-attention This should be prioritized labels Oct 3, 2024
@bjoernQ
Copy link
Contributor

bjoernQ commented Oct 4, 2024

Thanks - that's an interesting observation and getting a backtrace is especially useful for WDT interrupts (probably not for other interrupts)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working package:esp-backtrace Issues related to the esp-backtrace package
Projects
Status: Todo
Development

No branches or pull requests

3 participants