VSCode PIO debugger for AVR

Hi,

I jump into this post to find some help.

This is my situation:

  • Arduino Uno
  • VS Code + Platformio
  • Ubuntu OS
  • I followed the instruction to use dwire-debug and I can connect to my Arduino via dwire and command line.
  • I’m also able to program Arduino Uno using dwire-debug

but I have some troubles with the debug.

When I execute gdbserver in dwire-debug I get this output:

/opt/dwire-debug-master$ ./dwdebug device ttyUSB0, gdbserver, qr
Connected to ATmega328P on /dev/ttyUSB0 at 124899 baud.
Target ready, waiting for GDB connection.

Info : avrchip: hardware has something
Use 'target remote :4444'

What does it mean Info :

avrchip: hardware has something

However I can start a debug session from Platformio.

This is my Platformio.ini

[env:ATmega328P_dwire_gdb]
platform = atmelavr
board = ATmega328P
framework = arduino
board_build.f_cpu = 8000000L

; Debug 
debug_tool = custom
debug_port = :4444
debug_server = /home/user/.platformio/packages/toolchain-atmelavr/bin/avr-gdb
debug_init_cmds =
    set remoteaddresssize 32
    set remote hardware-watchpoint-limit 1
    target remote $DEBUG_PORT

In this scenario, I can place a break point but when I try to step to the next instruction, the program behaves as I execute a Run and also I cannot step inside a function.

Basically I cannot perform a step-by-step debug.

Is there a limitation of dwire-debug or something that doesn’t work on my system?
Because with Microchip Studio (on Windows) I can perform step-by-step debugging through dwire interface.

The other question is to program the target before start the debugging.

To do that, I added this line to my Platformio.ini

; Debug 
debug_tool = custom
debug_port = :4444
debug_server = /home/user/.platformio/packages/toolchain-atmelavr/bin/avr-gdb
debug_init_cmds =
    file "$PROG_PATH"
    load
    set remoteaddresssize 32
    set remote hardware-watchpoint-limit 1
    target remote $DEBUG_PORT

but when I start the debug I get this error:

Reading symbols from /home/user/Documents/Test_Projects/Arduino_Blink/.pio/build/ATmega328P_dwire_gdb/firmware.elf…
done.
PlatformIO Unified Debugger → Redirecting...
PlatformIO: debug_tool = custom
PlatformIO: Initializing remote target…
.pioinit:13: Error in sourced command file:

Is there something can I do to solve these problems?

Thank you!