Skip to content

Cannot attach docker container for debugging #3227

@adashen

Description

@adashen

Type: Debugger

  • OS and Version: windows
  • VS Code Version: 1.30.0
  • C/C++ Extension Version: 0.21.0
  • Other extensions you installed (and if the issue persists after disabling them):
  • A clear and concise description of what the bug is.

To Reproduce
Please include a code sample and launch.json configuration.
{
"name": "C++ Attach in hello_gdb container",
"type": "cppdbg",
"request": "attach",
"program": "/hello.out",
"processId": "${command:pickRemoteProcess}",
"pipeTransport": {
"pipeCwd": "${workspaceRoot}",
"pipeProgram": "docker",
"pipeArgs": [
"exec",
"-i",
"hello_gdb",
"sh",
"-c"
],
"debuggerPath": "/usr/bin/gdb"
},

Steps to reproduce the behavior:

  1. Build a simple docker container image for cpp project. Start the container.
  2. Start the debugger to attach to the process.
  3. See error
    Command failed: "docker" "exec" "-i" "hello_gdb" "sh" "-c" 'sh -c 'uname && if [ $(uname) = "Linux" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= ; elif [ $(uname) = "Darwin" ] ; then ps axww -o pid=,comm=aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa,args= -c; fi''
    $(uname) was unexpected at this time.

Additional context
It seems the process picker script has some problem. I tried to use the remote process picker from csharp extension (use cshap debugger attach configuration), it could list the process. And I think the problem is instead of using "sh -c" to run the script, it should be "sh -s" instead.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions