{"id":1786,"date":"2018-12-29T09:11:16","date_gmt":"2018-12-29T01:11:16","guid":{"rendered":"https:\/\/www.yusian.com\/blog\/?p=1786"},"modified":"2020-12-02T09:12:02","modified_gmt":"2020-12-02T01:12:02","slug":"gdb%e7%9a%84%e5%9f%ba%e6%9c%ac%e4%bd%bf%e7%94%a8","status":"publish","type":"post","link":"https:\/\/www.yusian.com\/blog\/cpp\/2018\/12\/29\/0911161786.html","title":{"rendered":"gdb\u7684\u57fa\u672c\u4f7f\u7528"},"content":{"rendered":"<h4>1\u3001\u524d\u671f\u51c6\u5907<\/h4>\n<ul>\n<li>gcc\u7f16\u8bd1\u7684\u65f6\u5019\u8981\u5e26\u53c2\u6570-g\uff0c\u7f16\u8bd1\u51fa\u6765\u7684\u53ef\u6267\u884c\u6587\u4ef6\u624d\u5e26\u65ad\u70b9\u4fe1\u606f\uff0c\u5426\u5219\u65e0\u6cd5\u65ad\u70b9\uff1b\n<ul>\n<li>gcc -g xxx.c -o xxx.out \/\/ xxx.c\u4e3a\u6e90\u6587\u4ef6\uff0c.out\u4e3a\u8f93\u51fa\u53ef\u6267\u884c\u6587\u4ef6\u540d\u5b57<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<h4>2\u3001\u51e0\u6761\u547d\u4ee4<\/h4>\n<ul>\n<li>list\n<ul>\n<li>\u7b80\u5199\u4e3al<\/li>\n<li>\u67e5\u770b\u6e90\u4ee3\u7801\uff0c\u9ed8\u8ba4\u4e3amain\u51fd\u6570\u6587\u4ef6<\/li>\n<li>l xxx.c:20\uff0c\u5219\u662f\u67e5\u770bxxx.c\u7684\u7b2c20\u884c\u4ee3\u7801<\/li>\n<li>l xxx.c:main\uff0c\u67e5\u770bxxx.c\u7684main\u51fd\u6570<\/li>\n<li>\u518d\u6b21\u6267\u884c\u5219\u662f\u663e\u793a\u540e\u7eed\u7684\u5185\u5bb9<\/li>\n<\/ul>\n<\/li>\n<li>break  n\n<ul>\n<li>n\u4e3a\u4ee3\u7801\u884c\u53f7\uff0c\u5982break 37\uff0c\u53ef\u7b80\u5199\u4e3ab 37<\/li>\n<li>\u4e5f\u53ef\u4ee5\u8ddf\u6761\u4ef6\uff0c\u5982\uff1abreak 37 if xxx=xxx\uff1b<\/li>\n<li>\u884c\u53f7\u4e5f\u53ef\u4ee5\u7528\u51fd\u6570\u540d\u6765\u4ee3\u66ff\uff0c\u5982break main\uff0c\u5728main\u51fd\u6570\u5904\u6253\u65ad\u70b9<\/li>\n<\/ul>\n<\/li>\n<li>delete\n<ul>\n<li>delete n\u4e3abreak\u7f16\u53f7\uff0c\u53ef\u5220\u9664\u65ad\u70b9<\/li>\n<\/ul>\n<\/li>\n<li>info breakpoints\n<ul>\n<li>\u67e5\u770b\u5f53\u524d\u6240\u6709\u65ad\u70b9\uff0c\u53ef\u7b80\u5199\u4e3ai b<\/li>\n<\/ul>\n<\/li>\n<li>start\n<ul>\n<li>\u6267\u884c\u7a0b\u5e8f\uff0c\u53ea\u6267\u884c\u4e00\u6b65<\/li>\n<\/ul>\n<\/li>\n<li>run\n<ul>\n<li>\u6267\u884c\u7a0b\u5e8f<\/li>\n<\/ul>\n<\/li>\n<li>next\n<ul>\n<li>\u5355\u6b65\u6267\u884c\u4e0b\u4e00\u884c\u4ee3\u7801\uff0c\u7b80\u5199\u4e3an<\/li>\n<\/ul>\n<\/li>\n<li>step\n<ul>\n<li>\u5355\u6b65\u6267\u884c\u9012\u8fdb\uff0c\u5982\u679c\u662f\u51fd\u6570\u5219\u8fdb\u5165\u51fd\u6570\u4f53\u5185\u90e8\uff0c\u5982\u679c\u6ca1\u6709\u5219\u4e0b\u4e00\u6b65<\/li>\n<\/ul>\n<\/li>\n<li>finish\n<ul>\n<li>\u8df3\u51fa\u5f53\u524d\u7684\u51fd\u6570\u4f53\uff0c\u5982\u679c\u5904\u5728\u5faa\u73af\u4f53\u4e2d\u65e0\u6cd5\u8df3\u51fa<\/li>\n<\/ul>\n<\/li>\n<li>continue\n<ul>\n<li>\u7b80\u5199\u4e3ac\uff0c\u7ee7\u7eed\u6267\u884c\uff0c\u5982\u679c\u6709\u65ad\u70b9\u5219\u4e00\u76f4\u5230\u4e0b\u4e00\u4e2a\u65ad\u70b9\u4f4d\u7f6e<\/li>\n<\/ul>\n<\/li>\n<li>print\n<ul>\n<li>\u7b80\u5199\u4e3ap\uff0c\u67e5\u770b\u53d8\u91cf\u503c\uff0cp a\uff0c\u67e5\u770b\u53d8\u91cfa\u7684\u503c<\/li>\n<\/ul>\n<\/li>\n<li>set var\n<ul>\n<li>\u8bbe\u7f6e\u53d8\u91cf\u503c\uff0c\u5982set var a = 12;<\/li>\n<\/ul>\n<\/li>\n<li>ptype\n<ul>\n<li>\u67e5\u770b\u53d8\u91cf\u7c7b\u578b<\/li>\n<\/ul>\n<\/li>\n<li>display\n<ul>\n<li>\u8ffd\u8e2a\u53d8\u91cf\u503c\uff0cdisplay a\uff0c\u5219\u4e3a\u663e\u793a\u53d8\u91cfa\u7684\u503c\uff0c\u6bcf\u6b21\u6267\u884c\u90fd\u4f1a\u663e\u793a<\/li>\n<li>\u53ef\u91cd\u590d\u6dfb\u52a0\uff0c\u663e\u793a\u8ffd\u8e2a\u7684\u5168\u90e8\u503c<\/li>\n<\/ul>\n<\/li>\n<li>undisplay\n<ul>\n<li>\u53d6\u6d88\u8ddf\u8e2a\u53d8\u91cf\uff0cdisplay n\uff0cn\u4e3a\u8ffd\u8e2a\u53d8\u91cf\u7684\u7f16\u53f7<\/li>\n<\/ul>\n<\/li>\n<li>u\n<ul>\n<li>\u8df3\u51fa\u5355\u6b21\u5faa\u73af\uff0c\u7c7b\u4f3c\u5faa\u73af\u4e2d\u7684contiune<\/li>\n<\/ul>\n<\/li>\n<li>quit\n<ul>\n<li>\u9000\u51fagdb\u8c03\u8bd5<\/li>\n<\/ul>\n<\/li>\n<li>set follow-fork-mode\n<ul>\n<li>parent \u2014> \u8ddf\u8e2a\u7236\u8fdb\u7a0b<\/li>\n<li>child \u2014> \u8ddf\u8e2a\u5b50\u8fdb\u7a0b<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>1\u3001\u524d\u671f\u51c6\u5907 gcc\u7f16\u8bd1\u7684\u65f6\u5019\u8981\u5e26\u53c2\u6570-g\uff0c\u7f16\u8bd1\u51fa\u6765\u7684\u53ef\u6267\u884c\u6587\u4ef6\u624d\u5e26\u65ad\u70b9\u4fe1\u606f\uff0c\u5426\u5219\u65e0\u6cd5\u65ad\u70b9\uff1b gcc -g xxx.c -o xxx.out \/\/ xxx.c\u4e3a\u6e90\u6587\u4ef6\uff0c.out\u4e3a\u8f93\u51fa\u53ef\u6267\u884c\u6587\u4ef6\u540d\u5b57 2\u3001\u51e0\u6761\u547d\u4ee4 list \u7b80\u5199\u4e3al \u67e5\u770b\u6e90\u4ee3\u7801\uff0c\u9ed8\u8ba4\u4e3amain\u51fd\u6570\u6587\u4ef6 l xxx.c:20\uff0c\u5219\u662f\u67e5\u770bxxx.c\u7684\u7b2c20\u884c\u4ee3\u7801 l xxx.c:main\uff0c\u67e5\u770bxxx.c\u7684main\u51fd\u6570 \u518d\u6b21\u6267\u884c\u5219\u662f\u663e\u793a\u540e\u7eed\u7684\u5185\u5bb9 break n n\u4e3a\u4ee3\u7801\u884c\u53f7\uff0c\u5982break 37\uff0c\u53ef\u7b80\u5199\u4e3ab 37 \u4e5f\u53ef\u4ee5\u8ddf\u6761\u4ef6\uff0c\u5982\uff1abreak 37 if xxx=xxx\uff1b \u884c\u53f7\u4e5f\u53ef\u4ee5\u7528\u51fd\u6570\u540d\u6765\u4ee3\u66ff\uff0c\u5982break main\uff0c\u5728main\u51fd\u6570\u5904\u6253\u65ad\u70b9 delete delete n\u4e3abreak\u7f16\u53f7\uff0c\u53ef\u5220\u9664\u65ad\u70b9 info breakpoints \u67e5\u770b\u5f53\u524d\u6240\u6709\u65ad\u70b9\uff0c\u53ef\u7b80\u5199\u4e3ai b start \u6267\u884c\u7a0b\u5e8f\uff0c\u53ea\u6267\u884c\u4e00\u6b65 run \u6267\u884c\u7a0b\u5e8f next \u5355\u6b65\u6267\u884c\u4e0b\u4e00\u884c\u4ee3\u7801\uff0c\u7b80\u5199\u4e3an step \u5355\u6b65\u6267\u884c\u9012\u8fdb\uff0c\u5982\u679c\u662f\u51fd\u6570\u5219\u8fdb\u5165\u51fd\u6570\u4f53\u5185\u90e8\uff0c\u5982\u679c\u6ca1\u6709\u5219\u4e0b\u4e00\u6b65 finish \u8df3\u51fa\u5f53\u524d\u7684\u51fd\u6570\u4f53\uff0c\u5982\u679c\u5904\u5728\u5faa\u73af\u4f53\u4e2d\u65e0\u6cd5\u8df3\u51fa continue \u7b80\u5199\u4e3ac\uff0c\u7ee7\u7eed\u6267\u884c\uff0c\u5982\u679c\u6709\u65ad\u70b9\u5219\u4e00\u76f4\u5230\u4e0b\u4e00\u4e2a\u65ad\u70b9\u4f4d\u7f6e print \u7b80\u5199\u4e3ap\uff0c\u67e5\u770b\u53d8\u91cf\u503c\uff0cp a\uff0c\u67e5\u770b\u53d8\u91cfa\u7684\u503c set var \u8bbe\u7f6e\u53d8\u91cf\u503c\uff0c\u5982set var [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[88],"tags":[221,308,307],"class_list":["post-1786","post","type-post","status-publish","format-standard","hentry","category-cpp","tag-gcc","tag-gdb","tag-307"],"_links":{"self":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1786","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/comments?post=1786"}],"version-history":[{"count":0,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/posts\/1786\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/media?parent=1786"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/categories?post=1786"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.yusian.com\/blog\/wp-json\/wp\/v2\/tags?post=1786"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}