knurling-rs / probe-run

Run embedded programs just like native ones
Apache License 2.0
645 stars 75 forks source link

Mangled names without location info in panic backtrace #201

Open jonas-schievink opened 3 years ago

jonas-schievink commented 3 years ago

Describe the bug

I received the following stack backtrace after a panic, which contains 2 frames (7 and 8) that should get demangled properly (and also have location info) but don't:

  (HOST) INFO  flashing program (8.73 KiB)
  (HOST) INFO  success!
────────────────────────────────────────────────────────────────────────────────
         INFO  (1/1) running `tx_interrupt`...
└─ interrupts::tests::__defmt_test_entry @ tests/interrupts.rs:4
         DEBUG CAN1 TX interrupt
└─ interrupts::tests::tx_interrupt::{{closure}}::{{closure}} @ tests/interrupts.rs:41
────────────────────────────────────────────────────────────────────────────────
stack backtrace:
   0: HardFaultTrampoline
      <exception entry>
   1: lib::inline::__udf
        at ./asm/inline.rs:171:5
   2: __udf
        at ./asm/lib.rs:49:17
   3: cortex_m::asm::udf
        at /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/asm.rs:43:5
   4: rust_begin_unwind
        at /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/panic-probe-0.2.0/src/lib.rs:75:9
   5: core::panicking::panic_fmt
        at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/core/src/panicking.rs:92:14
   6: core::panicking::panic
        at /rustc/881c1ac408d93bb7adaa3a51dabab9266e82eee8/library/core/src/panicking.rs:50:5
   7: _ZN5bxcan12Can$LT$I$GT$28clear_request_completed_flag17h4191b6ad4457a497E
   8: _ZN5bxcan12Can$LT$I$GT$18clear_tx_interrupt17h8ede413b472a459eE
   9: interrupts::tests::tx_interrupt::{{closure}}::{{closure}}
        at tests/interrupts.rs:43:76
  10: cortex_m::interrupt::free
        at /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-0.7.1/src/interrupt.rs:64:13
  11: interrupts::tests::tx_interrupt::{{closure}}
        at tests/interrupts.rs:42:17
      <exception entry>
  12: core::sync::atomic::atomic_load
        at /home/jonas/.rustup/toolchains/nightly-2021-05-09-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:2354:24
  13: core::sync::atomic::AtomicBool::load
        at /home/jonas/.rustup/toolchains/nightly-2021-05-09-x86_64-unknown-linux-gnu/lib/rustlib/src/rust/library/core/src/sync/atomic.rs:380:18
  14: interrupts::tests::tx_interrupt::{{closure}}
        at tests/interrupts.rs:56:13
  15: irq::scope
        at /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/irq-0.2.3/src/lib.rs:240:18
  16: interrupts::tests::tx_interrupt
        at tests/interrupts.rs:48:9
  17: main
        at tests/interrupts.rs:4:1
  18: Reset
        at /home/jonas/.cargo/registry/src/github.com-1ecc6299db9ec823/cortex-m-rt-0.6.13/src/lib.rs:526:15
  (HOST) ERROR the program panicked
error: test failed, to rerun pass '--test interrupts'

To Reproduce Steps to reproduce the behavior:

Probably only reproduces when reasonably compatible hardware is attached (I'm using an STM32F105)

Expected and observed behavior

According to rustfilt, the names demangle as follows:

_ZN5bxcan12Can$LT$I$GT$28clear_request_completed_flag17h4191b6ad4457a497E => bxcan::Can<I>::clear_request_completed_flag _ZN5bxcan12Can$LT$I$GT$18clear_tx_interrupt17h8ede413b472a459eE => bxcan::Can<I>::clear_tx_interrupt

config.toml (see repo link)

Probe details Doesn't matter, but it's a µDAP DAPlink

Operating System: Linux, but should reproduce on any

ELF file (attachment) elf.zip

Urhengulas commented 3 years ago

I first though this might be related to https://github.com/knurling-rs/defmt/issues/423, but although both miss the location, I guess they have different origins.