Comments (6)
reporting back for the record and also as a note for myself for when I pick this back upβ
the problem is indeed that stack_corrupted
doesan't paint the full picture, but this one is tricky to detect β after 9:
, the program counter doesn't change (checked by lr & !THUMB_BIT == pc & !THUMB_BIT
), but the CFA (Canonical Frame Address)
keep shifting, as the HardFault occurs in a loop https://github.com/embassy-rs/embassy/blob/f8c434400393d74fb51acb130bbaaf835e7edf38/embassy/src/executor/mod.rs#L202 .
We can't just make the &&
a ||
because in other cases like for example.... several recursive function calls, this is a perfectly legal state that should not interrupt the backtrace printing.
We've checked if gdb does some detection magic, but it seems to run into the same problem:
(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 [...]
by default for better glance-ability.
from probe-run.
Closing this now due to #179 being mergedβ @Dirbaio , feel free to re-open if you disagree or have new input
from probe-run.
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.
I'm seeing this behavior with -C force-frame-pointers=no.
did you compile the whole Rust code with -C force-frame-pointers=no
or is it just the assembly (asm.rs
?) what was compiled w/o frame pointers? The backtrace looks fine for the first 17 frames or so.
from probe-run.
Hi @Dirbaio, Could you please provide us with some code to reproduce this error? Thanks in advance! π
from probe-run.
Attached ELF: repro.tar.gz
Built from this commit akiles/embassy@f8c4344
[dirbaio@mars embassy-nrf-examples]$ probe-run --version
0.2.1
supported defmt version: 0.2
[dirbaio@mars embassy-nrf-examples]$ rustc --version
rustc 1.52.0-nightly (a15f484b9 2021-02-22)
[dirbaio@mars embassy-nrf-examples]$ cargo build --bin rtc_async
Finished dev [optimized + debuginfo] target(s) in 0.05s
rustc 1.52.0-nightly (a15f484b9 2021-02-22)
[dirbaio@mars embassy-nrf-examples]$ probe-run --chip nRF52840_xxAA ../target/thumbv7em-none-eabi/debug/rtc_async
(HOST) INFO flashing program (11.52 KiB)
(HOST) INFO success!
ββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββββ
0 INFO Hello World!
ββ rtc_async::__cortex_m_rt_main @ src/bin/rtc_async.rs:42
1 INFO tick
ββ rtc_async::run2::task::{{closure}} @ src/bin/rtc_async.rs:31
2 INFO BIG INFREQUENT TICK
ββ rtc_async::run1::task::{{closure}} @ src/bin/rtc_async.rs:22
3 INFO tick
ββ rtc_async::run2::task::{{closure}} @ src/bin/rtc_async.rs:31
4 INFO tick
ββ rtc_async::run2::task::{{closure}} @ src/bin/rtc_async.rs:31
5 INFO tick
ββ rtc_async::run2::task::{{closure}} @ src/bin/rtc_async.rs:31
6 INFO tick
ββ rtc_async::run2::task::{{closure}} @ src/bin/rtc_async.rs:31
stack backtrace:
0: HardFaultTrampoline
<exception entry>
1: rtc_async::run1::task::{{closure}}
at 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
4: embassy::executor::timer_queue::TimerQueue::update
at /home/dirbaio/akiles/embassy/embassy/src/executor/timer_queue.rs:35
5: embassy::executor::raw::Executor::run_queued::{{closure}}
at /home/dirbaio/akiles/embassy/embassy/src/executor/raw.rs:135
6: embassy::executor::run_queue::RunQueue::dequeue_all
at /home/dirbaio/akiles/embassy/embassy/src/executor/run_queue.rs:66
7: embassy::executor::raw::Executor::run_queued
at /home/dirbaio/akiles/embassy/embassy/src/executor/raw.rs:117
8: cortex_m::asm::wfe
at /home/dirbaio/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:49
9: embassy::executor::Executor::run
at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:202
10: cortex_m::asm::wfe
at /home/dirbaio/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:49
11: embassy::executor::Executor::run
at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:202
12: cortex_m::asm::wfe
at /home/dirbaio/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:49
13: embassy::executor::Executor::run
at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:202
14: cortex_m::asm::wfe
at /home/dirbaio/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:49
15: embassy::executor::Executor::run
at /home/dirbaio/akiles/embassy/embassy/src/executor/mod.rs:202
16: cortex_m::asm::wfe
at /home/dirbaio/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:49
.... infinite loop
from probe-run.
Thank you @Dirbaio for providing the reproducable!
Jonas mentioned in #163
that following condition is likely the cause for this bug:
Line 801 in d702944
from probe-run.
Related Issues (20)
- `probe-run` fails to build due to yanked dependency HOT 8
- Probe run error points to old trouble shooting section
- CMSIS_DAP is not recognised (fix available link to PR)
- probe-run fails with `thread 'main' panicked at 'no entry found for key'` on heavy traffic and (maybe) buggy global logger. HOT 2
- The erase-all flag erases entire chip unnecessarily on nrf5340 which affects performance HOT 7
- Allow single line log output HOT 6
- Feature request: Timestamps on RTT messages HOT 1
- probe-run cannot detect pico HOT 4
- println! unexpectedly prints the statement's location before the formatted string
- probe-run assumes stack fits within a memory region
- Add an optional flag to halt once Ctrl+C is pressed
- Cannot install probe-run on Mac M1 HOT 5
- Running app on STM32F4 crashes core with unrecoverable exception HOT 8
- --log-format is inconvenient when only timestamp must be added HOT 1
- Cannot execute binary file HOT 2
- Issues using `probe-run` with an fe310g002 microcontroller HOT 5
- RP 2040: "ARM specific error" HOT 2
- Wrong SRAM regions for STM32L4 HOT 3
- Using app-template - Timeout occurred during operation HOT 2
- release final version with deprecation notice
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
π Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. πππ
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google β€οΈ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from probe-run.