{"id":248,"date":"2025-02-05T17:55:58","date_gmt":"2025-02-05T09:55:58","guid":{"rendered":"https:\/\/blog.keruone.cn\/?p=248"},"modified":"2025-02-05T18:01:31","modified_gmt":"2025-02-05T10:01:31","slug":"pa0-gdb-dubug-case","status":"publish","type":"post","link":"https:\/\/blog.keruone.cn\/index.php\/2025\/02\/05\/pa0-gdb-dubug-case\/","title":{"rendered":"PA0: GDB\u8c03\u8bd5\u6848\u4f8b"},"content":{"rendered":"<h1>GDB \u7b80\u5355\u4f7f\u7528<\/h1>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.cprogramming.com\/gdb.html\">GDB\u6559\u7a0b<\/a><\/p>\n<h2>1. \u6848\u4f8b\u4ee3\u7801<\/h2>\n<pre><code class=\"language-c line-numbers line-numbers\">#include&lt;stdio.h&gt;\nint main(void)\n{\n    int x;\n    printf(\"Hello World!\\n\");\n    if(x=1)\n    {\n        printf(\"Now x is %d\\n\",x);\n        x++;\n        printf(\"Now x is %d\\n\",x);\n        x++;\n        printf(\"Now x is %d\\n\",x);\n    }\n    return 0;\n}\n<\/code><\/pre>\n<h2>2. \u7f16\u8bd1\u5e76\u8f93\u51fa\u53ef\u6267\u884c\u6587\u4ef6<\/h2>\n<p>\u6dfb\u52a0\u53c2\u6570<code>-o<\/code>\u6307\u5b9a\u8f93\u51fa\u6587\u4ef6\u540d<\/p>\n<pre><code class=\"language-bash line-numbers\"># cpp\ng++ main.cpp -o main\n# c\ngcc main.c -o main\n<\/code><\/pre>\n<p>\u7f16\u8bd1\u7ed3\u679c\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">keruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0<span class=\"katex math inline\">gcc main.c -o main\nkeruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0<\/span>\n<\/code><\/pre>\n<h2>3. \u8b66\u544a\u4e0e\u8c03\u8bd5\u53c2\u6570<\/h2>\n<p>\u6dfb\u52a0\u53c2\u6570<code>-g<\/code>\u6765\u5f00\u542f\u8c03\u8bd5<\/p>\n<pre><code class=\"language-bash line-numbers\"># cpp\ng++ main.cpp -g -Wall -Werror -o main\n# c\ngcc main.c -g -Wall -Werror -o main\n<\/code><\/pre>\n<p>\u5176\u4e2d<code>-Wall<\/code>\u662f\u5f00\u542f\u6240\u6709\u8b66\u544a<\/p>\n<blockquote><p>\n  <em>In order to compile with all warnings enabled and to produce ANSI C compatible code, I recommend using the flags<\/em><br \/>\n  <code>-Wall -ansi<\/code><\/p>\n<p>  \u8be6\u89c1<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.cprogramming.com\/gcc.html\">\u8fd9\u91cc<\/a>\n<\/p><\/blockquote>\n<p>\u7f16\u8bd1\u7ed3\u679c\uff1a<\/p>\n<h3>1. \u53ea\u6dfb\u52a0 -Wall<\/h3>\n<pre><code class=\"language-bash line-numbers\">keruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0$ gcc main.c -g -Wall -o main\nmain.c: In function \u2018main\u2019:\nmain.c:7:5: warning: suggest parentheses around assignment used as truth value [-Wparentheses]\n    7 |  if(x=1)\n      |     ^\n<\/code><\/pre>\n<h3>2. \u6dfb\u52a0 -Wall -Werror<\/h3>\n<pre><code class=\"language-bash line-numbers\">keruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0$ gcc main.c -g -Wall -Werror -o main\nmain.c: In function \u2018main\u2019:\nmain.c:7:5: error: suggest parentheses around assignment used as truth value [-Werror=parentheses]\n    7 |  if(x=1)\n      |     ^\ncc1: all warnings being treated as errors\n<\/code><\/pre>\n<ul>\n<li>\u5bf9\u6bd4\u53ef\u4ee5\u660e\u663e\u770b\u51fa\uff0c\u6dfb\u52a0 -Werror \u540e\uff0c\u7f16\u8bd1\u5931\u8d25<\/p>\n<\/li>\n<li>\n<p>\u6b64\u5916\u53ef\u4ee5\u770b\u51fa\uff0c\u6dfb\u52a0 -g \u540e\uff0c\u751f\u6210\u7684\u53ef\u6267\u884c\u6587\u4ef6\u6bd4\u4e0d\u6dfb\u52a0 -g \u5927<\/p>\n<\/li>\n<\/ul>\n<pre><code class=\"language-bash line-numbers\">keruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0<span class=\"katex math inline\">gcc main.c -g -o main_g\nkeruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0<\/span> gcc main.c -o main_o\nkeruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0$ ls -all\n\u603b\u7528\u91cf 72\ndrwxrwxr-x 2 keruone keruone  4096 2\u6708   5 16:37 .\ndrwxrwxr-x 3 keruone keruone  4096 1\u6708  24 17:11 ..\n-rwxrwxr-x 1 keruone keruone 16696 2\u6708   5 16:36 main\n-rw-rw-r-- 1 keruone keruone   127 2\u6708   5 16:28 main.c\n-rwxrwxr-x 1 keruone keruone 19216 2\u6708   5 16:37 main_g\n-rwxrwxr-x 1 keruone keruone 16696 2\u6708   5 16:37 main_o\n<\/code><\/pre>\n<h2>4. GDB\u57fa\u7840<\/h2>\n<h3>1. \u542f\u52a8GDB<\/h3>\n<pre><code class=\"language-bash line-numbers\">gdb &lt;executable name&gt;\n<\/code><\/pre>\n<p>\u6bd4\u5982\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">gdb main\n<\/code><\/pre>\n<p><strong>\u6ce8\u610f\uff0c\u5bf9\u4e8egcc\u7f16\u8bd1\u65f6\uff0c\u9700\u8981\u6dfb\u52a0\u53c2\u6570<code>-g<\/code><\/strong><br \/>\n&#8211; \u6dfb\u52a0\u53c2\u6570<code>-g<\/code>\u540e\u7684<code>gdb<\/code>\u7ed3\u679c<\/p>\n<details>\n<summary>\u8be6\u7ec6\u8f93\u51fa<\/summary>\n<pre><code>```bash\nkeruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0$ gdb main_g\nGNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2\nCopyright (C) 2020 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later &lt;http:\/\/gnu.org\/licenses\/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nType \"show copying\" and \"show warranty\" for details.\nThis GDB was configured as \"x86_64-linux-gnu\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n&lt;http:\/\/www.gnu.org\/software\/gdb\/bugs\/&gt;.\nFind the GDB manual and other documentation resources online at:\n    &lt;http:\/\/www.gnu.org\/software\/gdb\/documentation\/&gt;.\n\nFor help, type \"help\".\nType \"apropos word\" to search for commands related to \"word\"...\nReading symbols from main_g...\n(gdb) \n```\n&lt;\/details&gt;\n<\/code><\/pre>\n<ul>\n<li>\u4e0d\u6dfb\u52a0\u53c2\u6570<code>-g<\/code>\u540e\u7684<code>gdb<\/code>\u7ed3\u679c<br \/>\n<details>\n<summary>\u8be6\u7ec6\u8f93\u51fa<\/summary>\n<pre><code class=\"language-bash line-numbers\">keruone@Ubuntu20:~\/xuehao\/CS-Basics_Notes\/PA\/PA0$ gdb main_o\nGNU gdb (Ubuntu 9.2-0ubuntu1~20.04.2) 9.2\nCopyright (C) 2020 Free Software Foundation, Inc.\nLicense GPLv3+: GNU GPL version 3 or later &lt;http:\/\/gnu.org\/licenses\/gpl.html&gt;\nThis is free software: you are free to change and redistribute it.\nThere is NO WARRANTY, to the extent permitted by law.\nType \"show copying\" and \"show warranty\" for details.\nThis GDB was configured as \"x86_64-linux-gnu\".\nType \"show configuration\" for configuration details.\nFor bug reporting instructions, please see:\n&lt;http:\/\/www.gnu.org\/software\/gdb\/bugs\/&gt;.\nFind the GDB manual and other documentation resources online at:\n    &lt;http:\/\/www.gnu.org\/software\/gdb\/documentation\/&gt;.\n\nFor help, type \"help\".\nType \"apropos word\" to search for commands related to \"word\"...\nReading symbols from main_o...\n(No debugging symbols found in main_o)\n(gdb) \n<\/code><\/pre>\n<\/details>\n<\/li>\n<\/ul>\n<p>\u53ef\u4ee5\u53d1\u73b0\uff0c\u4e0d\u6dfb\u52a0\u53c2\u6570<code>-g<\/code>\u65f6\uff0c<code>gdb<\/code>\u65e0\u6cd5\u8bfb\u53d6\u7b26\u53f7\u4fe1\u606f\uff0c\u65e0\u6cd5\u8fdb\u884c\u8c03\u8bd5<\/p>\n<h3>2. break \u6dfb\u52a0\u65ad\u70b9<\/h3>\n<p>\u4ee5\u4e0a\u6587\u7684main_g\u4e3a\u4f8b\uff0c\u5728\u8fdb\u5165<code>gdb<\/code>\u540e\uff0c\u6dfb\u52a0\u65ad\u70b9<\/p>\n<pre><code class=\"language-bash line-numbers\"># \u6dfb\u52a0\u65ad\u70b9\n(gdb) break &lt;line number&gt;\n<\/code><\/pre>\n<p>\u6b64\u65f6\uff0c\u5982\u679c\u987a\u5229\u5e94\u8be5\u4f1a\u8f93\u51fa\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) break 7\nBreakpoint 1 at 0x1161: file main.c, line 7.\n<\/code><\/pre>\n<blockquote><p>\n  \u53ef\u4ee5\u770b\u5230\uff0c\u65ad\u70b9\u5df2\u7ecf\u6dfb\u52a0\u6210\u529f\uff0c\u65ad\u70b9\u7f16\u53f7\u4e3a1\uff0c\u65ad\u70b9\u4f4d\u7f6e\u4e3a0x1161\uff0c\u6587\u4ef6\u4e3amain.c\uff0c\u884c\u53f7\u4e3a7\n<\/p><\/blockquote>\n<h3>3. run \u8fd0\u884c\u7a0b\u5e8f<\/h3>\n<pre><code class=\"language-bash line-numbers\"># \u8fd0\u884c\u7a0b\u5e8f\n(gdb) run\n<\/code><\/pre>\n<p>\u6b64\u65f6\uff0c\u5982\u679c\u987a\u5229\u5e94\u8be5\u4f1a\u8f93\u51fa\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) run\nStarting program: \/home\/keruone\/xuehao\/CS-Basics_Notes\/PA\/PA0\/main_g \nHello World!\n\nBreakpoint 1, main () at main.c:7\n7       if(x=1)\n<\/code><\/pre>\n<blockquote><p>\n  \u53ef\u4ee5\u770b\u5230\uff0c\u7a0b\u5e8f\u5df2\u7ecf\u8fd0\u884c\u5230\u65ad\u70b9\u5904\uff0c\u7a0b\u5e8f\u505c\u5728\u4e86\u7b2c7\u884c\n<\/p><\/blockquote>\n<h3>4. step \u548c next \u5355\u6b65\u6267\u884c<\/h3>\n<p>step\u548cnext\u90fd\u662f\u5355\u6b65\u6267\u884c\uff0c\u533a\u522b\u5728\u4e8estep\u4f1a\u8fdb\u5165\u51fd\u6570\u5185\u90e8\uff0cnext\u4e0d\u4f1a\u8fdb\u5165\u51fd\u6570\u5185\u90e8<\/p>\n<h3>5. continue \u7ee7\u7eed\u6267\u884c<\/h3>\n<p>continue\u662f\u7ee7\u7eed\u6267\u884c\uff0c\u76f4\u5230\u4e0b\u4e00\u4e2a\u65ad\u70b9<\/p>\n<h3>6. print \u548c set \u67e5\u770b&amp;\u4fee\u6539\u53d8\u91cf\u503c<\/h3>\n<p>\u4f7f\u7528<code>print<\/code>\u547d\u4ee4\u67e5\u770b\u53d8\u91cf\u503c<\/p>\n<pre><code class=\"language-bash line-numbers\"># \u67e5\u770b\u53d8\u91cf\u503c\n(gdb) print &lt;var name to print&gt;\n<\/code><\/pre>\n<p>\u6b64\u65f6\uff0c\u5982\u679c\u987a\u5229\u5e94\u8be5\u4f1a\u8f93\u51fa\uff1a<\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) print x\n$1 = 1\n<\/code><\/pre>\n<p>\u53ef\u4ee5\u770b\u5230\uff0c\u53d8\u91cfx\u7684\u503c\u4e3a0<\/p>\n<blockquote><p>\n  <code>$<\/code> \u540e\u9762\u7684\u6570\u5b57\u662f\u5386\u53f2\u503c\u7684\u7f16\u53f7<br \/>\n  &#8211; GDB \u4f1a\u4e3a\u6bcf\u4e2a print \u547d\u4ee4\u7684\u8f93\u51fa\u7ed3\u679c\u5206\u914d\u4e00\u4e2a\u552f\u4e00\u7684\u7f16\u53f7<br \/>\n  &#8211; \u7f16\u53f7\u4ece 1 \u5f00\u59cb\u9012\u589e<br \/>\n  &#8211; \u8fd9\u4e9b\u7f16\u53f7\u524d\u9762\u52a0\u4e0a $ \u7b26\u53f7\n<\/p><\/blockquote>\n<p><strong><em>\u6ce8\u610f\uff0c\u4f60\u4e5f\u53ef\u4ee5\u5728\u6b64\u5904\u76f4\u63a5\u4f7f\u7528<code>set<\/code>\u4fee\u6539\u53d8\u91cf\u7684\u503c<\/em><\/strong><br \/>\n<strong><em>\u8fd9\u4e2a\u503c\u4f1a\u5f71\u54cd\u7a0b\u5e8f\u63a5\u4e0b\u6765\u7684\u8fd0\u884c\uff01<\/em><\/strong><\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) set x=4\n(gdb) print x\n$2 = 4\n<\/code><\/pre>\n<blockquote><p>\n  \u8fd9\u91cc\u7f16\u53f7\u589e\u52a0\u7684\u539f\u56e0\u5982\u4e0a\u8ff0\n<\/p><\/blockquote>\n<details>\n<summary>set\u5f71\u54cd\u8f93\u51fa\u793a\u4f8b<\/summary>\n<pre><code class=\"language-bash line-numbers\">(gdb) run\nStarting program: \/home\/keruone\/xuehao\/CS-Basics_Notes\/PA\/PA0\/main_g \nHello World!\n\nBreakpoint 1, main () at main.c:7\n7       if(x=1)\n(gdb) print x\n<span class=\"katex math inline\">1 = 0\n(gdb) next\n9           printf(\"Now x is %d\\n\",x);\n(gdb) next\nNow x is 1\n10          x++;\n(gdb) print x<\/span>2 = 1\n(gdb) set x = 4\n(gdb) print x\n$3 = 4\n(gdb) next\n11          printf(\"Now x is %d\\n\",x);\n(gdb) next\nNow x is 5\n12          x++;\n(gdb) \n<\/code><\/pre>\n<\/details>\n<h3>7. watch \u76d1\u89c6\u53d8\u91cf\u503c\u7684\u53d8\u5316<\/h3>\n<p>\u4f7f\u7528<code>watch<\/code>\u547d\u4ee4\u76d1\u89c6\u53d8\u91cf\u503c\u7684\u53d8\u5316<\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) run\nStarting program: \/home\/keruone\/xuehao\/CS-Basics_Notes\/PA\/PA0\/main_g \nHello World!\n\nBreakpoint 1, main () at main.c:7\n7       if(x=1)\n(gdb) watch x\nHardware watchpoint 4: x\n(gdb) continue\nContinuing.\n\nHardware watchpoint 4: x\n\nOld value = 0\nNew value = 1\nmain () at main.c:9\n9           printf(\"Now x is %d\\n\",x);\n(gdb) continue\nContinuing.\nNow x is 1\n\nHardware watchpoint 4: x\n\nOld value = 1\nNew value = 2\nmain () at main.c:11\n11          printf(\"Now x is %d\\n\",x);\n(gdb) continue\nContinuing.\nNow x is 2\n\nHardware watchpoint 4: x\n\nOld value = 2\nNew value = 3\nmain () at main.c:13\n13          printf(\"Now x is %d\\n\",x);\n(gdb) continue\nContinuing.\nNow x is 3\n\nWatchpoint 4 deleted because the program has left the block in\nwhich its expression is valid.\n__libc_start_main (main=0x555555555169 &lt;main&gt;, argc=1, argv=0x7fffffffdf18, init=&lt;optimized out&gt;, fini=&lt;optimized out&gt;, \n    rtld_fini=&lt;optimized out&gt;, stack_end=0x7fffffffdf08) at ..\/csu\/libc-start.c:342\n342 ..\/csu\/libc-start.c: \u6ca1\u6709\u90a3\u4e2a\u6587\u4ef6\u6216\u76ee\u5f55.\n(gdb) \n<\/code><\/pre>\n<ul>\n<li>\u53ef\u4ee5\u770b\u5230\uff0c\u5f53\u53d8\u91cfx\u7684\u503c\u53d1\u751f\u53d8\u5316\u65f6\uff0c\u7a0b\u5e8f\u4f1a\u505c\u6b62\u8fd0\u884c\uff0c\u5e76\u8f93\u51fa\u53d8\u91cfx\u539f\u6765\u7684\u503c\u548c\u65b0\u7684\u503c<\/li>\n<li>\u5f53\u7a0b\u5e8f\u8fd0\u884c\u7ed3\u675f\u65f6\uff0c\u76d1\u89c6\u70b9\u4f1a\u81ea\u52a8\u5220\u9664<\/li>\n<\/ul>\n<h3>8. list \u67e5\u770b\u4ee3\u7801<\/h3>\n<p>\u4f7f\u7528<code>list<\/code>\u547d\u4ee4\u67e5\u770b\u5f53\u524d\u4ee3\u7801\u524d\u540e\u517110\u884c\u4ee3\u7801<\/p>\n<pre><code class=\"language-bash line-numbers\">(gdb) list\n2   \n3   int main(void)\n4   {\n5       int x;\n6       printf(\"Hello World!\\n\");\n7       if(x=1)\n8       {\n9           printf(\"Now x is %d\\n\",x);\n10          x++;\n11          printf(\"Now x is %d\\n\",x);\n(gdb)\n<\/code><\/pre>\n<h3>9. kill \u548c quit \u7ec8\u6b62\u7a0b\u5e8f\u548c\u9000\u51faGDB<\/h3>\n<p>\u4f7f\u7528<code>kill<\/code>\u547d\u4ee4\u7ec8\u6b62\u7a0b\u5e8f<br \/>\n\u4f7f\u7528<code>quit<\/code>\u547d\u4ee4\u9000\u51faGDB<\/p>\n<h2>5. \u5feb\u6377\u952e<\/h2>\n<p>\u7edd\u5927\u591a\u6570\u547d\u4ee4\u90fd\u53ef\u4ee5\u4f7f\u7528\u7b2c\u4e00\u4e2a\u5b57\u6bcd\u4f5c\u4e3a\u5feb\u6377\u952e<\/p>\n<table>\n<thead>\n<tr>\n<th>\u547d\u4ee4<\/th>\n<th>\u5feb\u6377\u952e<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>break<\/td>\n<td>b<\/td>\n<\/tr>\n<tr>\n<td>run<\/td>\n<td>r<\/td>\n<\/tr>\n<tr>\n<td>step<\/td>\n<td>s<\/td>\n<\/tr>\n<tr>\n<td>next<\/td>\n<td>n<\/td>\n<\/tr>\n<tr>\n<td>continue<\/td>\n<td>c<\/td>\n<\/tr>\n<tr>\n<td>print<\/td>\n<td>p<\/td>\n<\/tr>\n<tr>\n<td>set<\/td>\n<td>set<\/td>\n<\/tr>\n<tr>\n<td>watch<\/td>\n<td>watch<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<h2>6. \u7ed3\u8bed<\/h2>\n<blockquote><p>\n  \u8fd9\u91cc\u5c31\u5f15\u7528<a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.cprogramming.com\/gdb.html\">\u53c2\u8003\u7f51\u9875<\/a>\u7684\u7ed3\u8bed\u4e86\n<\/p><\/blockquote>\n<p><!-- You have now seen enough to try GBD out on your own. Some important topics have not been touched upon here for the sake of simplicity, such as dealing with [segmentation faults and other kinds of crashes](https:\/\/www.cprogramming.com\/debugging\/segfaults.html) or using tools like [Valgrind](https:\/\/www.cprogramming.com\/debugging\/valgrind.html) to find memory leaks.\n\nRemember that GDB comes built in with an excellent help system. Just type help in the (gdb) prompt and you will be presented with options of what you could need help with. For details about a specific command, use the syntax\n\n```bash\nhelp &lt;command&gt;\n```\n\nAnother important point to note is the use of shortcuts (like 'q' for 'quit'). GDB lets you use shortcuts for commands when it is not ambigious.\nAfter learning about GDB, you do not have to panic the next time your program goes crazy. You have an excellent weapon in your arsenal now. --><\/p>\n<p><em>\u4f60\u73b0\u5728\u5df2\u7ecf\u4e86\u89e3\u4e86\u8db3\u591f\u7684GDB\u6765\u5c1d\u8bd5\u81ea\u5df1\u7684\u7a0b\u5e8f\u3002\u8fd9\u91cc\u6709\u4e00\u4e9b\u91cd\u8981\u7684\u4e3b\u9898\u6ca1\u6709\u88ab\u89e6\u53ca\uff0c\u4ee5\u4fdd\u6301\u7b80\u5355\uff0c\u4f8b\u5982\u5904\u7406<a class=\"wp-editor-md-post-content-link\" href=\"\">\u5206\u6bb5\u9519\u8bef\u548c\u5176\u4ed6\u7c7b\u578b\u7684\u5d29\u6e83<\/a>\u6216\u4f7f\u7528\u5de5\u5177\u5982 Valgrind \u53bb\u5bfb\u627e\u5185\u5b58\u6cc4\u6f0f\u3002<\/em><\/p>\n<p><em>\u8bb0\u4f4f\uff0cGDB \u81ea\u5e26\u4e86\u4e00\u4e2a\u4f18\u79c0\u7684\u5e2e\u52a9\u7cfb\u7edf\u3002\u5728 (gdb) \u63d0\u793a\u4e0b\uff0c\u53ea\u9700\u952e\u5165 help \u5373\u53ef\u83b7\u5f97\u9009\u9879\u3002\u6709\u5173\u7279\u5b9a\u547d\u4ee4\u7684\u8be6\u7ec6\u4fe1\u606f\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u8bed\u6cd5\uff1a<\/em><\/p>\n<pre><code class=\"language-bash line-numbers\">help &lt;command&gt;\n<\/code><\/pre>\n<p><em>\u53e6\u4e00\u4e2a\u91cd\u8981\u7684\u8981\u70b9\u662f\u4f7f\u7528\u5feb\u6377\u952e\uff08\u4f8b\u5982 &#8216;q&#8217; \u8868\u793a &#8216;quit&#8217;\uff09\u3002GDB \u8ba9\u4f60\u5728\u4e0d\u5f15\u8d77\u6b67\u4e49\u7684\u60c5\u51b5\u4e0b\u4f7f\u7528\u5feb\u6377\u952e\u3002<\/em><\/p>\n<p><em>\u5728\u5b66\u4e60\u4e86 GDB \u4e4b\u540e\uff0c\u4f60\u4e0d\u9700\u8981\u6050\u614c\u4e0b\u4e00\u6b21\u4f60\u7684\u7a0b\u5e8f\u5d29\u6e83\u4e86\u3002\u4f60\u73b0\u5728\u6709\u4e86\u4e00\u628a\u975e\u5e38\u597d\u7684\u6b66\u5668\u3002<\/em><\/p>\n","protected":false},"excerpt":{"rendered":"<p>GDB \u7b80\u5355\u4f7f\u7528 GDB\u6559\u7a0b 1. \u6848\u4f8b\u4ee3\u7801 #include&lt;stdio.h&gt; int main [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_memberships_contains_paid_content":false,"footnotes":""},"categories":[16,14,15],"tags":[],"class_list":["post-248","post","type-post","status-publish","format-standard","hentry","category-cs-basic-note","category-nju-cs","category-self-study"],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/posts\/248","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/comments?post=248"}],"version-history":[{"count":1,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/posts\/248\/revisions"}],"predecessor-version":[{"id":249,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/posts\/248\/revisions\/249"}],"wp:attachment":[{"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/media?parent=248"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/categories?post=248"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.keruone.cn\/index.php\/wp-json\/wp\/v2\/tags?post=248"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}