{"id":782,"date":"2017-12-11T18:27:01","date_gmt":"2017-12-11T10:27:01","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=782"},"modified":"2017-12-11T18:27:26","modified_gmt":"2017-12-11T10:27:26","slug":"%e7%94%a8gdb%e8%b0%83%e8%af%95%e7%a8%8b%e5%ba%8f%ef%bc%88%e4%ba%8c%ef%bc%89","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/782","title":{"rendered":"\u7528GDB\u8c03\u8bd5\u7a0b\u5e8f\uff08\u4e8c\uff09"},"content":{"rendered":"<div class=\"article_bar clearfix\">\n<p><strong style=\"font-family: 'Courier New';\">GDB\u7684\u547d\u4ee4\u6982\u8c8c<\/strong><\/p>\n<\/div>\n<div id=\"article_content\" class=\"article_content csdn-tracking-statistics\" data-mod=\"popu_519\" data-dsm=\"post\">\n<p><span style=\"font-family: 'Courier New';\"><strong> \u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u542f\u52a8gdb\u540e\uff0c\u5c31\u4f60\u88ab\u5e26\u5165gdb\u7684\u8c03\u8bd5\u73af\u5883\u4e2d\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528gdb\u7684\u547d\u4ee4\u5f00\u59cb\u8c03\u8bd5\u7a0b\u5e8f\u4e86\uff0cgdb\u7684\u547d\u4ee4\u53ef\u4ee5\u4f7f\u7528help\u547d\u4ee4\u6765\u67e5\u770b\uff0c\u5982\u4e0b\u6240\u793a\uff1a<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 \/home\/hchen&gt; gdb<br \/>\nGNU gdb 5.1.1<br \/>\nCopyright 2002 Free Software Foundation, Inc.<br \/>\nGDB is free software, covered by the GNU General Public License, and you are<br \/>\nwelcome to change it and\/or distribute copies of it under certain conditions.<br \/>\nType &#8220;show copying&#8221; to see the conditions.<br \/>\nThere is absolutely no warranty for GDB.\u00a0 Type &#8220;show warranty&#8221; for details.<br \/>\nThis GDB was configured as &#8220;i386-suse-linux&#8221;.<br \/>\n(gdb) help<br \/>\nList of classes of commands:<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 aliases &#8212; Aliases of other commands<br \/>\nbreakpoints &#8212; Making program stop at certain points<br \/>\ndata &#8212; Examining data<br \/>\nfiles &#8212; Specifying and examining files<br \/>\ninternals &#8212; Maintenance commands<br \/>\nobscure &#8212; Obscure features<br \/>\nrunning &#8212; Running the program<br \/>\nstack &#8212; Examining the stack<br \/>\nstatus &#8212; Status inquiries<br \/>\nsupport &#8212; Support facilities<br \/>\ntracepoints &#8212; Tracing of program execution without stopping the program<br \/>\nuser-defined &#8212; User-defined commands<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 Type &#8220;help&#8221; followed by a class name for a list of commands in that class.<br \/>\nType &#8220;help&#8221; followed by command name for full documentation.<br \/>\nCommand name abbreviations are allowed if unambiguous.<br \/>\n(gdb)<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">gdb\u7684\u547d\u4ee4\u5f88\u591a\uff0cgdb\u628a\u4e4b\u5206\u6210\u8bb8\u591a\u4e2a\u79cd\u7c7b\u3002help\u547d\u4ee4\u53ea\u662f\u4f8b\u51fagdb\u7684\u547d\u4ee4\u79cd\u7c7b\uff0c\u5982\u679c\u8981\u770b\u79cd\u7c7b\u4e2d\u7684\u547d\u4ee4\uff0c\u53ef\u4ee5\u4f7f\u7528help &lt;class&gt; \u547d\u4ee4\uff0c\u5982\uff1ahelp breakpoints\uff0c\u67e5\u770b\u8bbe\u7f6e\u65ad\u70b9\u7684\u6240\u6709\u547d\u4ee4\u3002\u4e5f\u53ef\u4ee5\u76f4\u63a5help &lt;command&gt;\u6765\u67e5\u770b\u547d\u4ee4\u7684\u5e2e\u52a9\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">gdb\u4e2d\uff0c\u8f93\u5165\u547d\u4ee4\u65f6\uff0c\u53ef\u4ee5\u4e0d\u7528\u6253\u5168\u547d\u4ee4\uff0c\u53ea\u7528\u6253\u547d\u4ee4\u7684\u524d\u51e0\u4e2a\u5b57\u7b26\u5c31\u53ef\u4ee5\u4e86\uff0c\u5f53\u7136\uff0c\u547d\u4ee4\u7684\u524d\u51e0\u4e2a\u5b57\u7b26\u5e94\u8be5\u8981\u6807\u5fd7\u7740\u4e00\u4e2a\u552f\u4e00\u7684\u547d\u4ee4\uff0c\u5728Linux\u4e0b\uff0c\u4f60\u53ef\u4ee5\u6572\u51fb\u4e24\u6b21TAB\u952e\u6765\u8865\u9f50\u547d\u4ee4\u7684\u5168\u79f0\uff0c\u5982\u679c\u6709\u91cd\u590d\u7684\uff0c\u90a3\u4e48gdb\u4f1a\u628a\u5176\u4f8b\u51fa\u6765\u3002<\/span><\/p>\n<p>\u793a\u4f8b\u4e00\uff1a\u5728\u8fdb\u5165\u51fd\u6570func\u65f6\uff0c\u8bbe\u7f6e\u4e00\u4e2a\u65ad\u70b9\u3002\u53ef\u4ee5\u6572\u5165break func\uff0c\u6216\u662f\u76f4\u63a5\u5c31\u662fb func<br \/>\n(gdb) b func<br \/>\nBreakpoint 1 at 0x8048458: file hello.c, line 10.<\/p>\n<p>\u793a\u4f8b\u4e8c\uff1a\u6572\u5165b\u6309\u4e24\u6b21TAB\u952e\uff0c\u4f60\u4f1a\u770b\u5230\u6240\u6709b\u6253\u5934\u7684\u547d\u4ee4\uff1a<br \/>\n(gdb) b<br \/>\nbacktrace\u00a0 break\u00a0\u00a0\u00a0\u00a0\u00a0 bt<br \/>\n(gdb)<\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 \u793a\u4f8b\u4e09\uff1a\u53ea\u8bb0\u5f97\u51fd\u6570\u7684\u524d\u7f00\uff0c\u53ef\u4ee5\u8fd9\u6837\uff1a<br \/>\n(gdb) b make_ &lt;\u6309TAB\u952e&gt;<br \/>\n\uff08\u518d\u6309\u4e0b\u4e00\u6b21TAB\u952e\uff0c\u4f60\u4f1a\u770b\u5230:\uff09<br \/>\nmake_a_section_from_file\u00a0\u00a0\u00a0\u00a0 make_environ<br \/>\nmake_abs_section\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make_function_type<br \/>\nmake_blockvector\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make_pointer_type<br \/>\nmake_cleanup\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make_reference_type<br \/>\nmake_command\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0\u00a0 make_symbol_completion_list<br \/>\n(gdb) b make_<br \/>\nGDB\u628a\u6240\u6709make\u5f00\u5934\u7684\u51fd\u6570\u5168\u90e8\u4f8b\u51fa\u6765\u7ed9\u4f60\u67e5\u770b\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 \u793a\u4f8b\u56db\uff1a\u8c03\u8bd5C++\u7684\u7a0b\u5e8f\u65f6\uff0c\u6709\u53ef\u4ee5\u51fd\u6570\u540d\u4e00\u6837\u3002\u5982\uff1a<br \/>\n(gdb) b &#8216;bubble( M-?<br \/>\nbubble(double,double)\u00a0\u00a0\u00a0 bubble(int,int)<br \/>\n(gdb) b &#8216;bubble(<br \/>\n\u4f60\u53ef\u4ee5\u67e5\u770b\u5230C++\u4e2d\u7684\u6240\u6709\u7684\u91cd\u8f7d\u51fd\u6570\u53ca\u53c2\u6570\u3002\uff08\u6ce8\uff1aM-?\u548c\u201c\u6309\u4e24\u6b21TAB\u952e\u201d\u662f\u4e00\u4e2a\u610f\u601d\uff09<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u8981\u9000\u51fagdb\u65f6\uff0c\u53ea\u7528\u53d1quit\u6216\u547d\u4ee4\u7b80\u79f0q\u5c31\u884c\u4e86\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>GDB\u4e2d\u8fd0\u884cUNIX\u7684shell\u7a0b\u5e8f<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u5728gdb\u73af\u5883\u4e2d\uff0c\u4f60\u53ef\u4ee5\u6267\u884cUNIX\u7684shell\u7684\u547d\u4ee4\uff0c\u4f7f\u7528gdb\u7684shell\u547d\u4ee4\u6765\u5b8c\u6210\uff1a<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 shell &lt;command string&gt;<br \/>\n\u8c03\u7528UNIX\u7684shell\u6765\u6267\u884c&lt;command string&gt;\uff0c\u73af\u5883\u53d8\u91cfSHELL\u4e2d\u5b9a\u4e49\u7684UNIX\u7684shell\u5c06\u4f1a\u88ab\u7528\u6765\u6267\u884c&lt;command string&gt;\uff0c\u5982\u679cSHELL\u6ca1\u6709\u5b9a\u4e49\uff0c\u90a3\u5c31\u4f7f\u7528UNIX\u7684\u6807\u51c6shell\uff1a\/bin\/sh\u3002\uff08\u5728Windows\u4e2d\u4f7f\u7528Command.com\u6216cmd.exe\uff09<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u8fd8\u6709\u4e00\u4e2agdb\u547d\u4ee4\u662fmake\uff1a<br \/>\nmake &lt;make-args&gt;<br \/>\n\u53ef\u4ee5\u5728gdb\u4e2d\u6267\u884cmake\u547d\u4ee4\u6765\u91cd\u65b0build\u81ea\u5df1\u7684\u7a0b\u5e8f\u3002\u8fd9\u4e2a\u547d\u4ee4\u7b49\u4ef7\u4e8e\u201cshell make &lt;make-args&gt;\u201d\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u5728GDB\u4e2d\u8fd0\u884c\u7a0b\u5e8f<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u5f53\u4ee5gdb &lt;program&gt;\u65b9\u5f0f\u542f\u52a8gdb\u540e\uff0cgdb\u4f1a\u5728PATH\u8def\u5f84\u548c\u5f53\u524d\u76ee\u5f55\u4e2d\u641c\u7d22&lt;program&gt;\u7684\u6e90\u6587\u4ef6\u3002\u5982\u8981\u786e\u8ba4gdb\u662f\u5426\u8bfb\u5230\u6e90\u6587\u4ef6\uff0c\u53ef\u4f7f\u7528l\u6216list\u547d\u4ee4\uff0c\u770b\u770bgdb\u662f\u5426\u80fd\u5217\u51fa\u6e90\u4ee3\u7801\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u5728gdb\u4e2d\uff0c\u8fd0\u884c\u7a0b\u5e8f\u4f7f\u7528r\u6216\u662frun\u547d\u4ee4\u3002\u7a0b\u5e8f\u7684\u8fd0\u884c\uff0c\u4f60\u6709\u53ef\u80fd\u9700\u8981\u8bbe\u7f6e\u4e0b\u9762\u56db\u65b9\u9762\u7684\u4e8b\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">1\u3001\u7a0b\u5e8f\u8fd0\u884c\u53c2\u6570\u3002<br \/>\nset args \u53ef\u6307\u5b9a\u8fd0\u884c\u65f6\u53c2\u6570\u3002\uff08\u5982\uff1aset args 10 20 30 40 50\uff09<br \/>\nshow args \u547d\u4ee4\u53ef\u4ee5\u67e5\u770b\u8bbe\u7f6e\u597d\u7684\u8fd0\u884c\u53c2\u6570\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">2\u3001\u8fd0\u884c\u73af\u5883\u3002<br \/>\npath &lt;dir&gt; \u53ef\u8bbe\u5b9a\u7a0b\u5e8f\u7684\u8fd0\u884c\u8def\u5f84\u3002<br \/>\nshow paths \u67e5\u770b\u7a0b\u5e8f\u7684\u8fd0\u884c\u8def\u5f84\u3002<br \/>\nset environment varname [=value] \u8bbe\u7f6e\u73af\u5883\u53d8\u91cf\u3002\u5982\uff1aset env USER=hchen<br \/>\nshow environment [varname] \u67e5\u770b\u73af\u5883\u53d8\u91cf\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">3\u3001\u5de5\u4f5c\u76ee\u5f55\u3002<br \/>\ncd &lt;dir&gt; \u76f8\u5f53\u4e8eshell\u7684cd\u547d\u4ee4\u3002<br \/>\npwd \u663e\u793a\u5f53\u524d\u7684\u6240\u5728\u76ee\u5f55\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">4\u3001\u7a0b\u5e8f\u7684\u8f93\u5165\u8f93\u51fa\u3002<br \/>\ninfo terminal \u663e\u793a\u4f60\u7a0b\u5e8f\u7528\u5230\u7684\u7ec8\u7aef\u7684\u6a21\u5f0f\u3002<br \/>\n\u4f7f\u7528\u91cd\u5b9a\u5411\u63a7\u5236\u7a0b\u5e8f\u8f93\u51fa\u3002\u5982\uff1arun &gt; outfile<br \/>\ntty\u547d\u4ee4\u53ef\u4ee5\u6307\u5199\u8f93\u5165\u8f93\u51fa\u7684\u7ec8\u7aef\u8bbe\u5907\u3002\u5982\uff1atty \/dev\/ttyb<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u8c03\u8bd5\u5df2\u8fd0\u884c\u7684\u7a0b\u5e8f<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u4e24\u79cd\u65b9\u6cd5\uff1a<br \/>\n1\u3001\u5728UNIX\u4e0b\u7528ps\u67e5\u770b\u6b63\u5728\u8fd0\u884c\u7684\u7a0b\u5e8f\u7684PID\uff08\u8fdb\u7a0bID\uff09\uff0c\u7136\u540e\u7528gdb &lt;program&gt; PID\u683c\u5f0f\u6302\u63a5\u6b63\u5728\u8fd0\u884c\u7684\u7a0b\u5e8f\u3002<br \/>\n2\u3001\u5148\u7528gdb &lt;program&gt;\u5173\u8054\u4e0a\u6e90\u4ee3\u7801\uff0c\u5e76\u8fdb\u884cgdb\uff0c\u5728gdb\u4e2d\u7528attach\u547d\u4ee4\u6765\u6302\u63a5\u8fdb\u7a0b\u7684PID\u3002\u5e76\u7528detach\u6765\u53d6\u6d88\u6302\u63a5\u7684\u8fdb\u7a0b\u3002<\/span><\/p>\n<p>&nbsp;<\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u6682\u505c \/ \u6062\u590d\u7a0b\u5e8f\u8fd0\u884c<br \/>\n\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014\u2014<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u8c03\u8bd5\u7a0b\u5e8f\u4e2d\uff0c\u6682\u505c\u7a0b\u5e8f\u8fd0\u884c\u662f\u5fc5\u987b\u7684\uff0cGDB\u53ef\u4ee5\u65b9\u4fbf\u5730\u6682\u505c\u7a0b\u5e8f\u7684\u8fd0\u884c\u3002\u4f60\u53ef\u4ee5\u8bbe\u7f6e\u7a0b\u5e8f\u7684\u5728\u54ea\u884c\u505c\u4f4f\uff0c\u5728\u4ec0\u4e48\u6761\u4ef6\u4e0b\u505c\u4f4f\uff0c\u5728\u6536\u5230\u4ec0\u4e48\u4fe1\u53f7\u65f6\u505c\u5f80\u7b49\u7b49\u3002\u4ee5\u4fbf\u4e8e\u4f60\u67e5\u770b\u8fd0\u884c\u65f6\u7684\u53d8\u91cf\uff0c\u4ee5\u53ca\u8fd0\u884c\u65f6\u7684\u6d41\u7a0b\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u5f53\u8fdb\u7a0b\u88abgdb\u505c\u4f4f\u65f6\uff0c\u4f60\u53ef\u4ee5\u4f7f\u7528info program \u6765\u67e5\u770b\u7a0b\u5e8f\u7684\u662f\u5426\u5728\u8fd0\u884c\uff0c\u8fdb\u7a0b\u53f7\uff0c\u88ab\u6682\u505c\u7684\u539f\u56e0\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u5728gdb\u4e2d\uff0c\u6211\u4eec\u53ef\u4ee5\u6709\u4ee5\u4e0b\u51e0\u79cd\u6682\u505c\u65b9\u5f0f\uff1a\u65ad\u70b9\uff08BreakPoint\uff09\u3001\u89c2\u5bdf\u70b9\uff08WatchPoint\uff09\u3001\u6355\u6349\u70b9\uff08CatchPoint\uff09\u3001\u4fe1\u53f7\uff08Signals\uff09\u3001\u7ebf\u7a0b\u505c\u6b62\uff08Thread Stops\uff09\u3002\u5982\u679c\u8981\u6062\u590d\u7a0b\u5e8f\u8fd0\u884c\uff0c\u53ef\u4ee5\u4f7f\u7528c\u6216\u662fcontinue\u547d\u4ee4\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u4e00\u3001\u8bbe\u7f6e\u65ad\u70b9\uff08BreakPoint\uff09<\/strong><\/span><\/p>\n<p>\u6211\u4eec\u7528break\u547d\u4ee4\u6765\u8bbe\u7f6e\u65ad\u70b9\u3002\u6b63\u9762\u6709\u51e0\u70b9\u8bbe\u7f6e\u65ad\u70b9\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>break &lt;function&gt;<br \/>\n\u5728\u8fdb\u5165\u6307\u5b9a\u51fd\u6570\u65f6\u505c\u4f4f\u3002C++\u4e2d\u53ef\u4ee5\u4f7f\u7528class::function\u6216function(type,type)\u683c\u5f0f\u6765\u6307\u5b9a\u51fd\u6570\u540d\u3002<\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break &lt;linenum&gt;<br \/>\n\u5728\u6307\u5b9a\u884c\u53f7\u505c\u4f4f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break +offset<br \/>\nbreak -offset<br \/>\n\u5728\u5f53\u524d\u884c\u53f7\u7684\u524d\u9762\u6216\u540e\u9762\u7684offset\u884c\u505c\u4f4f\u3002offiset\u4e3a\u81ea\u7136\u6570\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break filename:linenum<br \/>\n\u5728\u6e90\u6587\u4ef6filename\u7684linenum\u884c\u5904\u505c\u4f4f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break filename:function<br \/>\n\u5728\u6e90\u6587\u4ef6filename\u7684function\u51fd\u6570\u7684\u5165\u53e3\u5904\u505c\u4f4f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break *address<br \/>\n\u5728\u7a0b\u5e8f\u8fd0\u884c\u7684\u5185\u5b58\u5730\u5740\u5904\u505c\u4f4f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break<br \/>\nbreak\u547d\u4ee4\u6ca1\u6709\u53c2\u6570\u65f6\uff0c\u8868\u793a\u5728\u4e0b\u4e00\u6761\u6307\u4ee4\u5904\u505c\u4f4f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 break &#8230; if &lt;condition&gt;<br \/>\n&#8230;\u53ef\u4ee5\u662f\u4e0a\u8ff0\u7684\u53c2\u6570\uff0ccondition\u8868\u793a\u6761\u4ef6\uff0c\u5728\u6761\u4ef6\u6210\u7acb\u65f6\u505c\u4f4f\u3002\u6bd4\u5982\u5728\u5faa\u73af\u5883\u4f53\u4e2d\uff0c\u53ef\u4ee5\u8bbe\u7f6ebreak if i=100\uff0c\u8868\u793a\u5f53i\u4e3a100\u65f6\u505c\u4f4f\u7a0b\u5e8f\u3002<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 \u67e5\u770b\u65ad\u70b9\u65f6\uff0c\u53ef\u4f7f\u7528info\u547d\u4ee4\uff0c\u5982\u4e0b\u6240\u793a\uff1a\uff08\u6ce8\uff1an\u8868\u793a\u65ad\u70b9\u53f7\uff09<br \/>\ninfo breakpoints [n]<br \/>\ninfo break [n]<br \/>\n<\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u4e8c\u3001\u8bbe\u7f6e\u89c2\u5bdf\u70b9\uff08WatchPoint\uff09<\/strong><\/span><\/p>\n<p>\u89c2\u5bdf\u70b9\u4e00\u822c\u6765\u89c2\u5bdf\u67d0\u4e2a\u8868\u8fbe\u5f0f\uff08\u53d8\u91cf\u4e5f\u662f\u4e00\u79cd\u8868\u8fbe\u5f0f\uff09\u7684\u503c\u662f\u5426\u6709\u53d8\u5316\u4e86\uff0c\u5982\u679c\u6709\u53d8\u5316\uff0c\u9a6c\u4e0a\u505c\u4f4f\u7a0b\u5e8f\u3002\u6211\u4eec\u6709\u4e0b\u9762\u7684\u51e0\u79cd\u65b9\u6cd5\u6765\u8bbe\u7f6e\u89c2\u5bdf\u70b9\uff1a<\/p>\n<p>watch &lt;expr&gt;<br \/>\n\u4e3a\u8868\u8fbe\u5f0f\uff08\u53d8\u91cf\uff09expr\u8bbe\u7f6e\u4e00\u4e2a\u89c2\u5bdf\u70b9\u3002\u4e00\u91cf\u8868\u8fbe\u5f0f\u503c\u6709\u53d8\u5316\u65f6\uff0c\u9a6c\u4e0a\u505c\u4f4f\u7a0b\u5e8f\u3002<\/p>\n<p>rwatch &lt;expr&gt;<br \/>\n\u5f53\u8868\u8fbe\u5f0f\uff08\u53d8\u91cf\uff09expr\u88ab\u8bfb\u65f6\uff0c\u505c\u4f4f\u7a0b\u5e8f\u3002<\/p>\n<p>awatch &lt;expr&gt;<br \/>\n\u5f53\u8868\u8fbe\u5f0f\uff08\u53d8\u91cf\uff09\u7684\u503c\u88ab\u8bfb\u6216\u88ab\u5199\u65f6\uff0c\u505c\u4f4f\u7a0b\u5e8f\u3002<\/p>\n<p>info watchpoints<br \/>\n\u5217\u51fa\u5f53\u524d\u6240\u8bbe\u7f6e\u4e86\u7684\u6240\u6709\u89c2\u5bdf\u70b9\u3002<\/p>\n<p><span style=\"font-family: 'Courier New';\"><strong>\u4e09\u3001\u8bbe\u7f6e\u6355\u6349\u70b9\uff08CatchPoint\uff09<\/strong><\/span><\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 \u4f60\u53ef\u8bbe\u7f6e\u6355\u6349\u70b9\u6765\u8865\u6349\u7a0b\u5e8f\u8fd0\u884c\u65f6\u7684\u4e00\u4e9b\u4e8b\u4ef6\u3002\u5982\uff1a\u8f7d\u5165\u5171\u4eab\u5e93\uff08\u52a8\u6001\u94fe\u63a5\u5e93\uff09\u6216\u662fC++\u7684\u5f02\u5e38\u3002\u8bbe\u7f6e\u6355\u6349\u70b9\u7684\u683c\u5f0f\u4e3a\uff1a<\/span><\/p>\n<p>catch &lt;event&gt;<br \/>\n\u5f53event\u53d1\u751f\u65f6\uff0c\u505c\u4f4f\u7a0b\u5e8f\u3002event\u53ef\u4ee5\u662f\u4e0b\u9762\u7684\u5185\u5bb9\uff1a<br \/>\n1\u3001throw \u4e00\u4e2aC++\u629b\u51fa\u7684\u5f02\u5e38\u3002\uff08throw\u4e3a\u5173\u952e\u5b57\uff09<br \/>\n2\u3001catch \u4e00\u4e2aC++\u6355\u6349\u5230\u7684\u5f02\u5e38\u3002\uff08catch\u4e3a\u5173\u952e\u5b57\uff09<br \/>\n3\u3001exec \u8c03\u7528\u7cfb\u7edf\u8c03\u7528exec\u65f6\u3002\uff08exec\u4e3a\u5173\u952e\u5b57\uff0c\u76ee\u524d\u6b64\u529f\u80fd\u53ea\u5728HP-UX\u4e0b\u6709\u7528\uff09<br \/>\n4\u3001fork \u8c03\u7528\u7cfb\u7edf\u8c03\u7528fork\u65f6\u3002\uff08fork\u4e3a\u5173\u952e\u5b57\uff0c\u76ee\u524d\u6b64\u529f\u80fd\u53ea\u5728HP-UX\u4e0b\u6709\u7528\uff09<br \/>\n5\u3001vfork \u8c03\u7528\u7cfb\u7edf\u8c03\u7528vfork\u65f6\u3002\uff08vfork\u4e3a\u5173\u952e\u5b57\uff0c\u76ee\u524d\u6b64\u529f\u80fd\u53ea\u5728HP-UX\u4e0b\u6709\u7528\uff09<br \/>\n6\u3001load \u6216 load &lt;libname&gt; \u8f7d\u5165\u5171\u4eab\u5e93\uff08\u52a8\u6001\u94fe\u63a5\u5e93\uff09\u65f6\u3002\uff08load\u4e3a\u5173\u952e\u5b57\uff0c\u76ee\u524d\u6b64\u529f\u80fd\u53ea\u5728HP-UX\u4e0b\u6709\u7528\uff09<br \/>\n7\u3001unload \u6216 unload &lt;libname&gt; \u5378\u8f7d\u5171\u4eab\u5e93\uff08\u52a8\u6001\u94fe\u63a5\u5e93\uff09\u65f6\u3002\uff08unload\u4e3a\u5173\u952e\u5b57\uff0c\u76ee\u524d\u6b64\u529f\u80fd\u53ea\u5728HP-UX\u4e0b\u6709\u7528\uff09<\/p>\n<p><span style=\"font-family: 'Courier New';\">\u00a0\u00a0\u00a0 tcatch &lt;event&gt;<br \/>\n\u53ea\u8bbe\u7f6e\u4e00\u6b21\u6355\u6349\u70b9\uff0c\u5f53\u7a0b\u5e8f\u505c\u4f4f\u4ee5\u540e\uff0c\u5e94\u70b9\u88ab\u81ea\u52a8\u5220\u9664\u3002<\/span><\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>GDB\u7684\u547d\u4ee4\u6982\u8c8c \u2014\u2014\u2014\u2014\u2014\u2014\u2014 \u542f\u52a8g<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"colormag_page_container_layout":"default_layout","colormag_page_sidebar_layout":"default_layout","footnotes":""},"categories":[],"tags":[117],"class_list":["post-782","post","type-post","status-publish","format-standard","hentry","tag-01-linux"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/782","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/comments?post=782"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/782\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=782"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=782"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=782"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}