microsoft / microsoft/vscode-cpptools
Slow Remote GDB Debugging Due to Excessive -stack-list-frames 0 1000 Requests
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
Environment
OS and version: Windows 11
VS Code: 1.103.0
C/C++ extension: 1.27.0
OS and version of remote machine: ARMv7(armhf)
GDB / LLDB version: GDB 15.2.90 (arm-none-linux-gnueabihf-gdb.exe)
Bug Summary and Steps to Reproduce
Bug Summary
When debugging a multi-threaded ARM application remotely using the C/C++ extension in VS Code, stepping operations (e.g., next) take ~7 seconds due to excessive -stack-list-frames 0 1000 requests, which take ~3245 ms per step. Despite configuring set backtrace limit 10 in launch.json, the extension issues -stack-list-frames 0 1000, causing GDB to process up to 1000 frames internally before returning only 10. Additionally, stopped-threads="all" in logs indicates all threads are paused, despite set non-stop on and set scheduler-locking step, triggering unnecessary -thread-info queries for all 10 threads. This severely impacts debugging performance on a remote ARM device (192.168.200.63:2345).
Previous attempts to optimize (e.g., set print frame-arguments none, disableVariableAutoUpdate, thread-specific breakpoints) reduced delays from ~9 seconds to ~7 seconds, but the extension’s hardcoded -stack-list-frames 0 1000 remains the primary bottleneck.
Steps to Reproduce
In this environment:
Windows host running VS Code with C/C++ extension.
Remote ARM device (armhf), a multi-threaded application with 10 threads, connected via gdbserver at 192.168.200.63:2345.
With this config:
Use the launch.json provided below.
Binary compiled with arm-none-linux-gnueabihf-gcc -g3 -O0 for full debug info.
Do:
Open VS Code and load the project
Set a breakpoint in for thread 3.
Start debugging using the “Remote Debug ARM” configuration.
Step through code using next (e.g., Debug Console command -exec-next --thread 3).
See error:
Stepping takes ~7 seconds per operation.
Debug Console and gdb.log show -stack-list-frames 0 1000 taking ~3245 ms, despite set backtrace limit 10.
Log shows stopped-threads="all", indicating all threads are paused, triggering -thread-info for all 10 threads.
Debugger Configurations
{
"version": "0.2.0",
"configurations": [
{
"name": "Remote Debug ARM",
"type": "cppdbg",
"request": "launch",
"program": "D:/y/BUILD/app.outt",
"miDebuggerPath": "D:/programs/arm-gnu-mingw-64/bin/arm-none-linux-gnueabihf-gdb.exe",
"MIMode": "gdb",
"useExtendedRemote": false,
"symbolLoadInfo": {
"loadAll": false
},
"showDisplayString": false,
"miDebuggerArgs": "-ex 'set substitute-path / ' -ex 'directory ' -ex 'set auto-solib-add off' -ex 'set non-stop on' -ex 'set scheduler-locking on' -ex 'set pagination off' -ex 'set logging on' -ex 'set logging file gdb.log'",
"targetArchitecture": "arm",
"miDebuggerServerAddress": "192.168.200.63:2345",
"stopAtEntry": false,
"externalConsole": false,
"sourceFileMap": {
// "": "${workspaceFolder}/"
},
"setupCommands": [
{ "text": "set sysroot /" },
{ "text": "skip -gfi /opt/gcc-linaro-5.5.0-2017.10-x86_64_arm-linux-gnueabihf/**" },
{ "text": "skip -gfi /home/tcwg-buildslave/**" },
{ "text": "skip -gfi /usr/include/**" },
{ "text": "set auto-load safe-path /" },
{ "text": "skip -gfi /lib/**" },
{ "text": "skip -gfi */libc/usr/include/*" },
{ "text": "skip -gfi */gcc/*/include/*" },
{ "text": "skip -gfi */buildslave/*" },
{ "text": "skip -gfi */sysdeps/*" },
{ "text": "set substitute-path /home ${workspaceFolder}/" },
{ "text": "set backtrace past-main off" },
{ "text": "set backtrace past-entry off" },
{ "text": "set backtrace limit 10" },
{ "text": "set print thread-events off" },
{ "text": "set print object off" },
{ "text": "set print pretty off" }
],
"cwd": "${workspaceFolder}/",
"logging": {
"trace": true,
"traceResponse": true,
"engineLogging": true
}
},
]
}
Debugger Logs
Cannot provide debugger logs currently
Other Extensions
No response
Additional Information
Include a way to reduce the stack query size
(39116) <-1045-stack-list-frames 0 1000
This is default . Include a way to reduce it or change it in config
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the remote ARM debugging case and tracing the C/C++ extension's MI debugger handling around the default -stack-list-frames 0 1000 request. Check how the backtrace limit and thread-stop state are handled, then verify that a configurable smaller query is used and stepping performance improves without breaking existing debugger behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, typescript, vscode
- Domain
- developer-experience, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100