microsoft / microsoft/vscode-cpptools
Unable to Start Debugging in WSL CentOS 7.9 Environment
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: Windows11 with WSL (2.4.11.0)
- WSL Distribution: CentOS 7.9
- VS Code Version: 1.98.1
- C/C++ Extension Version (cpptools): 1.22.11
- GDB version: 7.6.1
Bug Summary and Steps to Reproduce
Bug Summary:
I am unable to successfully start debugging by pressing F5 in my current setup. The debugging session does not initiate, and I am unsure how to diagnose the issue.
Steps to reproduce:
Environment Setup
I installed CentOS 7.9 as a WSL2 subsystem by downloading and extracting the archive from the following link:
https://github.com/mishamosher/CentOS-WSL/releases/tag/7.9-2211.
After ensuring that WSL2 (with Hyper-V) was enabled, I right-clicked the installer and ran it as an administrator to complete the CentOS 7 installation.
0. Creating a Non-Administrator User
I created a user named dongbox (me) using the following command:
useradd -m -G wheel -s /bin/bash dongbox && echo "dongbox:dongbox" | chpasswd
1. Switching to Aliyun Mirror for Faster Package Downloads
curl -o /etc/yum.repos.d/CentOS-Base.repo https://mirrors.aliyun.com/repo/Centos-7.repo
yum clean all && yum makecache
2. Installing GCC, G++, and GDB via YUM
sudo yum install -y gcc gcc-c++ gdb
3. Installing CMake 3.28
wget https://github.com/Kitware/CMake/releases/download/v3.28.0/cmake-3.28.0-linux-x86_64.tar.gz
tar -xvzf cmake-3.28.0-linux-x86_64.tar.gz
mv cmake-3.28.0-linux-x86_64 /opt/cmake-3.28.0
ln -s /opt/cmake-3.28.0/bin/cmake /usr/local/bin/cmake
Issue: Debugging Failure in VSCode
After setting up the environment, I connected to CentOS 7.9 via VSCode Remote - WSL and attempted to compile and debug my program. However, debugging failed, its waitting forever.
Debugger Configurations
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "(GF_CTJ) Launch",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/GF_CTJ/program/model/demo/APS_PROJECT_DEMO",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}",
"environment": [],
"externalConsole": true,
"MIMode": "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
}
],
"logging": { "engineLogging": true, "trace": true, "traceResponse": true }
}
]
}
Debugger Logs
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1754) LaunchOptions{\"name\":\"(GF_CTJ) Launch\",\"type\":\"cppdbg\",\"request\":\"launch\",\"program\":\"/home/dongbox/work/aps-projects/GF_CTJ/program/model/demo/APS_PROJECT_DEMO\",\"args\":[],\"stopAtEntry\":false,\"cwd\":\"/home/dongbox/work/aps-projects\",\"environment\":[],\"externalConsole\":true,\"MIMode\":\"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}],\"logging\":{\"engineLogging\":true,\"trace\":true,\"traceResponse\":true},\"__configurationTarget\":6,\"__sessionId\":\"47b4f490-406a-4b3c-bf3b-237cb4e1371e\"}\n"},"seq":2}
1: (1754) LaunchOptions{"name":"(GF_CTJ) Launch","type":"cppdbg","request":"launch","program":"/home/dongbox/work/aps-projects/GF_CTJ/program/model/demo/APS_PROJECT_DEMO","args":[],"stopAtEntry":false,"cwd":"/home/dongbox/work/aps-projects","environment":[],"externalConsole":true,"MIMode":"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}],"logging":{"engineLogging":true,"trace":true,"traceResponse":true},"__configurationTarget":6,"__sessionId":"47b4f490-406a-4b3c-bf3b-237cb4e1371e"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1800) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf ; cd \"/home/dongbox/work/aps-projects/GF_CTJ/program/model/demo\" ; DbgTerm=`tty` ; set -o monitor ; trap 'rm \"/tmp/Microsoft-MIEngine-In-ujrknyku.gp4\" \"/tmp/Microsoft-MIEngine-Out-4khefns3.q5x\" \"/tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf\" \"/tmp/Microsoft-MIEngine-Cmd-uyhouolm.c52\"' EXIT ; \"/usr/bin/gdb\" --interpreter=mi --tty=$DbgTerm < \"/tmp/Microsoft-MIEngine-In-ujrknyku.gp4\" > \"/tmp/Microsoft-MIEngine-Out-4khefns3.q5x\" & clear; pid=$! ; echo $pid > \"/tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf\" ; wait $pid; \n"},"seq":4}
1: (1800) DbgCmd:echo $$ > /tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf ; cd "/home/dongbox/work/aps-projects/GF_CTJ/program/model/demo" ; DbgTerm=`tty` ; set -o monitor ; trap 'rm "/tmp/Microsoft-MIEngine-In-ujrknyku.gp4" "/tmp/Microsoft-MIEngine-Out-4khefns3.q5x" "/tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf" "/tmp/Microsoft-MIEngine-Cmd-uyhouolm.c52"' EXIT ; "/usr/bin/gdb" --interpreter=mi --tty=$DbgTerm < "/tmp/Microsoft-MIEngine-In-ujrknyku.gp4" > "/tmp/Microsoft-MIEngine-Out-4khefns3.q5x" & clear; pid=$! ; echo $pid > "/tmp/Microsoft-MIEngine-Pid-ywajxroh.xrf" ; wait $pid;
--> C (runInTerminal-6): {"type":"request","command":"runInTerminal","arguments":{"kind":"external","title":"cppdbg: APS_PROJECT_DEMO","cwd":"","args":["/bin/sh","/tmp/Microsoft-MIEngine-Cmd-uyhouolm.c52"],"env":{}},"seq":6}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (1811) Wait for connection completion.\n"},"seq":8}
1: (1811) Wait for connection completion.
Other Extensions
Extensions installed on WSL: CentOS7:
donjayamanne.githistory
esbenp.prettier-vscode
github.copilot
github.copilot-chat
mhutchie.git-graph
ms-python.black-formatter
ms-python.debugpy
ms-python.isort
ms-python.python
ms-python.vscode-pylance
ms-toolsai.datawrangler
ms-toolsai.jupyter
ms-toolsai.jupyter-keymap
ms-toolsai.jupyter-renderers
ms-toolsai.vscode-jupyter-cell-tags
ms-toolsai.vscode-jupyter-slideshow
ms-vscode.cmake-tools
ms-vscode.cpptools
twxs.cmake
yy0931.vscode-sqlite3-editor
Additional Information
When I run OpenDebugAD7 manually, I get the following output:
$ ~/.vscode-server/extensions/ms-vscode.cpptools-1.22.11/debugAdapters/bin/OpenDebugAD7
waiting for v8 protocol on stdin/stdout
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 provided debugger configuration and the cpptools engine log, especially the runInTerminal request and the “Wait for connection completion” message. Compare that behavior with the manual OpenDebugAD7 output and the reported CentOS 7.9, GDB 7.6.1, and WSL setup; done means identifying why the F5 session does not start or documenting the required configuration change.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- cmake, cpp, linux
- Domain
- devtools, operating-systems
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100