How do I optimize VS Code library debug symbol loading?

5 hours ago 1
ARTICLE AD BOX

As of today after updating my Ubuntu OS, VS Code takes forever to start debugging. It used to be only slow the first time you'd debug in the session, then the next time you'd debug it'd be faster. Now, it takes 12 sec to start debugging every time. It always takes long loading these (fund in the Debug Console):

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.

I even tried it with a hello world .cpp file and it still makes no difference.

This is the launch.json file I am using:

{ "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 just compiles the code using make. It finishes almost immediately. I will include it here too, but it shouldn't be worth looking into.

{ "version": "2.0.0", "tasks": [ { "label": "build", "type": "shell", "command": "make", "args": [ "build" ], "group": { "kind": "build", "isDefault": true }, "problemMatcher": [ "$gcc" ] }, ...

Below are the commands I am using to compile and link my code:

// 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

Does anyone run into this and was able to fix this? Is this even fixable?

Read Entire Article