Why can VScode not attach to my gdb server?

203 Views Asked by At

I am trying to set up remote debug for some c-code, and am testing it on a single file called BinaryTree. I have set up my launch.json as seen in this post, adding a command which is meant to solve this issue, namely set architecture i386:x86-64 which is the correct one for the server from running show architecture on it.

Here is my launch.json:

"configurations": [
    {
        "type": "gdb",
        "request": "attach",
        "name": "Attach to gdbserver",
        "executable": "BinaryTree",
        "target": "172.28.9.167:10000",
        "remote": true,
        "cwd": "${workspaceRoot}", 
        "gdbpath": "C:/MinGW/bin/gdb.exe",
        "autorun": [
            "set architecture i386:x86-64"
        ]
    }
]

However I am getting the error Failed to attach: Remote register badly formatted: T0506:0000000000000000;07:60e0ffffff7f0000;10:b032fef7ff7f0000;thread:p1299.1299;core:3; here: 00000000;07:60e0ffffff7f0000;10:b032fef7ff7f0000;thread:p1299.1299;core:3; (from target-select remote 172.28.9.167:10000)

Does anyone know what I am doing wrong?

Thanks

I tried setting the autorun option to hopefully make the architectures the same "autorun": ["set architecture i386:x86-64"]. As other posts mentioned this kind of error might be due to architectures not being the same but I'm not sure if I did this correctly as it seems to have no effect.

Attaching to the server directly from a WSL terminal and Powershell in vscode also does work however what I want is to be able to use the vscode GUI for debugging and that means I have to get the launch.json to work properly.

0

There are 0 best solutions below