Skip to content
This repository has been archived by the owner on Jan 30, 2024. It is now read-only.

limit backtrace length, make limit configurable #179

Merged
merged 2 commits into from
Mar 31, 2021
Merged

Conversation

Lotterleben
Copy link

@Lotterleben Lotterleben commented Mar 31, 2021

mitigation for #127

example run with user-configured limit:

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

Copy link
Contributor

@jonas-schievink jonas-schievink left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, only some minor nits (and this needs a cargo fmt)

src/main.rs Outdated Show resolved Hide resolved
src/main.rs Outdated Show resolved Hide resolved
@Lotterleben Lotterleben force-pushed the 127-fix-infinte-loop branch from 94d256f to 89ceeab Compare March 31, 2021 12:49
@Lotterleben
Copy link
Author

Adjusted and squashed :)

@Lotterleben
Copy link
Author

bors r+

bors bot added a commit that referenced this pull request Mar 31, 2021
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>
@bors
Copy link
Contributor

bors bot commented Mar 31, 2021

Build failed:

@Lotterleben
Copy link
Author

Ah dang, got a little bit ahead of myself there– structopts default_value() doesn't work like that ( TeXitoi/structopt#152 ) gotta run now, will revert tomorrow

@jonas-schievink
Copy link
Contributor

bors r+

@bors bors bot merged commit 1bee3fa into main Mar 31, 2021
@bors bors bot deleted the 127-fix-infinte-loop branch March 31, 2021 13:17
# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants