probe-rs / vscode

VSCode debug extension for probe-rs. It uses the MS DAP protocol to communicate directly with the probe (via probe-rs), and supports basic command line debugging in addition to VSCode UI.
https://probe.rs/
Other
65 stars 6 forks source link

debugging session closes silently #15

Closed jacobrosenthal closed 2 years ago

jacobrosenthal commented 2 years ago

After working through #14 Im trying several target and debugger combinations to try to get a working debug session ust to see what it is supposed to look like. Currently attempting an STM32F407 discovery board with stilnk. But similarly to a jlink the session starts and communicates with the debugger but after a second or two, the session abruptly stops with no feedback. I found the trace debug which is obvious in retrospect (though not listed on the website and probably should be)

Trace log https://gist.github.com/jacobrosenthal/a714ba3bc63b7e956f6a94d09701ed80

noppej commented 2 years ago

@jacobrosenthal Can you please retest this again https://github.com/probe-rs/vscode/releases/tag/v0.3.2 (also please update to the latest probe-rs-debugger as suggested in the release note.

PS. I updated the docs to add the Trace logging ... thanks for catching that.

jacobrosenthal commented 2 years ago

Yep still closing silently and nothing with level Error interesting printed in the console,

Screenshot from 2021-11-15 10-25-08

though with a daplink instead of the jlink im catching this now, not sure if that was there before, but it also goes away within ~1 second Screenshot from 2021-11-15 10-16-18

noppej commented 2 years ago

I just received the following update from @jacobrosenthal (only including the relevant parts).

  1. The offending code above uses the embassy-rs project, and apparently runs into https://github.com/probe-rs/probe-rs/issues/531 (with jlink as well as daplink).
  2. When using an nrf52840 dev kit and nrf-hal example (no embassy) and log level at Debug, VSCode pops up the following message
    ERROR: RangeError [ERR_CHILD_PROCESS_STDIO_MAXBUFFER]: stderr maxBuffer length exceeded [2021-11-16T17:18:53Z INFO probe_rs_debugger::debugger] probe-rs-debugger: ..Starting session from :127.0.0.1:56898 [2021-11-16T17:18:53Z DEBUG probe_rs_debugger::protocol] ...
  3. At a lower log level, like Error, it behaves normally (it still suffers from https://github.com/probe-rs/probe-rs/issues/788)

I am proceeding to look at a fix to mitigate # 2 above, so that we can be sure it is not hiding additional info.

noppej commented 2 years ago

For # 2 above, the documentation states the following:

maxBuffer <number> Largest amount of data in bytes allowed on stdout or stderr. If exceeded, the child process is terminated and any output is truncated. See caveat at maxBuffer and Unicode. Default: 1024 * 1024.

The fact that VSCode terminates the childProcess, explains why the probe-rs-debugger logs didn't show the reason for the failure.