ESP-Prog debugger issue. No visible error. (Ubuntu)

No, I’m rerunning it again. It just stopped there:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Detected debug stubs @ 3ffc09b0
Info : Listening on port 3333 for gdb connections


I also tried hitting enter. If it’s a gdb shell we should get (gdb) on a new line right?

For GDB yes, but this is OpenOCD and just starts the server, it’s not the GDB client itself. For that one would have to execute ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf followed by target extended-remote localhost:3333 to connect to OpenOCD. But that’s off-topic.

One last thing please, maybe it is able to start OpenOCD, but not GDB. What happens when you execute
just

~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb

?

1 Like

Ah, gotcha. GDB seems to run alright though.

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 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".
(gdb) 
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf followed by target extended-remote localhost:3333
Excess command line arguments ignored. (by ...)
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 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 .pio/build/esp-wrover-kit/firmware.elf...done.
/home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/followed: No such file or directory.
(gdb) 

Welp, seems I’ve posted too much…
image

Okay just for fun, what happens if you do this? (While OpenOCD is running in the background)

1 Like

Oooh right, you’re a mod. Got confused there for a sec! Thanks for bumping me up a step. I edited the above message with the output of the execution.

I’ve bumped up the user level.

Sorry must be two separate commands, the latter on in the GDB shell. First

 ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf

and then in GDB

target extended-remote localhost:3333

You can then also try

monitor init
load
monitor reset halt
break setup
continue

Also what exact distributation and version are you using? If this still doesn’t work I’ll try to reproduce it in a VM. It is weird that OpenOCD and GDB seem to work on their own but not in conjuction with PlatformIO and VSCode.

1 Like

Oh, I’m stupid. Sorry I haven’t slept much xD
Here:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$  ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 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 .pio/build/esp-wrover-kit/firmware.elf...done.
(gdb) target extended-remote localhost:3333
localhost:3333: Connection timed out.
(gdb) 

Timed out, it seems.

Guessing those other commands are for when it connects, but I ran them anyway.

(gdb) target extended-remote localhost:3333
localhost:3333: Connection timed out.
(gdb) monitor init
"monitor" command not supported by this target.
(gdb) load
You can't do that when your target is `exec'
(gdb) monitor reset halt
"monitor" command not supported by this target.
(gdb) break setup
ontinueBreakpoint 1 at 0x400d0c5c: file src/Blink.cpp, line 13.
(gdb) continue
The program is not being run.
(gdb)

It’s Kubuntu.

(base) ab@desktop:~$ uname -a
Linux desktop 5.4.0-70-generic #78-Ubuntu SMP Fri Mar 19 13:29:52 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

It doesn’t seem to get a connection to the OpenOCD server. Is the

command running in a seperate shell?

1 Like

No, I’m running it all in one shell within vscode’s integrated console.

Can open a normal system shell in parallel to start OpenOCD and then GDB in the VSCode shell?

1 Like

I’ll try

Were I supposed to run
~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
and not
~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf
by the way?
Just so I don’t misunderstand.

That seems to have done something:

(base) ab@desktop:~$ ~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Detected debug stubs @ 3ffc09b0
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400E93EA, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400E93EA, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.irom' size 104 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.drom' size 52 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : negative reply, retrying
Info : dropped 'gdb' connection
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ gdb
GNU gdb (Ubuntu 9.2-0ubuntu1~20.04) 9.2
Copyright (C) 2020 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".
(gdb) target extended-remote localhost:3333
Remote debugging using localhost:3333
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Remote replied unexpectedly to 'vMustReplyEmpty': PacketSize=4000;qXfer:memory-map:read+;qXfer:features:read-;qXfer:threads:read+;QStartNoAckMode+;vContSupported+
(gdb) 

Ah but you used the system’s GDB here and not the xtensa-esp32-elf-gdb here. Should have been

with the steps

In any case, this already shows that OpenOCD can accept GDB connections and works okay… I’ll try to reproduce this.

1 Like

Sorry, here’s what I think you meant now.

