Ubuntu更新后如何优化VS Code的库调试符号加载速度?
Ubuntu更新后VS Code调试C++启动耗时过长问题
更新Ubuntu系统后,VS Code启动C++调试的耗时变得极长。原本仅在会话首次调试时较慢,后续调试会提速,但现在每次启动调试都需要12秒。调试控制台显示,耗时主要用于加载以下系统库的符号:
Loaded '/usr/lib/x86_64-linux-gnu/libstdc++.so.6'. Symbols loaded. Loaded '/usr/lib/x86_64-linux-gnu/libc.so.6'. Symbols loaded. Loaded '/usr/lib/x86_64-linux-gnu/libm.so.6'. Symbols loaded. Loaded '/usr/lib/x86_64-linux-gnu/libgcc_s.so.1'. Symbols loaded.
即使是调试Hello World级别的.cpp文件,情况也没有改善。
我的launch.json文件如下:
{ "version": "0.2.0", "configurations": [ { "name": "Debug", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/x86_64-linux-gnu/Debug/sandbox_cpp.bin", "args": [], "stopAtEntry": false, "cwd": "${workspaceFolder}", "environment": [], "externalConsole": false, "MIMode": "gdb", "miDebuggerPath": "/usr/bin/gdb", "setupCommands": [ { "description": "Enable pretty printing", "text": "-enable-pretty-printing", "ignoreFailures": true } ], "preLaunchTask": "build", } ] }
preLaunchTask仅通过make编译代码,耗时极短,对应的tasks.json内容如下:
{ "version": "2.0.0", "tasks": [ { "label": "build", "type": "shell", "command": "make", "args": [ "build" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": [ "$gcc" ] }, ... ] }
我的代码编译和链接命令如下:
// Compile command x86_64-linux-gnu-g++-15 -std=c++26 -Wall -Wextra -O0 -g -MMD -MP -c "main.cpp" -o "intermidiary/x86_64-linux-gnu/Debug/main.o" // Linking command x86_64-linux-gnu-g++-15 -Wall -Wextra -O0 -g intermidiary/x86_64-linux-gnu/Debug/main.o -Wl,-rpath,'$ORIGIN' -o build/x86_64-linux-gnu/Debug/sandbox_cpp.bin
有没有人遇到过该问题并成功解决?此问题是否可修复?
内容的提问来源于stack exchange,提问作者Christopher Barrios Agosto
相关产品推荐
相关产品推荐

