-
-
Notifications
You must be signed in to change notification settings - Fork 75
backtrace can infinte-loop. #127
Comments
I would have expected infinite loops like these to be caught by this check. Would be interesting to log LR, PC and other registers as probe-run unwinds the stack.
did you compile the whole Rust code with |
Hi @Dirbaio, Could you please provide us with some code to reproduce this error? Thanks in advance! 😄 |
Attached ELF: repro.tar.gz
|
reporting back for the record and also as a note for myself for when I pick this back up– (paging prevents the endless scrolling here though, which is nice) As a band-aid, I'll implement a backtrace line limit after which the backtrace is cut off (length reconfigurable by flag) to prevent it from scrolling forever. If we're feeling fancy we could additionally cut out the middle and only print, say, the top 10 and bottom 10 lines separated by a |
179: limit backtrace length, make limit configurable r=Lotterleben a=Lotterleben mitigation for #127 example run with user-configured limit: ```console ➜ probe-run git:(127-fix-infinte-loop) ✗ cr -- --max-backtrace-len=3 --chip nRF52840_xxAA rtc_async.elf Compiling probe-run v0.2.1 (/Users/lottesteenbrink/ferrous/knurling/probe-run) Finished dev [unoptimized + debuginfo] target(s) in 6.64s Running `target/debug/probe-run --max-backtrace-len=3 --chip nRF52840_xxAA rtc_async.elf` (HOST) INFO flashing program (11.52 KiB) (HOST) INFO success! ──────────────────────────────────────────────────────────────────────────────── 0 INFO Hello World! └─ rtc_async::__cortex_m_rt_main @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:42 1 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 2 INFO BIG INFREQUENT TICK └─ rtc_async::run1::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:22 3 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 4 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 5 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 6 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 ──────────────────────────────────────────────────────────────────────────────── stack backtrace: 0: HardFaultTrampoline <exception entry> 1: rtc_async::run1::task::{{closure}} at /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:24 2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /home/dirbaio/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80 3: embassy::executor::Task<F>::poll at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:71 (HOST) WARN Maximum backtrace length of 3 reached; cutting off the rest note: re-run with `--max-backtrace-len=<your maximum>` to extend this limit (HOST) ERROR the program panicked ``` Co-authored-by: Lotte Steenbrink <lotte.steenbrink@ferrous-systems.com>
179: limit backtrace length, make limit configurable r=jonas-schievink a=Lotterleben mitigation for #127 example run with user-configured limit: ```console ➜ probe-run git:(127-fix-infinte-loop) ✗ cr -- --max-backtrace-len=3 --chip nRF52840_xxAA rtc_async.elf Compiling probe-run v0.2.1 (/Users/lottesteenbrink/ferrous/knurling/probe-run) Finished dev [unoptimized + debuginfo] target(s) in 6.64s Running `target/debug/probe-run --max-backtrace-len=3 --chip nRF52840_xxAA rtc_async.elf` (HOST) INFO flashing program (11.52 KiB) (HOST) INFO success! ──────────────────────────────────────────────────────────────────────────────── 0 INFO Hello World! └─ rtc_async::__cortex_m_rt_main @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:42 1 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 2 INFO BIG INFREQUENT TICK └─ rtc_async::run1::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:22 3 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 4 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 5 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 6 INFO tick └─ rtc_async::run2::task::{{closure}} @ /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:31 ──────────────────────────────────────────────────────────────────────────────── stack backtrace: 0: HardFaultTrampoline <exception entry> 1: rtc_async::run1::task::{{closure}} at /home/dirbaio/akiles/embassy/embassy-nrf-examples/src/bin/rtc_async.rs:24 2: <core::future::from_generator::GenFuture<T> as core::future::future::Future>::poll at /home/dirbaio/.rustup/toolchains/nightly-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/future/mod.rs:80 3: embassy::executor::Task<F>::poll at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:71 (HOST) WARN Maximum backtrace length of 3 reached; cutting off the rest note: re-run with `--max-backtrace-len=<your maximum>` to extend this limit (HOST) ERROR the program panicked ``` Co-authored-by: Lotte Steenbrink <lotte.steenbrink@ferrous-systems.com>
I'm seeing this behavior with
-C force-frame-pointers=no
.I think it's to be expected that backtracing doesn't work correctly with it, but I think at least this should be detected and fail with
error: the stack appears to be corrupted beyond this point
instead of looping forever.If there's interest I can try cooking a binary that reproduces this.
The text was updated successfully, but these errors were encountered: