Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to debug a remote linux binary?

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?

like image 639
eviljack Avatar asked Oct 15 '25 16:10

eviljack


1 Answers

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

like image 177
ks1322 Avatar answered Oct 17 '25 09:10

ks1322