-
-
Notifications
You must be signed in to change notification settings - Fork 87
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
nested logs result in complete loss of following log information #593
Comments
found the issue: use panic_probe as _;
impl defmt::Format for S {
fn format(&self, _: defmt::Formatter) {
defmt::error!("this panics");
}
}
defmt::error!("before log");
defmt::error!("{}", S);
// SHOULD block forever
loop { asm::nop() } the program exits with exit code 0 instead of blocking forever $ # NOTE using `--backtrace=always`
$ cargo r --bin hello
(HOST) INFO flashing program (6.62 KiB)
(HOST) INFO success!
────────────────────────────────────────────────────────────────────────────────
ERROR before log
────────────────────────────────────────────────────────────────────────────────
stack backtrace:
0: lib::inline::__bkpt
at ./asm/inline.rs:13:5
1: __bkpt
at ./asm/lib.rs:49:17
2: rust_begin_unwind
at /home/japaric/.cargo/git/checkouts/defmt-7f5b74b4e6ff55d4/e021e7d/firmware/panic-probe/src/lib.rs:51:13
3: core::panicking::panic_fmt
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:92:14
4: core::panicking::panic
at /rustc/c8dfcfe046a7680554bf4eb612bad840e7631c4b/library/core/src/panicking.rs:50:5
5: <defmt_rtt::Logger as defmt::traits::Logger>::acquire
at /home/japaric/.cargo/git/checkouts/defmt-7f5b74b4e6ff55d4/e021e7d/firmware/defmt-rtt/src/lib.rs:45:13
(..)
(HOST) INFO device halted without error |
after PR #594 it's now clear that the program panics $ cargo rb hello
0 ERROR before log
└─ hello::__cortex_m_rt_main::{impl#0}::format @ src/bin/hello.rs:18
────────────────────────────────────────────────────────────────────────────────
stack backtrace:
0: HardFaultTrampoline
<exception entry>
(..)
20: main
at src/bin/hello.rs:6:1
21: ResetTrampoline
at /home/japaric/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/cortex-m-rt-0.6.14/src/lib.rs:547:26
22: Reset
at /home/japaric/.cargo/registry/src/jackfan.us.kg-1ecc6299db9ec823/cortex-m-rt-0.6.14/src/lib.rs:550:13
(HOST) ERROR the program panicked but there's zero information on "why" it panicked. RFC #595 could address that. I think the other option here is to not panic on "nested acquires" and just produce overlapping frames. ERROR before log
ERROR after write
ERROR after log and the program would continue executing removing the panicking branch might even have a positive impact on binary size? (just speculating) |
Steps to reproduce
with v0.2.5 the above prints:
with the
main
branch of defmt the example prints only the first log statement. Both rzcobs and raw encoding were tested.ERROR before log
tested with probe-run f03dcf1 and defmt e021e7d
The text was updated successfully, but these errors were encountered: