{"id":20705,"date":"2024-11-19T17:57:07","date_gmt":"2024-11-19T09:57:07","guid":{"rendered":"https:\/\/fwq.ai\/blog\/20705\/"},"modified":"2024-11-19T17:57:07","modified_gmt":"2024-11-19T09:57:07","slug":"sublimegdb%e6%80%8e%e4%b9%88%e9%85%8d%e7%bd%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/20705\/","title":{"rendered":"sublimegdb\u600e\u4e48\u914d\u7f6e"},"content":{"rendered":"<blockquote><p>\n  \u914d\u7f6e sublimegdb \u6d89\u53ca\u516d\u4e2a\u6b65\u9aa4\uff1a\u5b89\u88c5 sublimegdb \u5305\uff0c\u5b89\u88c5 gnu \u8c03\u8bd5\u5668 (gdb)\uff0c\u914d\u7f6e sublimegdb \u8bbe\u7f6e\uff0c\u914d\u7f6e\u6784\u5efa\u7cfb\u7edf\uff0c\u8bbe\u7f6e\u65ad\u70b9\uff0c\u542f\u52a8\u8c03\u8bd5\u4f1a\u8bdd\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202404\/03\/2024040314272188958.jpg\" class=\"aligncenter\" title=\"sublimegdb\u600e\u4e48\u914d\u7f6e\u63d2\u56fe\" alt=\"sublimegdb\u600e\u4e48\u914d\u7f6e\u63d2\u56fe\" \/><\/p>\n<p><strong>SublimeGDB \u7684\u914d\u7f6e<\/strong><\/p>\n<p><strong>\u5982\u4f55\u5728 Sublime Text \u4e2d\u914d\u7f6e SublimeGDB\uff1f<\/strong><\/p>\n<p>\u914d\u7f6e SublimeGDB \u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u5b89\u88c5 SublimeGDB \u5305<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 Sublime Text \u7684\u5305\u7ba1\u7406\u5668\uff08Ctrl+Shift+P\uff09\u3002<\/li>\n<li>\u641c\u7d22\u5e76\u5b89\u88c5 SublimeGDB\u3002<\/li>\n<\/ul>\n<p><strong>2. \u5b89\u88c5 GNU \u8c03\u8bd5\u5668 (GDB)<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5df2\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86 GDB\u3002<\/li>\n<li>Windows\uff1a\u4e0b\u8f7d MinGW \u6216 Cygwin \u5e76\u5b89\u88c5 GDB\u3002<\/li>\n<li>macOS\uff1a\u901a\u8fc7 Homebrew\uff08brew install gdb\uff09\u6216 MacPorts\uff08sudo port install gdb\uff09\u5b89\u88c5 GDB\u3002<\/li>\n<li>Linux\uff1a\u901a\u8fc7\u5305\u7ba1\u7406\u5668\uff08\u5982 sudo apt-get installgdb\uff09\u5b89\u88c5 GDB\u3002<\/li>\n<\/ul>\n<p><strong>3. \u914d\u7f6e SublimeGDB \u8bbe\u7f6e<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00 Sublime Text \u7684\u8bbe\u7f6e\u6587\u4ef6\uff08Ctrl+\uff0c\uff09\u3002<\/li>\n<li>\u6dfb\u52a0\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n<pre>\"sublimegdb\": {\n  \"gdb_path\": \"\/path\/to\/gdb\"\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5c06 gdb_path \u66ff\u6362\u4e3a GDB \u7684\u5b89\u88c5\u8def\u5f84\u3002<\/li>\n<\/ul>\n<p><strong>4. \u914d\u7f6e\u6784\u5efa\u7cfb\u7edf<\/strong><\/p>\n<ul>\n<li>\u521b\u5efa\u6216\u6253\u5f00\u9879\u76ee\u6587\u4ef6\u5939\uff0c\u7136\u540e\u53f3\u952e\u5355\u51fb\u5e76\u9009\u62e9\u201c\u6784\u5efa\u7cfb\u7edf\u201d-&gt;\u201c\u65b0\u5efa\u6784\u5efa\u7cfb\u7edf\u201d\u3002<\/li>\n<li>\u7c98\u8d34\u4ee5\u4e0b\u5185\u5bb9\uff1a<\/li>\n<\/ul>\n<pre>{\n  \"cmd\": [\"gdb\", \"-q\", \"$file\"],\n  \"file_regex\": \"^(.*):(\\d+):(\\d+)$\",\n  \"selector\": \"source.c, source.cpp\"\n}<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ul>\n<li>\u5c06 $file \u66ff\u6362\u4e3a\u8c03\u8bd5\u5668\u547d\u4ee4\u7684\u6b63\u786e\u5360\u4f4d\u7b26\uff08\u901a\u5e38\u4e3a %f\uff09\u3002<\/li>\n<li>\u5c06 file_regex \u66ff\u6362\u4e3a\u4e0e\u8c03\u8bd5\u8f93\u51fa\u5339\u914d\u7684\u6b63\u5219\u8868\u8fbe\u5f0f\u3002<\/li>\n<\/ul>\n<p><strong>5. \u8bbe\u7f6e\u65ad\u70b9<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00\u8981\u8c03\u8bd5\u7684\u6587\u4ef6\u5e76\u8f6c\u5230\u8981\u8bbe\u7f6e\u65ad\u70b9\u7684\u884c\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u884c\u53f7\u5e76\u9009\u62e9\u201cToggle Breakpoint\u201d\u3002<\/li>\n<\/ul>\n<p><strong>6. \u542f\u52a8\u8c03\u8bd5\u4f1a\u8bdd<\/strong><\/p>\n<ul>\n<li>\u6309 F5\uff08Windows\/Linux\uff09\u6216 Cmd+F5\uff08macOS\uff09\u542f\u52a8\u8c03\u8bd5\u4f1a\u8bdd\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662fgdb\u600e\u4e48\u914d\u7f6e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u914d\u7f6e sublimegdb \u6d89\u53ca\u516d\u4e2a\u6b65\u9aa4\uff1a\u5b89\u88c5 sublimegdb \u5305\uff0c\u5b89\u88c5 gnu \u8c03\u8bd5\u5668 (gdb)\uff0c\u914d\u7f6e sublimegdb \u8bbe\u7f6e\uff0c\u914d\u7f6e\u6784\u5efa\u7cfb\u7edf\uff0c\u8bbe\u7f6e\u65ad\u70b9\uff0c\u542f\u52a8\u8c03\u8bd5\u4f1a\u8bdd\u3002 SublimeGDB \u7684\u914d\u7f6e \u5982\u4f55\u5728 Sublime Text \u4e2d\u914d\u7f6e SublimeGDB\uff1f \u914d\u7f6e SublimeGDB \u6d89\u53ca\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u5b89\u88c5 SublimeGDB \u5305 \u6253\u5f00 Sublime Text \u7684\u5305\u7ba1\u7406\u5668\uff08Ctrl+Shift+P\uff09\u3002 \u641c\u7d22\u5e76\u5b89\u88c5 SublimeGDB\u3002 2. \u5b89\u88c5 GNU \u8c03\u8bd5\u5668 (GDB) \u786e\u4fdd\u5df2\u5728\u7cfb\u7edf\u4e2d\u5b89\u88c5\u4e86 GDB\u3002 Windows\uff1a\u4e0b\u8f7d MinGW \u6216 Cygwin \u5e76\u5b89\u88c5 GDB\u3002 macOS\uff1a\u901a\u8fc7 Homebrew\uff08brew install gdb\uff09\u6216 MacPorts\uff08sudo port install gdb\uff09\u5b89\u88c5 GDB\u3002 Linux\uff1a\u901a\u8fc7\u5305\u7ba1\u7406\u5668\uff08\u5982 sudo apt-get [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-20705","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20705","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=20705"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/20705\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=20705"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=20705"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=20705"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}