microsoft / microsoft/vscode-cpptools
WSL: unable to attach GDB to running process
Nessuno ha ancora preso questa issue.
- Lingua principale
- TypeScript
- Stelle
- 6.2k
- Fork
- 1.7k
- Merge medio
- 14h 46m
- PR unite (30g)
- 61
Descrizione
Type: Bug
- Update WSL v2 to the latest version available (2.5.10)
- Install Ubuntu Noble
- Update packages
sudo apt update && sudo apt upgrade - Create CMake cpp project
- Create launch.json with GDB attach rule:
{
"name": "(gdb) Attach",
"type": "cppdbg",
"request": "attach",
"program": "${command:cmake.launchTargetPath}",
"MIMode": "gdb",
"miDebuggerPath": "/usr/bin/gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
},
{
"description": "Set Disassembly Flavor to Intel",
"text": "-gdb-set disassembly-flavor intel",
"ignoreFailures": true
}
]
}
- Build the app
- Run the app from the terminal
- Try to attach to the application
Expected result: Attach happens
Actual result: in the VS Code terminal appears message:
igor@UA1-WL-1096:~/dev/test-project$ /usr/bin/env /bin/sh /tmp/Microsoft-MIEngine-Cmd-i02lctjx.npx
Superuser access is required to attach to a process. Attaching as superuser can potentially harm your computer. Do you want to continue? [y/N]
After pressing y in the terminal, attach operation fails with the message:
==== AUTHENTICATING FOR org.freedesktop.policykit.exec ====
Authentication is needed to run `/usr/bin/gdb --interpreter=mi --tty=/dev/pts/8' as the super user
Authenticating as: ,,, (igor)
Password: [1] + Stopped (tty output) /usr/bin/pkexec "/usr/bin/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-0eyyvmzt.oix" 1>"/tmp/Microsoft-MIEngine-Out-avnngkqi.oju"
You have stopped jobs.
Extension version: 1.26.3
VS Code version: Code 1.103.1 (360a4e4fd251bfce169a4ddf857c7d25d1ad40da, 2025-08-12T16:25:40.542Z)
OS version: Windows_NT x64 10.0.22631
Modes:
Remote OS version: Linux x64 6.6.87.2-microsoft-standard-WSL2
System Info
| Item | Value |
|---|---|
| CPUs | AMD Ryzen 7 5800H with Radeon Graphics (16 x 3194) |
| GPU Status | 2d_canvas: enabled direct_rendering_display_compositor: disabled_off_ok gpu_compositing: enabled multiple_raster_threads: enabled_on opengl: enabled_on rasterization: enabled raw_draw: disabled_off_ok skia_graphite: disabled_off trees_in_viz: disabled_off video_decode: enabled video_encode: enabled vulkan: disabled_off webgl: enabled webgl2: enabled webgpu: enabled webnn: disabled_off |
| Load (avg) | undefined |
| Memory (System) | 31.35GB (8.58GB free) |
| Process Argv | --folder-uri=vscode-remote://wsl+Ubuntu-24.04/home/igor/dev/watchdog --remote=wsl+Ubuntu-24.04 --crash-reporter-id 85d0539b-51da-4610-82b3-3584e6edaf97 |
| Screen Reader | no |
| VM | 0% |
| Item | Value |
|---|---|
| Remote | WSL: Ubuntu-24.04 |
| OS | Linux x64 6.6.87.2-microsoft-standard-WSL2 |
| CPUs | AMD Ryzen 7 5800H with Radeon Graphics (16 x 0) |
| Memory (System) | 15.30GB (13.39GB free) |
| VM | 0% |
A/B Experiments
vsliv368cf:30146710
binariesv615:30325510
nativeloc1:31344060
dwcopilot:31170013
dwoutputs:31242946
copilot_t_ci:31333650
e5gg6876:31282496
pythoneinst12:31285622
996jf627:31283433
pythonrdcb7:31342333
usemplatestapi:31297334
747dc170:31275177
aj953862:31281341
9d2cg352:31346308
convertlamdaf:31368658
nesew2to5:31336538
agentclaude:31350858
4f60g487:31327383
nes-set-on:31351930
63221493:31336333
0927b901:31350571
ji9b5146:31348712
45650338:31358607
0cj2b977:31352657
pylancealldocsf:31367565
retryenabled:31370050
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla configurazione di attach di launch.json e dal comando generato /tmp/Microsoft-MIEngine-Cmd, quindi segui il modo in cui l’estensione invoca /usr/bin/gdb tramite pkexec in WSL. Riproduci il problema di autenticazione e l’errore del job arrestato usando le versioni elencate di VS Code, WSL e dell’estensione. Il lavoro è completato quando l’attach all’applicazione in esecuzione riesce senza l’errore del terminale.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- cpp, linux, ubuntu, vscode
- Ambito
- devtools, operating-systems
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 35/100