microsoft / microsoft/vscode-cpptools
Launch started the debug server successfully, but timeout and return a failed to initialize error
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: linux manjaro 24.2.1
- VS Code: 1.98.2
- C/C++ extension:
1.23.6 - OS and version of remote machine (if applicable): ubuntu 22.04 executed in a docker
- GDB / LLDB version: 14.2
I use an SDK for yocto 5.0, Qemu version is 8.2.2
Bug Summary and Steps to Reproduce
Bug Summary:
cpp tools waits for qemu to start and timeout without trying to connect to it.
Steps to reproduce:
I start the debug.
Error message is displayed Unable to start debugging. Debug server process failed to initialize.
Debugger Configurations
`{
"name": "Launch with QEMU",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/my_binary",
"cwd": "${workspaceFolder}",
"MIMode": "gdb",
"miDebuggerPath": "aarch64-poky-linux-gdb",
"miDebuggerServerAddress": "localhost:1333",
"stopAtEntry": false,
"externalConsole": false,
"debugServerPath": "qemu-aarch64",
"debugServerArgs": "-L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 ${workspaceFolder}/build/my_binary",
"filterStderr": true,
"filterStdout": true,
}`
Debugger Logs
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (86) LaunchOptions{\"name\":\"Launch with QEMU\",\"type\":\"cppdbg\",\"request\":\"launch\",\"program\":\"/workspaces/firmware/build/my_binary\",\"cwd\":\"/workspaces/firmware/mpu\",\"MIMode\":\"gdb\",\"miDebuggerPath\":\"aarch64-poky-linux-gdb\",\"miDebuggerServerAddress\":\"localhost:1333\",\"stopAtEntry\":false,\"externalConsole\":false,\"debugServerPath\":\"qemu-aarch64\",\"debugServerArgs\":\"-L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 /workspaces/firmware/build/my_binary\",\"filterStderr\":true,\"filterStdout\":true,\"logging\":{\"engineLogging\":true,\"trace\":true,\"traceResponse\":true},\"__configurationTarget\":5,\"__sessionId\":\"7e78a92d-2e2d-49b0-9467-d407ccc367ed\"}\n"},"seq":2}
1: (86) LaunchOptions{"name":"Launch with QEMU","type":"cppdbg","request":"launch","program":"/workspaces/firmware/build/my_binary","cwd":"/workspaces/firmware/mpu","MIMode":"gdb","miDebuggerPath":"aarch64-poky-linux-gdb","miDebuggerServerAddress":"localhost:1333","stopAtEntry":false,"externalConsole":false,"debugServerPath":"qemu-aarch64","debugServerArgs":"-L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 /workspaces/firmware/build/my_binary","filterStderr":true,"filterStdout":true,"logging":{"engineLogging":true,"trace":true,"traceResponse":true},"__configurationTarget":5,"__sessionId":"7e78a92d-2e2d-49b0-9467-d407ccc367ed"}
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (144) Starting: \"qemu-aarch64\" -L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 /workspaces/firmware/build/my_binary\n"},"seq":4}
1: (144) Starting: "qemu-aarch64" -L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 /workspaces/firmware/build/my_binary
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (10185) <-logout\n"},"seq":6}
1: (10185) <-logout
--> E (output): {"type":"event","event":"output","body":{"category":"console","output":"1: (10193) Send Event AD7MessageEvent\n"},"seq":8}
1: (10193) Send Event AD7MessageEvent
--> E (output): {"type":"event","event":"output","body":{"category":"telemetry","output":"VS/Diagnostics/Debugger/Launch","data":{"VS.Diagnostics.Debugger.ImplementationName":"Microsoft.MIDebugEngine","VS.Diagnostics.Debugger.EngineVersion":"17.12.21003.1","VS.Diagnostics.Debugger.HostVersion":"17.12.21003.1","VS.Diagnostics.Debugger.AdapterId":"cppdbg","VS.Diagnostics.Debugger.Launch.ErrorCode":1005,"VS.Diagnostics.Debugger.Launch.IsError":true}},"seq":10}
--> R (launch-2): {"type":"response","request_seq":2,"success":false,"command":"launch","message":"Unable to start debugging. Debug server process failed to initialize.","body":{"error":{"id":1005,"format":"Unable to start debugging. Debug server process failed to initialize."}},"seq":12}
Other Extensions
No response
Additional Information
If I increase the serverLaunchTimeout, the error take more time to occurs. Indicating that the timeout is reached. During the timeout, I verified and quemu was running as expected.
Before trying to do it in one action, I had this configuration:
{ "name": "Launch with QEMU", "type": "cppdbg", "request": "launch", "program": "${workspaceFolder}/build/my_binary", "cwd": "${workspaceFolder}", "MIMode": "gdb", "miDebuggerPath": "aarch64-poky-linux-gdb", "miDebuggerServerAddress": "localhost:1333", "stopAtEntry": false, }
And I started manually qemu with:
qemu-aarch64 -L /opt/summitsom-wayland/5.0.3/sysroots/armv8a-poky-linux -g 1333 /workspace/firmware/build/my_binary
Then when launching the debug, it worked perfectly.
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 launch configuration, focusing on debugServerPath, debugServerArgs, miDebuggerServerAddress, and serverLaunchTimeout, then reproduce the difference between manual QEMU startup and the one-action launch. Use the debugger logs to trace the launch and connection sequence; done means the configured QEMU server is detected and debugging starts without the initialization timeout.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- linux, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 45/100