Anyone here who has managed to get debugging working with VS Code?
I've gotten as far as a debug session is started, but I can't get stepping etc. to work.
My setup so far (based off the official docs for JTAG debugging):
Running OpenOCD:
Code: Select all
bin/openocd -s share/openocd/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg
Code: Select all
{
"name": "(xtensa-esp32-elf-gdb) Launch",
"type": "cppdbg",
"request": "launch",
"program": "/home/permal/esp/xtensa-esp32-elf/bin/xtensa-esp32-elf-gdb",
"args": ["-x", "${workspaceFolder}/gdbinit", "${workspaceFolder}/build/g3"],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
}
Pressing <return> correctly results in the app stopping at app_main():GNU gdb (crosstool-NG crosstool-ng-1.22.0-80-g6c4433a) 7.10
Copyright (C) 2015 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "--host=x86_64-build_pc-linux-gnu --target=xtensa-esp32-elf".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/permal/electronics/IO-Card-G3/software/build/g3...done.
0x401c5ec5 in get_time_since_boot ()
at /home/permal/esp/esp-idf/components/newlib/time.c:282
282 microseconds = s_microseconds_offset + esp_timer_get_time();
JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
esp32: Debug controller 0 was reset (pwrstat=0x5F, after clear 0x0F).
esp32: Core 0 was reset (pwrstat=0x5F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x5000004B (active) APP_CPU: PC=0x00000000
esp32: Core 0 was reset (pwrstat=0x1F, after clear 0x0F).
esp32: Debug controller 1 was reset (pwrstat=0x5F, after clear 0x0F).
esp32: Core 1 was reset (pwrstat=0x5F, after clear 0x0F).
Target halted. PRO_CPU: PC=0x40000400 (active) APP_CPU: PC=0x40000400
Hardware assisted breakpoint 1 at 0x400d7b94: file /home/permal/electronics/IO-Card-G3/software/main/main.cpp, line 4.
Target halted. PRO_CPU: PC=0x400D7B94 (active) APP_CPU: PC=0x401D40C2
[New Thread 1073478312]
[New Thread 1073476412]
[New Thread 1073480968]
[New Thread 1073460516]
[New Thread 1073412860]
[New Thread 1073459128]
[New Thread 1073462620]
[Switching to Thread 1073474380]
Temporary breakpoint 1, app_main ()
---Type <return> to continue, or q <return> to quit---
In VS Code, the following can be seen:[New Thread 1073459128]
[New Thread 1073462620]
[Switching to Thread 1073474380]
Temporary breakpoint 1, app_main ()
---Type <return> to continue, or q <return> to quit---
at /home/permal/electronics/IO-Card-G3/software/main/main.cpp:4
4 {
(gdb)
At this point, VS Code still seems to thing the app is running because it still has the pause-button enabled. So, how to get VS Code synced with gdb?=thread-group-added,id="i1"
GNU gdb (Ubuntu 8.1-0ubuntu3) 8.1.0.20180409-git
Copyright (C) 2018 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law. Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<http://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word".
Warning: Debuggee TargetArchitecture not detected, assuming x86_64.
=cmd-param-changed,param="pagination",value="off"
Stopped due to shared library event (no libraries added or removed)
Loaded '/lib64/ld-linux-x86-64.so.2'. Symbols loaded.
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Breakpoint 1, 0x00000000004660d0 in main ()