Home > Net >  Remote debugging of C file in VS Code: Permission denied
Remote debugging of C file in VS Code: Permission denied

Time:07-18

I am trying to debug a c executable on a ubuntu 18.04 vm which I ssh into from vs code.

This is the launch.json:

{
    "name": "(gdb) Launch",
    "type": "cppdbg",
    "request": "launch",
    "program": "${workspaceFolder}/build/bin/exe/examples/point",
    "args": [],
    "stopAtEntry": false,
    "cwd": "${fileDirname}",
    "environment": [],
    "externalConsole": false,
    "MIMode": "gdb",
    "miDebuggerPath": "/home/vagrant/gdb",
    "setupCommands": [
        {
            "description": "Enable pretty-printing for gdb",
            "text": "-enable-pretty-printing",
            "ignoreFailures": true
        }
    ]
}

I am getting this error:

&"warning: GDB: Failed to set controlling terminal: Operation not permitted\n"
/bin/bash: /vagrant/.../point: Permission denied
/bin/bash: line 0: exec: /vagrant/.../point: cannot execute: Permission denied
[1]   Done "/home/vagrant/gdb" --interpreter=mi --tty=${DbgTerm} 0<"/tmp/Microsoft-MIEngine-In-q5crjhja.ipk" 1>"/tmp/Microsoft-MIEngine-Out-cisgbam0.mb1"

The first line isn't important I have been told, but the permission denied problem was supposed to be fixable by setting the permissions to 777 for example. ls -lah returns -rwxrwxrwx 1 vagrant vagrant 26K Jul 14 13:54 point for the specified file, so permissions should be no problem right? Has anyone encountered this and can tell me what I am missing?

I already followed this advice to run gdb as sudo.

CodePudding user response:

Wow, in my case, the problem was VirtualBox shared folders! After moving the folder it worked.

  • Related