microsoft / microsoft/vscode-cpptools
WSL: unable to attach GDB to running process
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 6.2k
- Forks
- 1.7k
- Avg merge
- 14h 46m
- Merged PRs (30d)
- 61
Description
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
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 with the launch.json attach configuration and the generated /tmp/Microsoft-MIEngine-Cmd command, then trace how the extension invokes /usr/bin/gdb through pkexec in WSL. Reproduce the authentication and stopped-job failure using the listed VS Code, WSL, and extension versions. Done means attaching to the running application succeeds without the terminal failure.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cpp, linux, ubuntu, vscode
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100