gdbµ÷ÊÔ³£ÓÃÏÂÁî gdbµ÷ÊÔ¹¤¾ßµÄʹÓÃ
ÒÔÏÂÊÇ gdb µÄ³£ÓÃÏÂÁÉó²éÏÂÁlist£ºÏÔʾԴ´úÂëbreak£ºÉèÖöϵãnext£ºÌø¹ýº¯ÊýÖ´ÐÐÏÂÒ»ÐдúÂëstep£º½øÈ뺯ÊýÖ´ÐÐÏÂÒ»ÐдúÂëprint£ºÊä³ö±äÁ¿»ò±í´ïʽµÄÖµ¿ØÖÆÏÂÁrun£ºÔËÐгÌÐòcontinue£º´Ó¶Ïµã¼ÌÐøÔËÐгÌÐòstep in£º½øÈ뺯ÊýÖ´ÐÐÏÂÒ»ÐдúÂëstep out£º´Óº¯Êý·µ»Øfinish£ºÔËÐе½º¯Êýĩβ¼ì²éÏÂÁdisassemble£º·´»ã±àÖ¸Áîinfo£ºÏÔʾ³ÌÐòÐÅÏ¢watch£º¼àÊÓ±äÁ¿»ò±í´ïʽbacktrace£ºÏÔʾŲÓöÑ
gdb µ÷ÊÔ³£ÓÃÏÂÁî
gdb£¨GNU µ÷ÊÔÆ÷£©ÊÇÒ»¸öÇ¿Ê¢µÄ¹¤¾ß£¬ÓÃÓÚµ÷ÊÔ C/C++ ³ÌÐò¡£ÒÔÏÂÊÇ gdb ÖÐһЩ×î³£ÓõÄÏÂÁ
Éó²éÏÂÁî
list£ºÏÔʾĿ½ñÎļþÖеÄÔ´´úÂë¡£
break£ºÔÚ¸ø¶¨µÄÐлòº¯ÊýÉÏÉèÖöϵ㡣
next£ºÖ´ÐÐÏÂÒ»ÐдúÂë¶øÎÞÐè½øÈ뺯Êý¡£
step£ºÖ´ÐÐÏÂÒ»ÐдúÂë²¢½øÈëÈκκ¯Êý¡£
print£º´òÓ¡±äÁ¿»ò±í´ïʽµÄÖµ¡£
¿ØÖÆÏÂÁî
run£ºÔËÐгÌÐò¡£
continue£º¼ÌÐø´ÓÖÐÖ¹µãÔËÐгÌÐò¡£
step in£ºÖ´ÐÐÏÂÒ»ÐдúÂë²¢½øÈëÈκκ¯Êý¡£
step out£º´ÓÄ¿½ñº¯Êý·µ»Ø¡£
finish£ºÔËÐÐÖ±µ½Ä¿½ñº¯ÊýµÄĩβ¡£
¼ì²éÏÂÁî
disassemble£º·´»ã±àÖ¸Áî¡£
info£ºÏÔʾÓйسÌÐòµÄÐÅÏ¢£¬Èç±äÁ¿Öµ¡¢º¯ÊýŲÓõȡ£
watch£º¼à¿Ø±äÁ¿»ò±í´ïʽµÄÖµ¡£
backtrace£ºÏÔʾŲÓÿÍÕ»¡£
inspect£ºÏêϸÉó²é±äÁ¿»ò±í´ïʽµÄÖµ¡£
ÉèÖÃÏÂÁî
set£ºÉèÖõ÷ÊÔÑ¡ÏÈç¶Ïµã¡¢¼àÊÓµãµÈ¡£
unset£º×÷·ÏÏÈÇ°ÉèÖõÄÑ¡Ïî¡£
ʾÀý
ÏÂÃæÊÇÒ»¸öʾÀý£¬Õ¹Ê¾ÁËÔõÑùʹÓÃһЩ×î³£¼ûµÄ gdb ÏÂÁ
(gdb) break main (gdb) run (gdb) step (gdb) print x (gdb) continue (gdb) finish (gdb) quit
µÇ¼ºó¸´ÖÆ
´ËʾÀý½«ÉèÖÃÒ»¸ö main º¯ÊýµÄ¶Ïµã£¬ÔËÐгÌÐò£¬Ö´ÐÐÒ»ÐдúÂ룬´òÓ¡±äÁ¿ x µÄÖµ£¬¼ÌÐøÖ´ÐУ¬ÔËÐÐÍê main º¯Êý£¬È»ÍËÈ´³ö gdb µ÷ÊÔÆ÷¡£
ÒÔÉϾÍÊÇgdbµ÷ÊÔ³£ÓÃÏÂÁî gdbµ÷ÊÔ¹¤¾ßµÄʹÓõÄÏêϸÄÚÈÝ£¬¸ü¶àÇë¹Ø×¢±¾ÍøÄÚÆäËüÏà¹ØÎÄÕ£¡