microsoft / microsoft/vscode-cpptools

Slow Remote GDB Debugging Due to Excessive -stack-list-frames 0 1000 Requests

Aperta
#13,847 1 commento 3 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

bug debugger help wanted
Lingua principale
TypeScript
Stelle
6.2k
Fork
1.7k
Merge medio
14h 46m
PR unite (30g)
61

Descrizione

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

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia riproducendo il caso di debug remoto ARM e seguendo la gestione del debugger MI dell’estensione C/C++ intorno alla richiesta predefinita -stack-list-frames 0 1000. Verifica come vengono gestiti il limite del backtrace e lo stato di arresto del thread, quindi verifica che venga utilizzata una query configurabile più piccola e che le prestazioni dell’esecuzione passo-passo migliorino senza compromettere il comportamento esistente del debugger.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
cpp, typescript, vscode
Ambito
developer-experience, devtools
Tipo di issue
Bug
Difficoltà
4/5
Tempo stimato
3-5 giorni
Stato di attività
Ferma
Chiarezza
Abbastanza chiara
Idoneità per principianti
35/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.