Skip to content

The Remote attach to process command has been reversed between Linux and Darwin #11328

@rahiakil

Description

@rahiakil

Environment

  • OS and version:
  • VS Code:
  • C/C++ extension:
  • OS and version of remote machine (if applicable):
  • GDB / LLDB version:

Bug Summary and Steps to Reproduce

Bug Summary:

Run a Linux container ( any Centos/RHEL/) and then run a program there from a Mac. When the debugger tries to attach, it will fail to attach because the attach commands have been switched. in the commit a7870fc

So the Darwin command is now getting run on Linux and that is causing the debugger to not attach

See attachtoprocess.ts

    return `${outerQuote}${shPrefix}sh -c ${innerQuote}uname && if [ ${parameterBegin}uname -o${parameterEnd} = ${escapedQuote}Toybox${escapedQuote} ] ; ` +
        `then ${PsProcessParser.psToyboxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Darwin${escapedQuote} ] ; ` +
        `then ${PsProcessParser.psLinuxCommand} ; elif [ ${parameterBegin}uname${parameterEnd} = ${escapedQuote}Linux${escapedQuote} ] ; ` +
        `then ${PsProcessParser.psDarwinCommand}; fi${innerQuote}${outerQuote}`;
}

This was the PR that made this issue
a7870fc

Debugger Configurations

"configurations": [
        {
            "name": "(lldb) modlog-Attach",
            "type": "cppdbg",
            "request": "attach",
            "program": "/Users/parag.paul/snc/modlog_reader/build/modlog_reader",
            "processId": "${command:pickRemoteProcess}",
            "MIMode": "gdb",
            "pipeTransport": {
                "pipeCwd": "${workspaceRoot}",
                "pipeProgram": "/Users/parag.paul/tembo/tembo/tools/docker_exec_last_container.sh",
                "pipeArgs": [
                    "sh", 
                    "-c"
                ],
                "debuggerPath": "/usr/bin/gdb"
            }
        },

Debugger Logs

No need for logs.

Other Extensions

No response

Additional Information

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugdebuggerfixedCheck the Milestone for the release in which the fix is or will be available.regressionA bug that didn't exist in a previous release

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions