matheuscscp matheuscscp - 1 year ago 169
Linux Question

Start process via SSH and GDB?

This question sounds very stupid to me, but if this is somehow possible it would be really helpful.

My application is crashing and I need to debug it. And I run this application in another computer, via SSH (it's an HTTP server). If I could leave a terminal running the application over GDB and SSH all the time, I'd be able to find the bugs. But I don't have a free computer to do that. What can I do? Is there a way to start GDB with

and stuff like that, so I can see GDB output (
command, for example) later?

Answer Source

A classical Unix program called screen is your friend (or its competitor tmux). It allows to keep a virtual console open across multiple logins:


starts such a session; using you can detach from that; using

screen -r

you can reconnect to it later.

However, you don't even need that; just make your program leave a core dump when it crashes; ulimit -c unlimited says "every program that crashes leaves a core dump"; you can then just open the core dump using gdb later on, and everything will be as if you ran the program inside gdb when it crashed.

gdb core.123456
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download