📄 yolinux tutorial - gnu gdb debugger command cheat sheet.mht
字号:
<TR>
<TD vAlign=3Dtop>p/x <I>variable</I></TD>
<TD vAlign=3Dtop>Print as integer variable in hex.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/d <I>variable</I></TD>
<TD vAlign=3Dtop>Print variable as a signed =
integer.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/u <I>variable</I></TD>
<TD vAlign=3Dtop>Print variable as a un-signed =
integer.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/o <I>variable</I></TD>
<TD vAlign=3Dtop>Print variable as a octal.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/t <I>variable</I><BR>x/b =
<I>address</I><BR>x/b=20
&<I>variable</I></TD>
<TD vAlign=3Dtop>Print as integer value in binary. (1=20
byte/8bits)</TD></TR>
<TR>
<TD vAlign=3Dtop>p/c <I>variable</I></TD>
<TD vAlign=3Dtop>Print integer as character.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/f <I>variable</I></TD>
<TD vAlign=3Dtop>Print variable as floating point =
number.</TD></TR>
<TR>
<TD vAlign=3Dtop>p/a <I>variable</I></TD>
<TD vAlign=3Dtop>Print as a hex address.</TD></TR>
<TR>
<TD vAlign=3Dtop>x/w <I>address</I><BR>x/4b =
&<I>variable</I></TD>
<TD vAlign=3Dtop>Print binary representation of 4 bytes (1 =
32 bit=20
word) of memory pointed to by address.</TD></TR>
<TR bgColor=3D#c0c0c0>
<TH>GDB Modes </TH>
<TH><BR></TH></TR>
<TR>
<TD vAlign=3Dtop>set <I>gdb-option</I> <I>value</I></TD>
<TD vAlign=3Dtop>Set a GDB option</TD></TR>
<TR>
<TD vAlign=3Dtop>set logging on<BR>set logging off<BR>show=20
logging<BR>set logging file <I>log-file</I></TD>
<TD vAlign=3Dtop>Turn on/off logging. Default name of file =
is=20
<TT>gdb.txt</TT></TD></TR>
<TR>
<TD vAlign=3Dtop>set print array on<BR>set print array =
off<BR>show=20
print array</TD>
<TD vAlign=3Dtop>Default is off. Convient readable format =
for arrays=20
turned on/off.</TD></TR>
<TR>
<TD vAlign=3Dtop>set print array-indexes on<BR>set print=20
array-indexes off<BR>show print array-indexes</TD>
<TD vAlign=3Dtop>Default off. Print index of array =
elements.</TD></TR>
<TR>
<TD vAlign=3Dtop>set print pretty on<BR>set print pretty =
off<BR>show=20
print pretty</TD>
<TD vAlign=3Dtop>Format printing of C structures.</TD></TR>
<TR>
<TD vAlign=3Dtop>set print union on<BR>set print union =
off<BR>show=20
print union</TD>
<TD vAlign=3Dtop>Default is on. Print C unions.</TD></TR>
<TR>
<TD vAlign=3Dtop>set print demangle on<BR>set print demangle =
off<BR>show print demangle</TD>
<TD vAlign=3Dtop>Default on. Controls printing of C++ =
names.</TD></TR>
<TR bgColor=3D#c0c0c0>
<TH>Start and Stop </TH>
<TH><BR></TH></TR>
<TR>
<TD vAlign=3Dtop>run <I>command-line-arguments</I><BR>run =
<=20
<I>infile</I> > <I>outfile</I></TD>
<TD vAlign=3Dtop>Start program execution. The command =
<TT>break=20
main</TT> will get you started. Also allows basic I/O=20
redirection.</TD></TR>
<TR>
<TD vAlign=3Dtop>kill</TD>
<TD vAlign=3Dtop>Stopt program execution.</TD></TR>
<TR>
<TD vAlign=3Dtop>quit<BR>q</TD>
<TD vAlign=3Dtop>Exit GDB =
debugger.</TD></TR></TBODY></TABLE></DD></DL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>GDB Operation:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI>control+c: Stop execution. It can stop program anywhere, in =
your=20
source or a C library or anywhere.=20
<LI>To execute a shell command: <TT>! <I>command</I></TT> <BR>or =
<TT>shell <I>command</I></TT>=20
<LI>GDB command completion: Use TAB key <BR><TT>info bre</TT> + =
TAB will=20
complete the command resulting in <TT>info breakpoints</TT> =
<BR>Press=20
TAB twice to see all available options if more than one option =
is=20
available or type "M-?" + RETURN.=20
<LI>GDB command abreviation: <BR><TT>info bre</TT> + RETURN will =
work as=20
<TT>bre</TT> is a valid abreviation for <TT>breakpoints</TT> =
</LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Man Pages:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dar">gdb<=
/A>=20
- GNU debugger=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dld">ld</=
A>=20
- Linker=20
<LI><A=20
=
href=3D"http://node1.yo-linux.com/cgi-bin/man2html?cgi_command=3Dgcc">gcc=
/g++</A>=20
- GNU project C and C++ compiler </LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD><B><BIG>Links:</BIG></B></TD></TR></TBODY></TABLE>
<P>
<UL>
<LI><A=20
=
href=3D"http://sources.redhat.com/gdb/current/onlinedocs/gdb_toc.html">Gn=
u.org:=20
GDB manual</A>=20
<LI><A=20
=
href=3D"http://www.cs.princeton.edu/~benjasik/gdb/gdb.ps">Postscript =
file:=20
GDB: Quick reference</A> </LI></UL>
<P>
<HR>
<TABLE cellSpacing=3D0 cellPadding=3D2 width=3D"100%" border=3D0>
<TBODY>
<TR bgColor=3D#ffcc33>
<TD vAlign=3Dtop><IMG=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/book40.gif"><B><BIG>Books:=
</BIG></B></TD></TR></TBODY></TABLE>
<P>
<DL>
<DD>
<TABLE border=3D1 celpadding=3D"5">
<TBODY>
<TR>
<TD><IMG=20
=
src=3D"http://www.yolinux.com/BOOKS/1882114884.01.MZZZZZZZ.jpg"></TD>
<TD vAlign=3Dtop>"Debugging with GDB: The GNU Source-Level =
Debugger"=20
<BR>by Richard Stallman, Roland H. Pesch, Stan Shebs =
<BR>ISBN #=20
1882114884, Free Software Foundation; 9th edition (January =
1,=20
2002)=20
<P></P></TD>
<TD vAlign=3Dtop><A=20
=
href=3D"http://www.amazon.com/exec/obidos/ASIN/1882114884/yolinux-20"><IM=
G=20
alt=3DAmazon.com=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/Amazon-BuyABook88x31.gif">=
</A>=20
<BR><IMG height=3D1=20
=
src=3D"http://service.bfast.com/bfast/serve?bfmid=3D2181&sourceid=3D0=
782127371&bfpid=3D1882114884&bfmtype=3Dbook"=20
width=3D1 border=3D0 NOSAVE><A=20
=
href=3D"http://service.bfast.com/bfast/click?bfmid=3D2181&sourceid=3D=
39358384&bfpid=3D1882114884&bfmtype=3Dbook"=20
target=3D_top><IMG height=3D60=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/BarnesNobles.gif"=20
width=3D75></A> </TD></TR>
<TR>
<TD><IMG=20
=
src=3D"http://www.yolinux.com/BOOKS/0596100272.01.MZZZZZZZ.jpg"></TD>
<TD vAlign=3Dtop>"GDB Pocket Reference" <BR>by Arnold =
Robbins=20
<BR>ISBN # 0596100272, O'Reilly=20
<P></P></TD>
<TD vAlign=3Dtop><A=20
=
href=3D"http://www.amazon.com/exec/obidos/ASIN/0596100272/yolinux-20"><IM=
G=20
alt=3DAmazon.com=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/Amazon-BuyABook88x31.gif">=
</A>=20
<BR><IMG height=3D1=20
=
src=3D"http://service.bfast.com/bfast/serve?bfmid=3D2181&sourceid=3D0=
782127371&bfpid=3D0596100272&bfmtype=3Dbook"=20
width=3D1 border=3D0 NOSAVE><A=20
=
href=3D"http://service.bfast.com/bfast/click?bfmid=3D2181&sourceid=3D=
39358384&bfpid=3D0596100272&bfmtype=3Dbook"=20
target=3D_top><IMG height=3D60=20
=
src=3D"http://www.yolinux.com/TUTORIALS/images/BarnesNobles.gif"=20
width=3D75></A> </TD></TR>
<TR>
<TD><IMG=20
=
src=3D"http://www.yolinux.com/BOOKS/0735710430.01.MZZZZZZZ.jpg"></TD>
<TD vAlign=3Dtop>"Advanced Linux Programming" <BR>by Mark =
Mitchell,=20
Jeffrey Oldham, Alex Samuel, Jeffery Oldham <BR>ISBN # =
0735710430,=20
New Riders=20
<P>Good book for programmers who already know how to =
program and=20
just need to know the Linux specifics. Covers a variety of =
Linux=20
tools, libraries, API's and techniques. If you don't know =
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -