Gdbserver: Difference between revisions

Content deleted Content added
m clean up, typos fixed: developper → developer, added orphan tag using AWB
this is non-non-notable, and now less written like a how to
Line 1:
{{orphan|date=February 2010}}
 
{{dated prod|concern = non-notable and written like a how to.|month = February|day = 11|year = 2010|time = 23:55|timestamp = 20100211235555}}
<!-- Do not use the "dated prod" template directly; the above line is generated by "subst:prod|reason" -->
{{Unreferenced|date=February 2010}}
'''gdbserver''' is a computer program that allows to remotely debug with the [[GNU DebuggerDebugging|debug]] other programs. It runs asin athe command-linesystem toolwith onthe manyprogram to be debugged and allows the [[Unix-likeGNU Debugger]] systemsto connect from a different system.{{clarify}}
 
It only needs the presence of the executable on the target, while the source code staysand ina thecopy computerof usedthe bybinary thefile developerstay (within alsothe acomputer copyused ofby the binary file)developer.
 
== How It Works ==
Line 12 ⟶ 10:
# <tt>gdb</tt> is run on the host with the path and name of the executable (and the sources) on the host, and the IP address and port number to connect to the target.
 
ThisExample isfor debugging a exampleprogram ofin a commandremote tohost runcalled on the target<tt>hello_world</tt> (where "hello_world2345" is the name of the executable and "2345" the TCP port number):
<pre>
gdbserver hello_world :2345
remote$ gdbserver :2345 hello_world
Process hello_world created; pid = 2509
Listening on port 2345
</pre>
 
<pre>
From the host side, {{{gdb}}} is run in the standard way
local$ gdb -q hello_world
Reading symbols from /home/user/hello_world...done.
and then needs to connect
(gdb) target remote 192.168.0.11:2345
Remote debugging using 192.168.0.11:2345
0x002f3850 in ?? () from /lib/ld-linux.so.2
(gdb) continue
Continuing.
 
Program received signal SIGSEGV, Segmentation fault.
== See also ==
0x08048414 in main () at hello_world.c:10
10 printf("x[%d] = %g\n", i, x[i]);
(gdb)
</pre>
 
== Alternatives ==
A different technique to remotely debug programs is to use a ''remote stub''<ref>[http://davis.lbl.gov/Manuals/GDB/gdb_17.html#SEC140 Debugging with GDB]</ref>.{{clarify}}
 
The program to debug 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.
 
== See also ==
* [[GNU Debugger]]
* [[KGDB]]
 
=== ExternalNotes links ===
{{reflist}}
 
== References ==
* Andreas Zeller: <cite>Why Programs Fail: A Guide to Systematic Debugging</cite>, Morgan Kaufmann, 2005. ISBN 1-55860-866-4
 
== External links ==
* [http://www.gnu.org/software/gdb/ GDB homepage]
* [http://man-wiki.net/index.php/1:gdbserver gdbserver] [[man page]]
* [http://davis.lbl.gov/Manuals/GDB/gdb_17.html Debugging with GDB]
 
{{GNU}}
 
[[Category:DebuggersDebugging| ]]
[[Category:GNU project software|Debugger]]
[[Category:Unix programming tools]]