Skip to content

Can not attach to remote pid if pid does not exist locally #265

Description

@andyneff

I think this is new in Version 0.9.2.

I've been working on understanding #78 and found out that using processId in your launch.json does not work on remote debugging (using gdbserver) if the pid number you use does not exist on the local machine (even though it does exist on the remote machine).

For example:

{
    "name": "C++ Attach",
    "type": "cppdbg",
    "request": "attach",
    "miDebuggerServerAddress": "myserver:6666",
    "program": "${workspaceRoot}/hello",
    "processId": "13467",
    "linux": {
        "MIMode": "gdb"
    },
    "osx": {
        "MIMode": "lldb"
    },
    "windows": {
        "MIMode": "gdb"
    }
}

Even though pid 13467 exist on myserver, it doesn't exist on my localhost, and so when I run the attach, I get

Error attach: no process with the given id found

However if I make sure that pid number exists (via this trick), I get a little further, and get a different error (which existed in v0.9.1 too)

Unable to start debugging. Attaching to process 13467 with GDB failed because of insufficient privileges with error message 'ptrace: Operation not permitted.'.

I still have to work around a lot of issues (highlighted in #78) to get remote debugging working with cpptools

End result, I can't do remote debugging by pid.

(Spoiler, my end goal is gdb debugging in a docker. This is why remote debugging is so important to me/not checking that the pid exists locally because I'm using a gdb/gdbserver in a docker)

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions