Closed Katze719 closed 1 year ago
Hi @Katze719, there are a couple different things to check.
First, make sure you're compiling with debug information included (e.g., "-g"). If you aren't, this will prevent breakpoints from being set.
Next, if that checks out, find out what the source path is in the embedded debug information for the "main" routine. To do that, you can use "nm" with the "-l" option to output line numbers. This will also output the source path as well. It's this source path you're trying to match with your path mapping.
nm -l <executable> | grep -i main
thank you for the quick answer
debug information is on via -g
the ouput for nm -l <executable> | grep -i main
is
0000000000000e94 t $x /mnt/d/testing/debugging/rpitestadv/src/main.cpp:7
00000000000010b0 t _GLOBAL__sub_I_main
0000000000001050 t _Z41__static_initialization_and_destruction_0ii /mnt/d/testing/debugging/rpitestadv/src/main.cpp:16
U __libc_start_main@GLIBC_2.34
0000000000000e94 T main /mnt/d/testing/debugging/rpitestadv/src/main.cpp:6
/mnt/d/testing/debugging/rpitestadv
equals my ${workspaceRoot}
what else could be the problem?
im confused now, using =>
"sourceFileMap": {
"${workspaceRoot}": "${workspaceRoot}"
},
fixed it for me
full file =>
{
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "launch debug",
"target": "./build/test",
"preLaunchTask": "sync_files_to_remote",
// "stopAtEntry": true,
"printCalls": true,
"showDevDebugOutput": true,
"internalConsoleOptions": "openOnSessionStart",
"cwd": "${workspaceRoot}",
"valuesFormatting": "prettyPrinters",
"ssh": {
"sudo": "true",
"host": "169.254.245.107", // ip von remote
"user": "pi",
"password": "raspberry",
"cwd": "/home/pi/rpitestadv",
"sourceFileMap": {
"${workspaceRoot}": "${workspaceRoot}"
},
"forwardX11": false,
"x11host": "localhost",
"x11port": 6000
}
}
]
}
but it is still saying file not found when reaching a breakpoint
Breakpoint 2, add (x=2, y=6) at /mnt/d/testing/debugging/rpitestadv/src/test.cpp:4
4 /mnt/d/testing/debugging/rpitestadv/src/test.cpp: No such file or directory.
im confused now, using =>
"sourceFileMap": { "${workspaceRoot}": "${workspaceRoot}" },
fixed it for me
Are you building locally and then pushing the executable and source to the raspberry pi? If so, that makes sense as the paths embedded in the debug information will be your local path. In that case, you likely don't need a source file mapping in the SSH portion at all.
but it is still saying file not found when reaching a breakpoint
Breakpoint 2, add (x=2, y=6) at /mnt/d/testing/debugging/rpitestadv/src/test.cpp:4 4 /mnt/d/testing/debugging/rpitestadv/src/test.cpp: No such file or directory.
From the previous comments above, I assume it's working fine in VSCode, but you're having the nuisance message being emitted from GDB. If that's the case, then you can try telling GDB what the mapping is on the remote side, using pathSubstitutions
.
{
"version": "0.2.0",
"configurations": [
{
"type": "gdb",
"request": "launch",
"name": "launch debug",
"target": "./build/test",
"preLaunchTask": "sync_files_to_remote",
// "stopAtEntry": true,
"printCalls": true,
"showDevDebugOutput": true,
"internalConsoleOptions": "openOnSessionStart",
"cwd": "${workspaceRoot}",
"valuesFormatting": "prettyPrinters",
"pathSubstitutions": {
"${workspaceRoot}": "/home/pi/rpitestadv"
"ssh": {
"sudo": "true",
"host": "169.254.245.107", // ip von remote
"user": "pi",
"password": "raspberry",
"cwd": "/home/pi/rpitestadv"
},
"forwardX11": false,
"x11host": "localhost",
"x11port": 6000
}
}
]
}
If you still have trouble after this, you can experiment changing the embedded path prefix in the debug information with the -fdebug-prefix-map
compilation option.
@brownts thank you for your quick and very professional help. All my problems are solved, thank you.
Are you building locally and then pushing the executable and source to the raspberry pi? If so, that makes sense as the paths embedded in the debug information will be your local path. In that case, you likely don't need a source file mapping in the SSH portion at all.
yes, i am building (cross compiling) locally and then pushing the files to the raspberry pi
If submitting a bug please make sure
gdb --version
>= 7.7.1gdb
cwd
andtarget
are properly setlldb --version
>= 3.7.1lldb-mi
cwd
andtarget
are properly setIm trying to use the breakpoints but the execution is not stopping and im getting the errors that my source files are not found. I have looked through various Issues here addressing a similiar or even the same issues but none of the solutions worked for me.
could someone help me understand my problem, please thank you
LOG =>
i can definitely find the files as you can see here =>