Issue Description
VSCode 调试 stopAtEntry 或者到最后一步报错:
无法打开“libc-start.c”: 无法读取文件'vscode-remote://ssh-remote+<IP>/build/glibc-S7xCS9/glibc-2.27/csu/libc-start.c' (Error: 无法解析不存在的文件"vscode-remote://ssh-remote+<IP>/build/glibc-S7xCS9/glibc-2.27/csu/libc-start.c")。
Root Cause
系统中没有 glibc 源码可供调试
Solution
-
安装 glibc 源码
sudo apt install glibc-source
cd /usr/src/glibc/
sudo tar -xvf glibc-2.27.tar.xz
-
在 launch.json 中添加 sourceFileMap 配置项
{
"version": "0.2.0",
"configurations": [
{
"name": "launch after cmake build",
"type": "cppdbg",
"request": "launch",
"program": "${fileDirname}/build/play",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": false,
"MIMode": "gdb",
"preLaunchTask": "CMake Build",
"miDebuggerPath": "/usr/bin/gdb",
"sourceFileMap": {"/build/glibc-S7xCS9": "/usr/src/glibc"}
}
]
}
Reference
https://blog.csdn.net/slc1112/article/details/109686361
|
请发表评论