espressif / vscode-esp-idf-extension

Visual Studio Code extension for ESP-IDF projects
https://docs.espressif.com/projects/vscode-esp-idf-extension/en/latest/
Apache License 2.0
1.06k stars 304 forks source link

[VSC-1412] Add validation for debug session status for monitor start with no reset flag #1270

Closed radurentea closed 3 weeks ago

radurentea commented 3 months ago

Description

JIRA: https://jira.espressif.com:8443/browse/VSC-1412

Type of change

Steps to test this pull request

  1. Debug a project (ex: blink)
  2. While debugging, start monitoring

The board should not reset itself, monitor should start from the current state of the board

How has this been tested?

As described above using the blink example on a ESP32-C6 board

Test Configuration:

Checklist

github-actions[bot] commented 3 months ago

Download the artifacts for this pull request: You can test these changes by installing this VSIX by click menu View -> Command Palette..., type Install from VSIX and then select downloaded esp-idf-extension.vsix file to install the extension.

radurentea commented 3 months ago

Hi @brianignacio5, PTAL

radurentea commented 3 months ago

Hi @AndriiFilippov PTAL

github-actions[bot] commented 2 months ago

Pull request has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities

AndriiFilippov commented 2 months ago

@radurentea hi !

Tested under: OS - MacOS ESP-IDF: v5.2.2

Steps: start debug session - run Monitor - stop debug session - try to start again -> ERROR:

/Users/andriifilippov/.espressif/tools/riscv32-esp-elf-gdb/14.2_20240403/riscv32-esp-elf-gdb/bin/riscv32-esp-elf-gdb

/Users/andriifilippov/.espressif/tools/openocd-esp32/v0.12.0-esp32-20240318/openocd-esp32/bin/openocd

Open On-Chip Debugger v0.12.0-esp32-20240318 (2024-03-18-18:28)
Licensed under GNU GPL v2
For bug reports, read
    http://openocd.org/doc/doxygen/bugs.html
debug_level: 2

Info : only one transport option; autoselecting 'jtag'

Info : esp_usb_jtag: VID set to 0x303a and PID to 0x1001
Info : esp_usb_jtag: capabilities descriptor set to 0x2000

Info : Listening on port 6666 for tcl connections

Info : Listening on port 4444 for telnet connections

Info : esp_usb_jtag: serial (60:55:F9:F7:2C:26)

Info : esp_usb_jtag: Device found. Base speed 24000KHz, div range 1 to 255

Info : clock speed 24000 kHz

Info : JTAG tap: esp32h2.cpu tap/device found: 0x00010c25 (mfg: 0x612 (Espressif Systems), part: 0x0010, ver: 0x0)

Info : [esp32h2] datacount=2 progbufsize=16

Info : [esp32h2] Examined RISC-V core; found 1 harts
Info : [esp32h2]  XLEN=32, misa=0x40903105

Info : [esp32h2] Examination succeed
Info : starting gdb server for esp32h2 on 3333
Info : Listening on port 3333 for gdb connections

Info : accepting 'gdb' connection on tcp/3333

Info : [esp32h2] Halt cause (5) - (PMP Load access fault)

Warn : No symbols for FreeRTOS!

❌ Error: Algorithm timed out after 40001 ms.

Info : [esp32h2] Halt cause (5) - (PMP Load access fault)

❌ Error: ra = 0x40800924

❌ Error: sp = 0x408046b0

❌ Error: gp = 0x4080a270

❌ Error: tp = 0x408061b4

❌ Error: t0 = 0x400106c4

❌ Error: t1 = 0xffffffe0

❌ Error: t2 = 0x0

❌ Error: fp = 0x1

❌ Error: s1 = 0xf8

❌ Error: a0 = 0x40804710

❌ Error: a1 = 0x42f88000

❌ Error: a2 = 0x20

❌ Error: a3 = 0x40804730

❌ Error: a4 = 0x40804730

❌ Error: a5 = 0x1

❌ Error: a6 = 0x20

❌ Error: a7 = 0x80000000

❌ Error: s2 = 0x8000

❌ Error: s3 = 0x20

❌ Error: s4 = 0x42f90000

❌ Error: s5 = 0x42f88000

❌ Error: s6 = 0x0

❌ Error: s7 = 0x60002000

❌ Error: s8 = 0x10000

❌ Error: s9 = 0x42f80000

❌ Error: s10 = 0x40804144

❌ Error: s11 = 0x1

❌ Error: t3 = 0x0

❌ Error: t4 = 0x0

❌ Error: t5 = 0x0

❌ Error: t6 = 0x0

❌ Error: pc = 0x40800000

❌ Error: mstatus = 0x1800

❌ Error: mepc = 0x40800008
Error: mcause = 0x5
Error: Failed to wait algorithm (-302)!
Error: Algorithm run failed (-302)!

❌ Error: Failed to run flasher stub (-302)!
Warn : Failed to get flash mappings (-302)!

❌ Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!

❌ Error: Failed to run flasher stub (-4)!

❌ Error: Target is already running an algorithm
Error: Failed to start algorithm (-4)!

❌ Error: Failed to run flasher stub (-4)!
Error: Failed to probe flash, size 0 KB
Error: auto_probe failed
Error: Connect failed. Consider setting up a gdb-attach event for the target to prepare target for GDB connect, or use 'gdb_memory_map disable'.

❌ Error: attempted 'gdb' connection rejected

Have tried multiple times. Leads to same error.

radurentea commented 2 months ago

Hi @AndriiFilippov,

The problem is not related to the change itself, but rather to the debugging process. The intended behavior occurs when we:

1) Start a debug session 2) Begin monitoring 3) Apply the --no-reset flag and the monitoring starts without reseting the board

However, issues arise when:

1) We close the debugging session without properly ending the monitoring process 2) Or, we halt the program at a breakpoint before closing the session (board needs to be reset before attempting debugging again)

In these cases, when we attempt to restart debugging, we encounter errors.

I think we can close this issue if the intended behaviour works and open a discussion about the debugging process with @brianignacio5 and @kolipakakondal maybe they have a better understanding if we should and if we can support the a fix for what you found.

github-actions[bot] commented 1 month ago

Pull request has been marked as stale since there are no activities, and this will be closed in 5 days if there are no further activities