Debugging remotely via ssh login

Paul Koning pkoning@equallogic.com
Fri Dec 22 17:53:00 GMT 2006


>>>>> "Eli" == Eli Zaretskii <eliz@gnu.org> writes:

 >> From: Andreas Schwab <schwab@suse.de> Cc: gdb@sources.redhat.com
 >> Date: Fri, 22 Dec 2006 11:24:18 +0100
 >> 
 >> ppmoore <polomora@gmail.com> writes:
 >> 
 >> > I was reading in the manual about remote debugging, but the
 >> scenarios > described included debugging via a serial comm line or
 >> via a tcp port on the > remote machine. Is it possible to debug
 >> where the only access is remote > logon using ssh?
 >> 
 >> You can forward a port via the ssh connection to the remote host,
 >> and then use this port for the debugging session.

 Eli> If someone describes this scenario in enough detail (a bit more
 Eli> than the above single sentence), I'd more than happy to add it
 Eli> to the manual.

Something like this:

On the target system:
$ gdbserver localhost:6666 prog args

On the host:
$ ssh -L 6666:target:6666
<log in>

then in another shell:
gdb prog
(gdb) target remote localhost:6666

The same approach works if the target debug is done via something
other than gdbserver, so long as it listens on a TCP port that is
willing to accept local (to the target) connections.

You can avoid the interaction in the ssh invocation by suitable
switches and authenticating mechanism; see the manpage for details.
But the above is the basic approach.

    paul



More information about the Gdb mailing list