7.4.1 ESP32-gdb Debug

With debug support enabled you can use xtensa-esp32-elf-gdb to debug the code used in the simulator.

Use xtensa-esp32-elf-gdb with the .elf file as the parameter:

 xtensa-esp32-elf-gdb compiled_file.elf
 

and the command below to connect (1234 is the default port):

 target remote localhost:1234
 

Graphic debug mode can be made using platformIO in VSCode, just add the configuration lines below in the project’s platformio.ini file:

upload_port = /dev/tnt2
build_type = debug
debug_tool = custom
debug_port = localhost:1234
debug_build_flags = -O0 -ggdb3 -g3
debug_init_break = tbreak setup
debug_init_cmds =
  define pio_reset_halt_target
      monitor system_reset
  end
  define pio_reset_run_target
      monitor system_reset
  end
  target extended-remote $DEBUG_PORT
  pio_reset_halt_target
  $INIT_BREAK

Compile, and upload the code to PICSimLab before starting Debug.