7.2.1 avr-gdb Debug
With debug support enabled you can use avr-gdb to debug the code used in the simulator. Use the configuration window to choose between MDB (MPLABX) or GDB to debug AVR microcontrollers.
Use avr-gdb with the .elf file as the parameter:
avr-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 eclipse IDE with Sloeber Arduino plugin.
It is also possible to debug using platformIO in VSCode, just add the configuration lines below in the project’s platformio.ini file:
build_type = debug upload_port = /dev/tnt2 debug_tool = custom debug_port = localhost:1234 debug_build_flags = -O0 -ggdb3 -g3
Compile, and upload the code to PICSimLab before starting Debug.