Hi,
I like to contribute to a OpenWRT plugin and setup a build environment. It works fine but I have an issue with remote debugging.
I setup gdbserver and likt to connect it from VSCode. The breakpoints are working fine but I cannot use step-by-step debugging using C++ Extension or with "Native Debug"-Extension. Any ideas how to get it working? It would be easier to debug line by line even if breakpoints are working fine.
launch.json
{
"configurations": [
{
"type": "gdb",
"request": "attach",
"name": "native Debugger - Attach to gdbserver",
"executable": "/home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/usteerd",
"target": "openwrt.muc.lan:7777",
"remote": true,
"cwd": "${workspaceRoot}",
"valuesFormatting": "parseText",
"gdbpath": "/home/nils/openwrt/build_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/gdb-14.1/gdb/gdb"
},
{
"name": "GDB for OpenWRT Remote Attach",
"type": "cppdbg",
"request": "launch",
"externalConsole": false,
"stopAtEntry": true,
"program": "/home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/usteerd",
"MIMode": "gdb",
"cwd": "${workspaceFolder}",
"miDebuggerPath": "/home/nils/openwrt/build_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/gdb-14.1/gdb/gdb",
"miDebuggerServerAddress": "openwrt.muc.lan:7777",
"miDebuggerArgs": " -ex 'handle all print nostop noignore'",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
{
"type": "by-gdb",
"request": "launch",
"name": "By GDB - Launch(gdb)",
"program": "/home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/usteerd",
"cwd": "${workspaceRoot}",
"remote": {
"enabled": true,
"address": "openwrt.muc.lan:7777",
"mode": "extended-remote",
"execfile": "${fileBasenameNoExtension}"
}
}
]
}
Output from "Native Debug" Extension
Reading symbols from /home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/usteerd...
Warning: 'set target-async', an alias for the command 'set mi-async', is deprecated.
Use 'set mi-async'.
Reading /lib/libubox.so.20240329 from remote target...
warning: File transfers from remote targets can be slow. Use "set sysroot" to access files locally instead.
Reading /lib/libubus.so.20231128 from remote target...
Reading /lib/libblobmsg_json.so.20240329 from remote target...
Reading /usr/lib/libjson-c.so.5 from remote target...
Reading /usr/lib/libnl-tiny.so.1 from remote target...
Reading /lib/libgcc_s.so.1 from remote target...
2
Reading /lib/ld-musl-armhf.so.1 from remote target...
Reading /home/nils/openwrt/staging_dir/toolchain-arm_cortex-a15+neon-vfpv4_gcc-13.3.0_musl_eabi/lib/debug/.build-id/c9/17cf6fca830a355530586ac39c5f54c08f71f0.debug from remote target...
0xb6f3fe14 in ?? ()
No source file named /home/nils/usteer/ubus.c.
Breakpoint 1, usteer_dump_node (buf=0x1f450 <b>, node=0xb6ec8818) at /home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/ubus.c:313
313 blobmsg_add_u32(buf, "freq", node->freq);
Breakpoint 4, usteer_dump_node (buf=0x1f450 <b>, node=0xb6ec8818) at /home/nils/openwrt/build_dir/target-arm_cortex-a15+neon-vfpv4_musl_eabi/usteer-2024-10-13/ubus.c:316
316 blobmsg_add_u32(buf, "load", node->load);
Warning:
Cannot insert breakpoint 0.
Cannot access memory at address 0x4e244
Cheers,
Nils