I want to debug a c++ app on a remote server and I want to open gdbserver via ssh and then close the ssh session immediately while the gdbserver remains open.
ssh email@example.com 'cd /remote/bin && gdbserver :3030 ./c++_app'
The above command starts the remote gdbserver but ssh remains open. It gives the correct print out:
Process ./c++_app created; pid = 3967 Listening on port 3030
But it can be closed only by giving ctrl-c or by giving
ssh firstname.lastname@example.org killall gdbserver &> /dev/null via a different ssh terminal.
In order to close the ssh session immediately , I tried the following according to this link (https://unix.stackexchange.com/questions/266571/remotely-starting-a-screen-session-through-ssh-and-closing-the-ssh-session-immed)
ssh email@example.com screen -d -m 'cd /remote/bin && gdbserver :3030 ./c++_app'
but unfortunatelly I'm getting :
Process ./c++_app created; pid = 4697 Cannot exec ./c++_app: No such file or directory. Child exited with status 127 No program to debug
I also tried with double quotes :
ssh firstname.lastname@example.org screen -d -m "cd /remote/bin && gdbserver :3030 ./c++_app"
But got the same error as before.
What I'm doing wrong here ?