<s>
The	O
GNU	B-Language
Debugger	I-Language
(	O
GDB	B-Language
)	O
is	O
a	O
portable	B-Architecture
debugger	B-Application
that	O
runs	O
on	O
many	O
Unix-like	B-Operating_System
systems	I-Operating_System
and	O
works	O
for	O
many	O
programming	O
languages	O
,	O
including	O
Ada	B-Language
,	O
C	B-Language
,	O
C++	B-Language
,	O
Objective-C	B-Language
,	O
Free	B-Operating_System
Pascal	I-Operating_System
,	O
Fortran	B-Application
,	O
Go	B-Application
,	O
and	O
partially	O
others	O
.	O
</s>
<s>
GDB	B-Language
was	O
first	O
written	O
by	O
Richard	O
Stallman	O
in	O
1986	O
as	O
part	O
of	O
his	O
GNU	B-Operating_System
system	I-Operating_System
,	O
after	O
his	O
GNU	B-Application
Emacs	I-Application
was	O
"	O
reasonably	O
stable	O
"	O
.	O
</s>
<s>
GDB	B-Language
is	O
free	B-Application
software	I-Application
released	O
under	O
the	O
GNU	B-License
General	I-License
Public	I-License
License	I-License
(	O
GPL	B-License
)	O
.	O
</s>
<s>
It	O
was	O
modeled	O
after	O
the	O
DBX	B-Application
debugger	I-Application
,	O
which	O
came	O
with	O
Berkeley	B-Operating_System
Unix	I-Operating_System
distributions	O
.	O
</s>
<s>
Now	O
it	O
is	O
maintained	O
by	O
the	O
GDB	B-Language
Steering	O
Committee	O
which	O
is	O
appointed	O
by	O
the	B-Operating_System
Free	I-Operating_System
Software	I-Operating_System
Foundation	I-Operating_System
.	O
</s>
<s>
GDB	B-Language
offers	O
extensive	O
facilities	O
for	O
tracing	O
and	O
altering	O
the	O
execution	O
of	O
computer	B-Application
programs	I-Application
.	O
</s>
<s>
GDB	B-Language
target	O
processors	O
(	O
as	O
of	O
2003	O
)	O
include	O
:	O
Alpha	B-Device
,	O
ARM	B-Architecture
,	O
AVR	B-Architecture
,	O
H8/300	B-Device
,	O
Altera	O
Nios/Nios	O
II	O
,	O
System/370	B-Device
,	O
System	B-Device
390	I-Device
,	O
X86	B-Operating_System
and	O
its	O
64-bit	O
extension	O
X86-64	B-Device
,	O
IA-64	B-General_Concept
"	O
Itanium	B-General_Concept
"	O
,	O
Motorola	B-Device
68000	I-Device
,	O
MIPS	B-Device
,	O
PA-RISC	B-Device
,	O
PowerPC	B-Architecture
,	O
SuperH	O
,	O
SPARC	B-Architecture
,	O
and	O
VAX	B-Device
.	O
</s>
<s>
Lesser-known	O
target	O
processors	O
supported	O
in	O
the	O
standard	O
release	O
have	O
included	O
A29K	B-General_Concept
,	O
ARC	B-Application
,	O
ETRAX	B-Device
CRIS	I-Device
,	O
D10V	O
,	O
D30V	O
,	O
FR-30	O
,	O
FR-V	B-General_Concept
,	O
Intel	B-General_Concept
i960	I-General_Concept
,	O
68HC11	B-Device
,	O
Motorola	B-Architecture
88000	I-Architecture
,	O
MCORE	B-Device
,	O
MN10200	O
,	O
MN10300	B-General_Concept
,	O
NS32K	B-Device
,	O
Stormy16	O
,	O
and	O
Z8000	B-Device
.	O
</s>
<s>
GDB	B-Language
has	O
compiled-in	O
simulators	B-Application
for	O
even	O
lesser-known	O
target	O
processors	O
such	O
like	O
M32R	B-Device
or	O
V850	B-Device
.	O
</s>
<s>
GDB	B-Language
is	O
still	O
actively	O
being	O
developed	O
.	O
</s>
<s>
As	O
of	O
version	O
7.0	O
new	O
features	O
include	O
support	O
for	O
Python	B-Language
scripting	O
and	O
as	O
of	O
version	O
7.8	O
GNU	B-Application
Guile	I-Application
scripting	O
as	O
well	O
.	O
</s>
<s>
GDB	B-Language
offers	O
a	O
"	O
remote	O
"	O
mode	O
often	O
used	O
when	O
debugging	O
embedded	O
systems	O
.	O
</s>
<s>
Remote	O
operation	O
is	O
when	O
GDB	B-Language
runs	O
on	O
one	O
machine	O
and	O
the	O
program	O
being	O
debugged	O
runs	O
on	O
another	O
.	O
</s>
<s>
GDB	B-Language
can	O
communicate	O
to	O
the	O
remote	O
"	O
stub	O
"	O
that	O
understands	O
GDB	B-Language
protocol	O
through	O
a	O
serial	O
device	O
or	O
TCP/IP	O
.	O
</s>
<s>
A	O
stub	O
program	O
can	O
be	O
created	O
by	O
linking	O
to	O
the	O
appropriate	O
stub	O
files	O
provided	O
with	O
GDB	B-Language
,	O
which	O
implement	O
the	O
target	O
side	O
of	O
the	O
communication	O
protocol	O
.	O
</s>
<s>
Alternatively	O
,	O
gdbserver	B-Application
can	O
be	O
used	O
to	O
remotely	O
debug	O
the	O
program	O
without	O
needing	O
to	O
change	O
it	O
in	O
any	O
way	O
.	O
</s>
<s>
The	O
same	O
mode	O
is	O
also	O
used	O
by	O
KGDB	B-Application
for	O
debugging	O
a	O
running	O
Linux	B-Operating_System
kernel	I-Operating_System
on	O
the	O
source	O
level	O
with	O
gdb	B-Language
.	O
</s>
<s>
With	O
KGDB	B-Application
,	O
kernel	B-Operating_System
developers	O
can	O
debug	O
a	O
kernel	B-Operating_System
in	O
much	O
the	O
same	O
way	O
as	O
they	O
debug	O
application	O
programs	O
.	O
</s>
<s>
It	O
makes	O
it	O
possible	O
to	O
place	O
breakpoints	O
in	O
kernel	B-Operating_System
code	O
,	O
step	O
through	O
the	O
code	O
,	O
and	O
observe	O
variables	O
.	O
</s>
<s>
KGDB	B-Application
requires	O
an	O
additional	O
machine	O
which	O
is	O
connected	O
to	O
the	O
machine	O
to	O
be	O
debugged	O
using	O
a	O
serial	O
cable	O
or	O
Ethernet	O
.	O
</s>
<s>
On	O
FreeBSD	B-Operating_System
,	O
it	O
is	O
also	O
possible	O
to	O
debug	O
using	O
FireWire	B-Protocol
direct	B-General_Concept
memory	I-General_Concept
access	I-General_Concept
(	O
DMA	O
)	O
.	O
</s>
<s>
The	O
debugger	B-Application
does	O
not	O
contain	O
its	O
own	O
graphical	B-Application
user	I-Application
interface	I-Application
,	O
and	O
defaults	O
to	O
a	O
command-line	B-Application
interface	I-Application
,	O
although	O
it	O
does	O
contain	O
a	O
text	B-Application
user	I-Application
interface	I-Application
.	O
</s>
<s>
Several	O
front-ends	O
have	O
been	O
built	O
for	O
it	O
,	O
such	O
as	O
UltraGDB	O
,	O
Xxgdb	O
,	O
Data	B-Application
Display	I-Application
Debugger	I-Application
(	O
DDD	B-Application
)	O
,	O
Nemiver	B-Language
,	O
KDbg	O
,	O
the	O
Xcode	B-Operating_System
debugger	B-Application
,	O
GDBtk/Insight	O
,	O
Seer	O
,	O
and	O
HP	O
Wildebeest	O
Debugger	B-Application
GUI	B-Application
(	O
WDB	O
GUI	B-Application
)	O
.	O
</s>
<s>
IDEs	O
such	O
as	O
Codelite	B-Language
,	O
Code::Blocks	B-Language
,	O
Dev-C	B-Protocol
++	I-Protocol
,	O
Geany	B-Language
,	O
GNAT	B-Application
Programming	I-Application
Studio	I-Application
(	O
GPS	O
)	O
,	O
KDevelop	B-Language
,	O
Qt	B-Language
Creator	I-Language
,	O
Lazarus	B-Language
,	O
MonoDevelop	B-Language
,	O
Eclipse	O
,	O
NetBeans	B-Application
,	O
and	O
Visual	B-Application
Studio	I-Application
can	O
interface	O
with	O
GDB	B-Language
.	O
</s>
<s>
GNU	B-Application
Emacs	I-Application
has	O
a	O
"	O
GUD	O
mode	O
"	O
and	O
tools	O
for	O
Vim	B-Application
exist	O
(	O
e.g.	O
</s>
<s>
These	O
offer	O
facilities	O
similar	O
to	O
debuggers	B-Application
found	O
in	O
IDEs	O
.	O
</s>
<s>
Some	O
other	O
debugging	B-Application
tools	I-Application
have	O
been	O
designed	O
to	O
work	O
with	O
GDB	B-Language
,	O
such	O
as	O
memory	B-Error_Name
leak	I-Error_Name
detectors	O
.	O
</s>
<s>
GDB	B-Language
uses	O
a	O
system	O
call	O
named	O
ptrace	B-Operating_System
(	O
the	O
name	O
is	O
an	O
abbreviation	O
of	O
"	O
process	O
trace	O
"	O
)	O
to	O
observe	O
and	O
control	O
the	O
execution	O
of	O
another	O
process	O
,	O
and	O
examine	O
and	O
change	O
the	O
process	O
's	O
memory	O
and	O
register	O
.	O
</s>
<s>
A	O
list	O
of	O
common	O
gdb	B-Language
commands	O
and	O
corresponding	O
ptrace	B-Operating_System
calls	O
are	O
listed	O
below	O
:	O
</s>
<s>
Consider	O
the	O
following	O
source-code	O
written	O
in	O
C	B-Language
:	O
</s>
<s>
Using	O
the	O
GCC	B-Application
compiler	I-Application
on	O
Linux	B-Application
,	O
the	O
code	O
above	O
must	O
be	O
compiled	B-Language
using	O
the	O
-g	O
flag	O
in	O
order	O
to	O
include	O
appropriate	O
debug	O
information	O
on	O
the	O
binary	O
generated	O
,	O
thus	O
making	O
it	O
possible	O
to	O
inspect	O
it	O
using	O
GDB	B-Language
.	O
</s>
<s>
Assuming	O
that	O
the	O
file	O
containing	O
the	O
code	O
above	O
is	O
named	O
example.c	O
,	O
the	O
command	O
for	O
the	O
compilation	B-Language
could	O
be	O
:	O
</s>
<s>
Since	O
the	O
example	O
code	O
,	O
when	O
executed	O
,	O
generates	O
a	O
segmentation	B-Error_Name
fault	I-Error_Name
,	O
GDB	B-Language
can	O
be	O
used	O
to	O
inspect	O
the	O
problem	O
.	O
</s>
<s>
Recompiling	O
and	O
running	O
the	O
executable	O
again	O
inside	O
GDB	B-Language
now	O
gives	O
a	O
correct	O
result	O
:	O
</s>
<s>
Copyright	O
(	O
C	B-Language
)	O
2011	O
Free	B-Operating_System
Software	I-Operating_System
Foundation	I-Operating_System
,	I-Operating_System
Inc	I-Operating_System
.	I-Operating_System
</s>
<s>
This	O
is	O
free	B-Application
software	I-Application
:	O
you	O
are	O
free	O
to	O
change	O
and	O
redistribute	O
it	O
.	O
</s>
<s>
This	O
GDB	B-Language
was	O
configured	O
as	O
"	O
x86_64-redhat-linux-gnu	O
"	O
.	O
</s>
<s>
xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx1	O
...	O
</s>
<s>
GDB	B-Language
prints	O
the	O
output	O
of	O
printf	O
in	O
the	O
screen	O
,	O
and	O
then	O
informs	O
the	O
user	O
that	O
the	O
program	O
exited	O
normally	O
.	O
</s>