In vscode:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ ~/.platformio/packages/toolchain-xtensa32/bin/xtensa-esp32-elf-gdb .pio/build/esp-wrover-kit/firmware.elf
GNU gdb (crosstool-NG crosstool-ng-1.22.0-97-gc752ad5) 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 .pio/build/esp-wrover-kit/firmware.elf...done.
(gdb) 
(gdb) 
(gdb)     target extended-remote localhost:3333
Remote debugging using localhost:3333
Ignoring packet error, continuing...
warning: unrecognized item "timeout" in "qSupported" response
Bogus trace status reply from target: OK
(gdb) 

external shell:

(base) ab@desktop:~$ ~/.platformio/packages/tool-openocd-esp32/bin/openocd -s ~/.platformio/packages/tool-openocd-esp32/scripts -f interface/ftdi/esp32_devkitj_v1.cfg -f board/esp32-wrover.cfg -c "adapter_khz 500"
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 500 kHz

Info : Listening on port 6666 for tcl connections
Info : Listening on port 4444 for telnet connections
Info : clock speed 500 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Target halted, PC=0x400E93EA, debug_reason=00000001
Info : esp32.cpu0: Detected debug stubs @ 3ffc09b0
Info : esp32.cpu1: Target halted, PC=0x400E93EA, debug_reason=00000000
Info : Listening on port 3333 for gdb connections
Info : accepting 'gdb' connection on tcp/3333
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Set GDB target to 'esp32.cpu0'
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.irom' size 104 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.drom' size 52 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
Warn : negative reply, retrying
Warn : negative reply, retrying
Warn : negative reply, retrying
Info : dropped 'gdb' connection

And thank you for troubleshooting. I’m obviously a bit oblivious to what is going on here, but these people seem to have stumbled upon something similar debugging problem: unrecognized item "timeout" in "qSupported" response - ESP32 Forum

This usually only appears when the wrong GDB version is used with OpenOCD (or there’s a bug in OpenOCD). But I’ll see if I can try to reproduce that in my Kubuntu virtual machine.

Just for reference, you again open a CLI and execute

pio system info
pio debug
pio debug --interface=gdb -x .pioinit

(per docs) and post the output?

Sorry it took some time

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio system info
b -x .pioinit--------------------------  --------------------------------------------
PlatformIO Core             5.2.0a3
Python                      3.8.5-final.0
System Type                 linux_x86_64
Platform                    Linux-5.4.0-70-generic-x86_64-with-glibc2.29
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/ab/.platformio
PlatformIO Core Executable  /home/ab/.platformio/penv/bin/platformio
Python Executable           /home/ab/.platformio/penv/bin/python
Global Libraries            0
Development Platforms       1
Tools & Toolchains          9
--------------------------  --------------------------------------------
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio debug
Processing esp-wrover-kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (custom) On-board (ftdi) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-openocd-esp32 2.1000.20201202 (10.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Retrieving maximum program size .pio/build/esp-wrover-kit/firmware.elf
Checking size .pio/build/esp-wrover-kit/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13480 bytes from 327680 bytes)
Flash: [==        ]  15.9% (used 208334 bytes from 1310720 bytes)
=================================================================================== [SUCCESS] Took 0.73 seconds ===================================================================================
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio debug --interface=gdb -x .pioinit
Reading symbols from /home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/.pio/build/esp-wrover-kit/firmware.elf...done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target...
.pioinit:13: Error in sourced command file:
localhost:3333: Connection timed out.
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ 

My bad, can you for a test, change revert this change

And rerun the last debug command?

Otherwise it will of course run into a timeout because it doesn’t attempt to start OpenOCD.

Do you mean the reverse? I had

debug_tool = custom
debug_port = localhost:3333

already.
If so, here’s the output:

