views:

484

answers:

2

Here is the situation:

I've got a linux binary that is crashing. No log files, trace files, etc. I need to be able to attach a debugger to it (I have the source locally) and track down the error.

Whats the easiest, best way to approach this problem?

A: 

It looks like gdb supports remote debugging.

I've never used it but http://davis.lbl.gov/Manuals/GDB/gdb_17.html looks like a start.

Basically you run the program under gdbserver on the target machine, and gdb connects (over TCP or serial) to the gdbserver.

Douglas Leeder
+4  A: 

Remote debugging is rather straightforward: on the target platform, launch the application with GDBserver, while specifying the host and port for listening to an incoming TCP connection:

  gdbserver HOST:PORT PROG [ARGS ...]

On the development workstation, launch the cross-target GDB:

  powerpc-7450-linux-gnu-gdb PROG

Be sure to specify the non-stripped executable. At the GDB console, type:

  target remote HOST:PORT
  break main
  continue

Remote cross-target debugging with GDB and GDBserver

ks1322