microsoft / microsoft/vscode-cpptools
Unable to launch debugging session in docker container
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: Ubuntu 20.04
- VS Code: 1,83.1
- C/C++ extension: v1.17.5
- OS and version of remote machine (if applicable): Ubuntu 20.04
- GDB / LLDB version: Ubuntu 9.2-0ubuntu1~20.04.1
My normal workflow is have a persistent docker container that I attach vscode to and have a multiroot workspace in. Works great.
Bug Summary and Steps to Reproduce
Bug Summary:
I recently tried to start a debugging session however I get an error that the working directory can't be found:
It appears that somehow when the value in pipeCwd is being interpreted, it's getting a hyphen and possibly a newline inserted into it causing the path which would otherwise be correct to be wrong. Using the trick here to display the workspaceFolder value, it prints the correct value in the terminal:
$ echo file = '/workspaces/react/react_gins_vectornav_plugin/src/gins.vectornav_plugin.cpp' : workspaceFolder = '/workspaces/react/react_gins_vectornav_plugin'
file = /workspaces/react/react_gins_vectornav_plugin/src/gins.vectornav_plugin.cpp : workspaceFolder = /workspaces/react/react_gins_vectornav_plugin
if I surround the workspaceFolder variable with extra characters i.e.
"pipeCwd": "zz${workspaceFolder}zz",
the error message changes (as expected, errant hyphen circled) to
if I hardcode the value i.e.
"pipeCwd": "/workspaces/react/react_gins_vectornav_plugin",
I get the same error (no change) showing the error is clearly not in the value that is provided but by someway that value is being interpreted / "cleaned up" before being used.
Debugger Configurations
My launch.json file for the applicable workspace folders is
{
"configurations": [
{
"name": "(gdb) Launch vectornav_test",
"type": "cppdbg",
"request": "launch",
"program": "${workspaceFolder}/build/Release/src/react_gins_vectornav_plugin_test",
"args": [],
"stopAtEntry": false,
"cwd": "${workspaceFolder}/build/Release/src",
"environment": [
{"name":"LD_LIBRARY_PATH","value":"/home/react/.conan2/p/b/react9c9607a86f8ee/p/lib:/home/react/.conan2/p/b/contr796d55f401d46/p/lib:/home/react/.conan2/p/b/rapto1b2a18f59cf74/p/lib:/home/react/.conan2/p/b/vnpro379639241d068/p/lib"}
],
"externalConsole": false,
"pipeTransport": {
"pipeCwd": "${workspaceFolder}",
"pipeProgram": "docker",
"pipeArgs": [
"exec",
"-i",
"tanker_dev",
"sh",
"-c"
],
"debuggerPath": "/usr/bin/gdb"
},
"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
}
]
}
]
}
Debugger Logs
I'm not even getting to the point where gdb is launched.
Other Extensions
No response
Additional Information
No response
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.json, especially the pipeTransport.pipeCwd configuration, and reproduce the failure using the persistent Docker container setup described. Trace how the VS Code C/C++ extension interprets pipeCwd before launching GDB. Done means the workspaceFolder and hardcoded paths are passed without alteration and the debugging session launches in the container.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- docker, typescript
- Domain
- devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100