(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio system info
b -x .pioinit--------------------------  --------------------------------------------
PlatformIO Core             5.2.0a3
Python                      3.8.5-final.0
System Type                 linux_x86_64
Platform                    Linux-5.4.0-70-generic-x86_64-with-glibc2.29
File System Encoding        utf-8
Locale Encoding             UTF-8
PlatformIO Core Directory   /home/ab/.platformio
PlatformIO Core Executable  /home/ab/.platformio/penv/bin/platformio
Python Executable           /home/ab/.platformio/penv/bin/python
Global Libraries            0
Development Platforms       1
Tools & Toolchains          9
--------------------------  --------------------------------------------
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio debug
Processing esp-wrover-kit (platform: espressif32; framework: arduino; board: esp-wrover-kit)
----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/esp-wrover-kit.html
PLATFORM: Espressif 32 (3.2.0) > Espressif ESP-WROVER-KIT
HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash
DEBUG: Current (esp-prog) On-board (ftdi) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES: 
 - framework-arduinoespressif32 3.10006.210326 (1.0.6) 
 - tool-esptoolpy 1.30000.201119 (3.0.0) 
 - tool-openocd-esp32 2.1000.20201202 (10.0) 
 - toolchain-xtensa32 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> http://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 28 compatible libraries
Scanning dependencies...
No dependencies
Building in debug mode
Compiling .pio/build/esp-wrover-kit/src/Blink.cpp.o
Generating partitions .pio/build/esp-wrover-kit/partitions.bin
Archiving .pio/build/esp-wrover-kit/libFrameworkArduinoVariant.a
Indexing .pio/build/esp-wrover-kit/libFrameworkArduinoVariant.a
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Esp.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/FunctionalInterrupt.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/HardwareSerial.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/IPAddress.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/IPv6Address.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/MD5Builder.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Print.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/Stream.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/StreamString.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/WMath.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/WString.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/base64.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/cbuf.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-adc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-bt.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-cpu.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-dac.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-gpio.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-i2c.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-ledc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-log.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-matrix.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-misc.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-psram.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-rmt.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-sigmadelta.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-spi.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-time.c.o
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c: In function 'spiTransferBytesNL':
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:922:39: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_out8 = &result[c_longs-1];
                                       ^
/home/ab/.platformio/packages/framework-arduinoespressif32/cores/esp32/esp32-hal-spi.c:923:40: warning: initialization from incompatible pointer type [-Wincompatible-pointer-types]
                 uint8_t * last_data8 = &last_data;
                                        ^
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-timer.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-touch.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/esp32-hal-uart.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/libb64/cdecode.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/libb64/cencode.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/main.cpp.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/stdlib_noniso.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/wiring_pulse.c.o
Compiling .pio/build/esp-wrover-kit/FrameworkArduino/wiring_shift.c.o
Archiving .pio/build/esp-wrover-kit/libFrameworkArduino.a
Indexing .pio/build/esp-wrover-kit/libFrameworkArduino.a
Linking .pio/build/esp-wrover-kit/firmware.elf
Retrieving maximum program size .pio/build/esp-wrover-kit/firmware.elf
Checking size .pio/build/esp-wrover-kit/firmware.elf
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [          ]   4.1% (used 13480 bytes from 327680 bytes)
Flash: [==        ]  15.9% (used 208334 bytes from 1310720 bytes)
Building .pio/build/esp-wrover-kit/firmware.bin
esptool.py v3.0
=================================================================================== [SUCCESS] Took 4.65 seconds ===================================================================================
(base) ab@desktop:~/Documents/PlatformIO/Projects/210330-011607-arduino-blink$ pio debug --interface=gdb -x .pioinit
Reading symbols from /home/ab/Documents/PlatformIO/Projects/210330-011607-arduino-blink/.pio/build/esp-wrover-kit/firmware.elf...done.
PlatformIO Unified Debugger -> http://bit.ly/pio-debug
PlatformIO: debug_tool = esp-prog
PlatformIO: Initializing remote target...
Open On-Chip Debugger  v0.10.0-esp32-20201202 (2020-12-02-17:38)
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
adapter speed: 20000 kHz

WARNING: boards/esp32-wrover.cfg is deprecated, and may be removed in a future release.
         If your board is ESP32-WROVER-KIT, use board/esp32-wrover-kit-1.8v.cfg instead.
Info : FreeRTOS creation
Info : FreeRTOS creation
adapter speed: 5000 kHz

Info : tcl server disabled
Info : telnet server disabled
Info : clock speed 5000 kHz
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : esp32.cpu0: Detected debug stubs @ 3ffc09b0
Info : accepting 'gdb' connection from pipe
Warn : No symbols for FreeRTOS!
Info : esp32.cpu0: Target halted, PC=0x400E93EA, debug_reason=00000000
Info : Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400E93EA, debug_reason=00000000
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Auto-detected flash bank 'esp32.cpu0.flash' size 4096 KB
Info : Using flash bank 'esp32.cpu0.flash' size 4096 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.irom' size 104 KB
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : Flash mapping 0: 0x10020 -> 0x3f400020, 49 KB
Info : Flash mapping 1: 0x20018 -> 0x400d0018, 101 KB
Info : Using flash bank 'esp32.cpu0.drom' size 52 KB
Info : New GDB Connection: 1, Target esp32.cpu0, state: halted
0x400e93ea in heap_caps_match (heap=0x0, caps=1)
    at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c:54
54      /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/heap/heap_caps.c: No such file or directory.
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
** Programming Started **
** Programming Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Programming Finished **
** Programming Finished **
** Verify Started **
** Verify Started **
Info : esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
esp32.cpu0: Target halted, PC=0x40091856, debug_reason=00000001
** Verified OK **
** Verified OK **
Info : JTAG tap: esp32.cpu0 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
Info : JTAG tap: esp32.cpu1 tap/device found: 0x120034e5 (mfg: 0x272 (Tensilica), part: 0x2003, ver: 0x1)
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)
Info : esp32.cpu0: Debug controller was reset.
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Debug controller was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x500000CF, debug_reason=00000000
Info : esp32.cpu0: Core was reset.
esp32.cpu0: Core was reset.
Info : esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu0: Target halted, PC=0x40000400, debug_reason=00000000
Info : esp32.cpu1: Debug controller was reset.
Info : esp32.cpu1: Core was reset.
esp32.cpu1: Debug controller was reset.
esp32.cpu1: Core was reset.
Info : esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
esp32.cpu1: Target halted, PC=0x40000400, debug_reason=00000000
Temporary breakpoint 1 at 0x400d0c5c: file src/Blink.cpp, line 13.
PlatformIO: Initialization completed
(gdb) PlatformIO: Resume the execution to `debug_init_break = tbreak setup`
PlatformIO: More configuration options -> http://bit.ly/pio-debug
Continuing.
Note: automatically using hardware breakpoints for read-only addresses.
Info : esp32.cpu0: Target halted, PC=0x400E5B0F, debug_reason=00000000
Info : esp32.cpu0: Detected debug stubs @ 3ffc09b0
Info : Set GDB target to 'esp32.cpu0'
esp32.cpu0: Target halted, PC=0x400E5B0F, debug_reason=00000000
esp32.cpu0: Detected debug stubs @ 3ffc09b0
Set GDB target to 'esp32.cpu0'
Info : esp32.cpu1: Target halted, PC=0x400D0C5C, debug_reason=00000001
esp32.cpu1: Target halted, PC=0x400D0C5C, debug_reason=00000001
[New Thread 1073465264]
[New Thread 1073463852]
[New Thread 1073467960]
[New Thread 1073456088]
[New Thread 1073445228]
[New Thread 1073454676]
[New Thread 1073462440]
[Switching to Thread 1073447000]

Temporary breakpoint 1, setup () at src/Blink.cpp:13
13      {
(gdb) 

Edit: Oh, I get it. Read your post wrong, but did what you asked for.

I see. Debugging fully works there. It flashes the firmware, sets up breakpoints, lets the chip run, and hits the breakpoint in setup(), then drops you into the GDB shell. You can e.g. type bt for a backtrace, info registers etc.

Now why this doesn’t work in VSCode is mysterious. I’ll hopefully see that in my repro.