Can't debug Raspberry Pi Pico with JLink EDU mini

I have simple test project:

platformio.ini:

[env:pico]
platform = raspberrypi
board = pico
framework = arduino
upload_protocol = jlink
debug_tool = jlink
debug_build_flags = -O0 -ggdb3 -g3

main.cpp:

void setup()
{
Serial.begin(115200);
}

void loop()
{
Serial.write(“hello!\n”);
delay(1000);
}

It works when I do “Upload and Monitor”, but when I start debug session it is connecting to the target correctly, but firmware doesn’t run correctly. It hits my breakpoint, but when stepping forward or continuing execution it hits nonexistent breakpoint on internal main.cpp file of arduino framework (which should be executed prior to my code - does the pico reboots?) and I lose control over debugging. Here is debug console output - debug_console - Pastebin.com

Any ideas?

Seems like an ancient issue.

Maybe try the workaround with this

Thanks! Workaround in second github issue works - basically after starting the debug I need to hit restart arrow. After that debugging works.