'''gdbserver''' is a computer program that allowsmakes it possible to remotely [[Debugging|debug]] other programs<ref>[http://ftp.gnu.org/old-gnu/Manuals/gdb-5.1.1/html_node/gdb_130.html GDB Manual]</ref>. ItRunning runs inon the same system withas the program to be debugged, andit allows the [[GNU Debugger]] to connect from aanother differentsystem; that is, only the executable{{what}} needs to be resident on the target system, while the source code{{what}} and a copy of the binary file{{what}} reside on the developer’s local computer.
It only needs the presence of the executable on the target, while the source code and a copy of the binary file stay in the computer used by the developer.
== How It Works ==
# <code>gdbserver</code> is launched on the target system, with the arguments: #* The path and namefilename of the executable to debugbe debugged, and #* aA port number (TCP or UDP). #:It then listens for connections on the port.
# <code>gdb</code> is run on the host, with the arguments: #* The path and namefilename of the executable{{what}} (and theany sources{{what}}) on the host, and #* theThe IP address and port number toneeded connectfor connection to the target system.
Example for debugging a program in a remote host called <code>hello_world</code> on a remote host ("2345" is the TCP port number):
<pre>
remote$ gdbserver :2345 hello_world
Line 33 ⟶ 36:
== Alternatives ==
A differentAnother technique tofor remotelydebugging debugprograms programsremotely is to use a ''remote stub''<ref>[http://davis.lbl.gov/Manuals/GDB/gdb_17.html#SEC140 Debugging with GDB]</ref>.{{Clarify|date=February 2010}}
TheIn this case, the program to debugbe debugged is linked with a few special-purpose subroutines that implement the GDB remote serial protocol. The file containing these subroutines is called a debugging stub.