knurling-rs / probe-run

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

`--shorten-paths` does not apply to info printed by `--verbose` #217

Open Lotterleben opened 3 years ago

Lotterleben commented 3 years ago

Describe the bug I would've expected --shorten-paths to also shorten the paths in the output before the backtrace, produced by --verbose, e.g. instead of

    Finished dev [optimized + debuginfo] target(s) in 0.11s
     Running `probe-run --chip STM32F411RETx target/thumbv7em-none-eabihf/debug/panic --shorten-paths --verbose`
(HOST) DEBUG RAM region: 0x20000000-0x2001FFFF
└─ probe_run @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-0.2.3/src/main.rs:164
(HOST) DEBUG section `.data` is in RAM at 0x20007BC8-0x20007BF7
└─ probe_run @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-0.2.3/src/main.rs:220

....

────────────────────────────────────────────────────────────────────────────────
0 INFO  main
└─ panic::__cortex_m_rt_main @ test_elfs/src/bin/panic.rs:8
1 ERROR panicked at 'explicit panic'
└─ panic::__cortex_m_rt_main @ test_elfs/src/bin/panic.rs:10
────────────────────────────────────────────────────────────────────────────────
(HOST) DEBUG LR=0xFFFFFFF9 PC=0x0800189E
└─ probe_run::backtrace::unwind @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-0.2.3/src/backtrace/unwind.rs:78
(HOST) DEBUG LR=0x08000541 PC=0x08000B52
└─ probe_run::backtrace::unwind @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-

....

(HOST) DEBUG LR=0xFFFFFFFF PC=0x0800048A
└─ probe_run::backtrace::unwind @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-0.2.3/src/backtrace/unwind.rs:78
stack backtrace:
   0: HardFaultTrampoline
      <exception entry>
   1: lib::inline::__udf
        at ./asm/inline.rs:172:5
   2: __udf
        at ./asm/lib.rs:49:17
   3: cortex_m::asm::udf

...

(HOST) ERROR the program panicked
└─ probe_run @ /Users/lottesteenbrink/.cargo/registry/src/github.com-1ecc6299db9ec823/probe-run-0.2.3/src/main.rs:581

I would've expected:

    Finished dev [optimized + debuginfo] target(s) in 0.11s
     Running `probe-run --chip STM32F411RETx target/thumbv7em-none-eabihf/debug/panic --shorten-paths --verbose`
(HOST) DEBUG RAM region: 0x20000000-0x2001FFFF
└─ probe_run @ [probe-run-0.2.3]/src/main.rs:164
(HOST) DEBUG section `.data` is in RAM at 0x20007BC8-0x20007BF7
└─ probe_run @ [probe-run-0.2.3]/src/main.rs:220

....

────────────────────────────────────────────────────────────────────────────────
0 INFO  main
└─ panic::__cortex_m_rt_main @ test_elfs/src/bin/panic.rs:8
1 ERROR panicked at 'explicit panic'
└─ panic::__cortex_m_rt_main @ test_elfs/src/bin/panic.rs:10
────────────────────────────────────────────────────────────────────────────────
(HOST) DEBUG LR=0xFFFFFFF9 PC=0x0800189E
└─ probe_run::backtrace::unwind @ [probe-run-0.2.3]/src/backtrace/unwind.rs:78
(HOST) DEBUG LR=0x08000541 PC=0x08000B52
└─ probe_run::backtrace::unwind @ [probe-run-0.2.3]

....

(HOST) DEBUG LR=0xFFFFFFFF PC=0x0800048A
└─ probe_run::backtrace::unwind @ [probe-run-0.2.3]/src/backtrace/unwind.rs:78
stack backtrace:
   0: HardFaultTrampoline
      <exception entry>
   1: lib::inline::__udf
        at ./asm/inline.rs:172:5
   2: __udf
        at ./asm/lib.rs:49:17
   3: cortex_m::asm::udf

...

(HOST) ERROR the program panicked
└─ probe_run @ [probe-run-0.2.3]/src/main.rs:581

To Reproduce run cargo run --bin panic -- --shorten-paths --verbose in a repository generated using the app template or using the elf file linked below

Operating System: [e.g. Linux]

ELF file (attachment)

https://ferroussystems-my.sharepoint.com/:u:/g/personal/lotte_steenbrink_ferrous-systems_com/EVeRzXk3wkhMh6DPqKXNnp8B_VCz47moxFMQl0qDgm3WkA?e=6EZ6sR

japaric commented 3 years ago

that may need to be done in the defmt-decoder crate instead of this one https://github.com/knurling-rs/defmt/blob/c8291f492e3013690bc2876e638d965638f335c7/decoder/src/log.rs#L350