VSCode 无法打开 libc-start.c
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
本文作者:Zijian/TENG(微信公众号:好记性如烂笔头),转载请注明原文链接:https://www.cnblogs.com/tengzijian/p/vscode-cannot-find-libc-start-c.html