Skip to content

GDB Remote Attach Fails with "Linux: unexpected operator" #2473

@timedroid

Description

@timedroid

Type: Debugger

Describe the bug

  • OS and Version: Windows 7
  • VS Code Version: 1.26.1
  • C/C++ Extension Version: 0.18.1
  • Other extensions you installed (and if the issue persists after disabling them):
  • Process picket command fails due to unexpected operator

To Reproduce

"name": "(gdb)",
"type": "cppdbg",
"request": "attach",
"program": "...",
"processId":"${command:pickRemoteProcess}",
"pipeTransport": {
    "pipeCwd": "",
    "pipeProgram": "C:/Program Files/Git/usr/bin/ssh.exe",
    "pipeArgs": [
        "root@172.20.0.253"
    ],
    "debuggerPath": "/usr/bin/gdb"
},

Steps to reproduce the behavior:

  1. Try to connect to Ubuntu 16.04 using above config
  2. Get error message containing the following:
    sh: 1: [: Linux: unexpected operator
    sh: 1: [: Linux: unexpected operator

Trying to debug, it appears the following command is being executed:
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
I get the following output executing the command manually.

I believe the problem is the use of '=='. As far as I know, this depends on bash. The normal shell should use '=' instead.

Additional context
Output window contains:
Linux
sh: 1: [: Linux: unexpected operator
sh: 1: [: Linux: unexpected operator

Nothing else is logged, despite logging being enabled

Metadata

Metadata

Assignees

No one assigned

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions