{"id":1000,"date":"2018-02-07T14:18:48","date_gmt":"2018-02-07T06:18:48","guid":{"rendered":"https:\/\/damogame.cn:15443\/wordpress\/?p=1000"},"modified":"2018-02-07T14:18:48","modified_gmt":"2018-02-07T06:18:48","slug":"windbg%e8%b0%83%e8%af%95%e5%9f%ba%e7%a1%80","status":"publish","type":"post","link":"https:\/\/i007.cc\/wordpress\/archives\/1000","title":{"rendered":"windbg\u8c03\u8bd5\u57fa\u7840"},"content":{"rendered":"<h1 class=\"postTitle\"><a id=\"cb_post_title_url\" class=\"postTitle2\" href=\"http:\/\/www.cnblogs.com\/kekec\/archive\/2012\/11\/14\/2755924.html\">windbg\u8c03\u8bd5\u57fa\u7840<\/a><\/h1>\n<div class=\"clear\"><\/div>\n<div class=\"postBody\">\n<div id=\"cnblogs_post_body\" class=\"blogpost-body\">\n<p><strong>#\u5de5\u4f5c\u7a7a\u95f4 [Workspace]<\/strong><\/p>\n<p>\u5de5\u4f5c\u7a7a\u95f4\u88ab\u7528\u6765\u63cf\u8ff0\u548c\u5b58\u50a8\u4e00\u4e2a\u8c03\u8bd5\u9879\u76ee\u7684\u5c5e\u6027\u3001\u53c2\u6570\u4ee5\u53ca\u8c03\u8bd5\u5668\u8bbe\u7f6e\u7b49\u4fe1\u606f\uff0c\u5176\u529f\u80fd\u7c7b\u4f3c\u4e8e\u96c6\u6210\u5f00\u53d1\u73af\u5883\u7684\u9879\u76ee\u6587\u4ef6\u3002<\/p>\n<p>\u5177\u4f53\u5305\u62ec\uff1a\u8c03\u8bd5\u4f1a\u8bdd\u72b6\u6001\uff08\u65ad\u70b9\u3001\u6253\u5f00\u7684\u6e90\u6587\u4ef6\u3001\u7528\u6237\u5b9a\u4e49\u7684\u522b\u540d\u7b49\uff09\u3001\u8c03\u8bd5\u5668\u8bbe\u7f6e\uff08\u7b26\u53f7\u6587\u4ef6\u8def\u5f84\u3001\u6e90\u6587\u4ef6\u8def\u5f84\u3001\u53ef\u6267\u884c\u6620\u50cf\u6587\u4ef6\u8def\u5f84\u7b49\uff09\u548c\u7a97\u53e3\u5e03\u5c40\u72b6\u6001\u3002<\/p>\n<p><strong>0. \u57fa\u7840\u5de5\u4f5c\u7a7a\u95f4 [base workspace]<\/strong><\/p>\n<p>\u672a\u8f7d\u5165\u4efb\u4f55\u7684\u8c03\u8bd5\u6587\u4ef6\u65f6\u4f7f\u7528\u9ed8\u8ba4\u7684\u542f\u52a8\u73af\u5883\u3002\u5b58\u653e\u4f4d\u7f6e\uff1aHKEY_CURRENT_USER\\Software\\Microsoft\\Windbg\\Workspaces\u4e0bDefault\u4e8c\u8fdb\u5236\u503c\u3002<\/p>\n<p><strong>1.\u00a0User\u3001Kernel\u3001Dump\u3001Explicit\u5de5\u4f5c\u7a7a\u95f4<\/strong><\/p>\n<p>\u5b58\u653e\u5728HKEY_CURRENT_USER\\Software\\Microsoft\\Windbg\\Workspaces\u7684\u5404\u5b50\u952e\u4e2d\uff08\u5982\u4e0b\u56fe\uff09<\/p>\n<p>\u5b50\u952eUser\u3001Kernel\u3001Dump\u7528\u6765\u4fdd\u5b58\u7528\u6237\u6001\u8c03\u8bd5\u3001\u5185\u6838\u6001\u8c03\u8bd5\u3001\u8c03\u8bd5\u8f6c\u50a8\u6587\u4ef6\u65f6\uff0c\u4f7f\u7528\u3010Save\u00a0Workspace\u3011\u65b9\u5f0f\u65f6\u9ed8\u8ba4\u7684\u4fdd\u5b58\u8def\u5f84\u3002<\/p>\n<p>\u5b50\u952eExplicit\u5219\u7528\u6765\u8bb0\u5f55\u4f7f\u7528\u3010Save\u00a0Workspace\u00a0as\u3011\u65b9\u5f0f\u4fdd\u5b58\u7684\u547d\u540d\u5de5\u4f5c\u7a7a\u95f4\u3002<\/p>\n<p>\u5bf9\u4e8e\u3010Attach to a Process\u3011\u7684\u65b9\u5f0f\uff0c\u4f1a\u4f7f\u7528User\u4e0b\u7684Default\u4e8c\u8fdb\u5236\u503c\u4f5c\u4e3a\u5176\u5de5\u4f5c\u7a7a\u95f4\uff0c\u4e4b\u540e\u5bf9\u5de5\u4f5c\u7a7a\u95f4\u6240\u4f5c\u7684\u4fee\u6539\u4e5f\u4f1a\u5199\u5230\u8be5\u5b57\u6bb5\u4e2d\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/pic002.cnblogs.com\/images\/2012\/78946\/2012110520523551.png\" alt=\"\" \/><\/p>\n<p>\u6ce8\uff1a\u6709\u65f6\u4f1a\u53d1\u73b0\u6ca1\u6709\u67d0\u4e2a\u5b50\u952e\uff0c\u8fd9\u662f\u56e0\u4e3awindbg\u8fd8\u6ca1\u4f7f\u7528\u8fc7\u8be5\u8c03\u8bd5\u65b9\u5f0f\u3002<\/p>\n<p><strong>2. \u5176\u4ed6\u8bf4\u660e<\/strong><\/p>\n<p>(1) windbg\u8fd8\u63d0\u4f9b\u53e6\u5916\u4e00\u79cd\u4fdd\u5b58\u65b9\u5f0f\u3010Save\u00a0WorkSpace\u00a0to\u00a0File\u3011\uff0c\u4f5c\u7528\u8ddf\u4e0a\u9762\u4e24\u79cd\u7684\u65b9\u5f0f\u5dee\u4e0d\u591a\uff0c<\/p>\n<p>\u53ea\u4e0d\u8fc7\u628a\u5de5\u4f5c\u7a7a\u95f4\u4ee5\u6587\u4ef6\u7684\u5f62\u5f0f\u4fdd\u5b58\u5230\u78c1\u76d8\u91cc\uff0c\u90a3\u4e48\u7528\u6237\u5c31\u53ef\u4ee5\u901a\u8fc7U\u76d8\u6216\u5176\u5b83\u65b9\u5f0f\u628a\u5de5\u4f5c\u7a7a\u95f4\u7684\u73af\u5883\u79fb\u690d\u5230\u5176\u5b83\u673a\u5668\u4e0a\u4f7f\u7528\u3002<\/p>\n<p>(2) \u8c03\u8bd5\u76ee\u6807\u6700\u540e\u7684\u5de5\u4f5c\u7a7a\u95f4\u4e3a\uff1a\u57fa\u7840\u5de5\u4f5c\u7a7a\u95f4\u4e0e\u5176\u5bf9\u5e94\u5de5\u4f5c\u7a7a\u95f4\u7684<strong>\u6c42\u5e76<\/strong>\u6240\u5f97\u7684\u73af\u5883\u3002<\/p>\n<p>(3) \u7528windbg\u6253\u5f00\u76ee\u6807\u53ef\u6267\u884c\u6587\u4ef6\u3010Open Executable\u3011\uff0c\u82e5\u6709\u9ed8\u8ba4\u7684\u5de5\u4f5c\u7a7a\u95f4\u6587\u4ef6\uff08\u5728\u5b50\u952eUser\u4e0b\uff09\uff0c\u4f1a\u81ea\u52a8\u6253\u5f00\u5176\u5bf9\u5e94\u9ed8\u8ba4\u7684\u7684\u5de5\u4f5c\u7a7a\u95f4\u6587\u4ef6\u3002<\/p>\n<p>\u8981\u4f7f\u7528\u5b50\u952eExplicit\u4e0b\u76ee\u6807\u6587\u4ef6\u7684\u5de5\u4f5c\u7a7a\u95f4\uff0c\u5fc5\u987b\u5148\u63d0\u524d\u3010Open WorkSpace\u3011\uff0c\u7136\u540e\u518d\u6253\u5f00\u76ee\u6807\u53ef\u6267\u884c\u6587\u4ef6\u3002<\/p>\n<p>(4) \u5728\u8f7d\u5165\u8c03\u8bd5\u76ee\u6807\u540e\u6539\u53d8\u4e86\u5de5\u4f5c\u7a7a\u95f4\u5e76\u4fdd\u5b58\uff0c\u5e76\u4e0d\u6539\u53d8windbg\u7684\u57fa\u7840\u5de5\u4f5c\u7a7a\u95f4\uff0c\u53ea\u6539\u53d8\u8c03\u8bd5\u76ee\u6807\u5bf9\u5e94\u7684\u5de5\u4f5c\u7a7a\u95f4\uff1b<\/p>\n<p>\u800c\u53ea\u6709\u5728windbg\u8fd8\u6ca1\u8f7d\u5165\u4efb\u4f55\u8c03\u8bd5\u76ee\u6807\u65f6\u6539\u53d8\u5e76\u4fdd\u5b58\u624d\u4f1a\u5f71\u54cd\u57fa\u7840\u5de5\u4f5c\u7a7a\u95f4\u3002<\/p>\n<p><strong>#\u7b26\u53f7 [Symbol]<\/strong><\/p>\n<p>\u8c03\u8bd5\u8005\u63a5\u89e6\u7684\u4e8c\u8fdb\u5236\u6570\u636e\u4ee5\u53ca\u6c47\u7f16\u4ee3\u7801\uff0c\u5982\u679c\u6ca1\u6709\u7b26\u53f7\u8868\u6587\u4ef6\u7684\u5e2e\u52a9\uff0c\u5c31\u65e0\u6cd5\u77e5\u9053\u8fd9\u4e9b\u6570\u636e\u4ee3\u8868\u4ec0\u4e48\u53d8\u91cf\u3001\u51fd\u6570\u3002<\/p>\n<p>\u7b26\u53f7(symbol) \uff1a\u51fd\u6570\u548c\u53d8\u91cf\u7684\u522b\u540d\uff0c\u7f16\u8bd1\u5668\u901a\u8fc7\u7b26\u53f7\u4fee\u9970\uff08Name Decoration\uff09\u548c \u51fd\u6570\u7b7e\u540d\uff08Function Signature\uff09\u6765\u5b9e\u73b0\u5168\u5c40\u552f\u4e00\u6027\u3002<\/p>\n<p>\u51fd\u6570\u7b26\u53f7\u542b\u6709\u8fd4\u56de\u503c\uff0c\u51fd\u6570\u540d\uff0c\u51fd\u6570\u53c2\u6570\u7b49\u51fd\u6570\u6240\u6709\u4fe1\u606f\uff1b\u53d8\u91cf\u7b26\u53f7\u542b\u6709\u7c7b\u578b\u548c\u540d\u79f0\u4fe1\u606f\u3002<\/p>\n<p>\u901a\u8fc7\u4e0d\u540c\u7684\u7f16\u8bd1\u9009\u9879\uff0c\u7f16\u8bd1\u5668\u53ef\u4ee5\u751f\u6210\u4e24\u79cd\u622a\u7136\u4e0d\u540c\u7684\u4fe1\u606f\u96c6\u5408\uff1a<strong>\u79c1\u6709\u7b26\u53f7\uff08private symbol\uff09<\/strong>\u548c<strong>\u516c\u6709\u7b26\u53f7\uff08public symbol\uff09<\/strong>\u3002<\/p>\n<p>\u79c1\u6709\u7b26\u53f7\uff08private symbol\uff09\u5305\u542b\u5b8c\u6574\u7684\u8c03\u8bd5\u4fe1\u606f\uff0c\u7f16\u8bd1\u9009\u9879\uff1a\/Zi\u6216\/ZI\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images0.cnblogs.com\/blog2015\/78946\/201504\/062156546024298.png\" alt=\"\" \/><\/p>\n<p>\u516c\u5171\u51fd\u6570\u548c\u53d8\u91cf\uff1a\u5728\u591a\u4e2a\u7684\u7f16\u8bd1\u5355\u5143\uff08\u6e90\u4ee3\u7801\u6587\u4ef6\uff09\u4e2d\u53ef\u89c1\u7684\u51fd\u6570\u548c\u53d8\u91cf\u3002<\/p>\n<p>\u79c1\u6709\u51fd\u6570\u548c\u53d8\u91cf\uff1a\u7528\u4e8e\u63cf\u8ff0\u9664\u516c\u5171\u51fd\u6570\u548c\u53d8\u91cf\u4ee5\u5916\u7684\u6240\u6709\u51fd\u6570\u548c\u53d8\u91cf\uff0c\u5305\u62ec\u9759\u6001\u51fd\u6570\u3001\u9759\u6001\u548c\u5c40\u90e8\u53d8\u91cf\u3001\u51fd\u6570\u53c2\u6570\uff09\u3002<\/p>\n<p>\u56e0\u6b64\uff0c\u4e3a\u4e86\u80fd\u66f4\u65b9\u4fbf\u8bfb\u61c2\u4e8c\u8fdb\u5236\u6570\u636e\u548c\u6c47\u7f16\u8bed\u8a00\uff0c\u9700\u8981\u83b7\u53d6\u7b26\u53f7\u8868\u6587\u4ef6\uff0c\u5728windbg\u4e0b\u4f7f\u7528\u7684\u7b26\u53f7\u8868\u6587\u4ef6\u4e00\u822c\u662f<strong>.PDB<\/strong>\u6587\u4ef6\u3002<\/p>\n<p>\u5ba2\u6237\u7aef\u8f6f\u4ef6\u5b58\u5728\u4e8eexe\/dll\u4e2d\uff0c\u8fd9\u4e9b\u4e8c\u8fdb\u5236\u6587\u4ef6\u4f1a\u8c03\u7528\u64cd\u4f5c\u7cfb\u7edf\u7684dll\uff0c\u8fd9\u4e24\u90e8\u5206\u4e8c\u8fdb\u5236\u6587\u4ef6\u7684\u7b26\u53f7\u8868\u6587\u4ef6\u90fd\u9700\u8981\u83b7\u53d6\u3002<\/p>\n<p>\u5ba2\u6237\u7aef\u8f6f\u4ef6\u81ea\u5df1\u7684\u7b26\u53f7\u8868\u6587\u4ef6\u5728\u6784\u5efa\u7a0b\u5e8f\u7684\u8fc7\u7a0b\u4e2d\u4ea7\u751f\uff1b\u800c\u64cd\u4f5c\u7cfb\u7edfdll\u7684\u7b26\u53f7\u8868\u6587\u4ef6\u53ef\u4ee5\u901a\u8fc7\u8bbe\u7f6ewindbg\uff0c\u6839\u636e\u9700\u8981\u81ea\u52a8\u4ece\u5fae\u8f6f\u7b26\u53f7\u670d\u52a1\u5668\u4e0a\u4e0b\u8f7d\u3002<\/p>\n<p><strong>#pdb\uff08pr<\/strong><strong>ogram Database \uff09<\/strong><\/p>\n<p><strong>0. pdb\u4e2d\u5305\u542b\u7684\u5185\u5bb9<\/strong><\/p>\n<table border=\"1\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td width=\"145\">\u7b26\u53f7\u8868<\/td>\n<td>\u51fd\u6570\u548c\u53d8\u91cf\u7b26\u53f7\u5230\u5730\u5740\u7684\u6620\u5c04\u8868(map\u6587\u4ef6\u5b9e\u9645\u5c31\u662f\u4e00\u4e2a\u6587\u672c\u683c\u5f0f\u7684\u7b26\u53f7\u8868)\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\"145\">\u6e90\u6587\u4ef6\u548c\u4ee3\u7801\u884c\u4fe1\u606f<\/td>\n<td>\u4e8c\u8fdb\u5236\u6307\u4ee4\u5230\u4ee3\u7801\u6e90\u6587\u4ef6\u4ee3\u7801\u884c\u7684\u6620\u5c04\u8868\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\"145\">\u7c7b\u578b\u4fe1\u606f<\/td>\n<td>\u7528\u4e8e\u5b58\u50a8\u6bcf\u4e00\u4e2a\u51fd\u6570\u548c\u53d8\u91cf\u7684\u7c7b\u578b\u4fe1\u606f\u3002\u5bf9\u4e8e\u53d8\u91cf\u6216\u51fd\u6570\u53c2\u6570\uff0c\u7c7b\u578b\u4fe1\u606f\u80fd\u591f\u544a\u8bc9\u8c03\u8bd5\u5668\u662f\u6574\u578b\u8fd8\u662f\u5b57\u7b26\u4e32\u7c7b\u578b\uff0c\u6216\u662f\u7528\u6237\u81ea\u5b9a\u4e49\u7c7b\u578b\u3002<\/p>\n<p>\u5bf9\u4e8e\u51fd\u6570\uff0c\u7c7b\u578b\u4fe1\u606f\u8bb0\u8f7d\u4e86\u53c2\u6570\u7684\u4e2a\u6570\u3001\u8c03\u7528\u8f6c\u6362\u548c\u8fd4\u56de\u503c\u7684\u7c7b\u578b\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\"145\">FPO(frame pointer omission, \u5e27\u6307\u9488\u7701\u7565)<\/p>\n<p>&nbsp;<\/td>\n<td>\u5bf9\u4e8e\u505a\u4e86FPO\u4f18\u5316\u7684\u51fd\u6570\uff0cFPO\u4fe1\u606f\u4fdd\u5b58\u4e86\u4e00\u4e9b\u6570\u636e\u6765\u5e2e\u52a9\u8c03\u8bd5\u5668\u786e\u5b9a\u51fd\u6570\u5806\u6808\u5e27\u7684\u5927\u5c0f\uff0c<\/p>\n<p>\u5e2e\u52a9\u8c03\u8bd5\u5668\u67e5\u627e\u51fd\u6570\u7684\u53c2\u6570\u548c\u672c\u5730\u53d8\u91cf\uff0c\u751a\u81f3\u5728\u5e27\u6307\u9488\u65e0\u6548\u65f6\u4e5f\u80fd\u5de5\u4f5c\u3002<\/p>\n<p>\u5982\u679c\u6ca1\u6709FPO\u4fe1\u606f\uff0c\u8c03\u8bd5\u5668\u65e0\u6cd5\u6b63\u786e\u663e\u793a\u88ab\u4f18\u5316\u7684\u7a0b\u5e8f\u7684\u8c03\u7528\u5806\u6808\u3002<\/td>\n<\/tr>\n<tr>\n<td width=\"145\">\u7f16\u8f91\u548c\u7ee7\u7eed\u6267\u884c\u4fe1\u606f<\/td>\n<td>\u7528\u4e8e\u5e2e\u52a9Visual Studio\u5728\u8c03\u8bd5\u65f6\u5b9e\u73b0\u7f16\u8f91\u548c\u7ee7\u7eed\u6267\u884c\u7684\u529f\u80fd<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>\u5728\u8fc7\u53bb\u7684\u5341\u5e74\u4e2d\uff0c\u5fae\u8f6f\u4f7f\u7528\u4e86\u51e0\u79cd\u4e0d\u540c\u7684\u683c\u5f0f\uff08COFF\u3001CodeView\u548c\u5e94\u7528\u7684\u6700\u5e7f\u6cdb\u7684PDB\u683c\u5f0f\uff09\u6765\u5b58\u653e\u8c03\u8bd5\u4fe1\u606f\u3002<\/p>\n<table border=\"1\" cellpadding=\"0\">\n<tbody>\n<tr>\n<td>\n<p align=\"center\">\u683c\u5f0f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u662f\u5426\u6709\u6587\u6863<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u5b58\u50a8<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u516c\u5171\u51fd\u6570\u548c\u53d8\u91cf<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u79c1\u6709\u51fd\u6570\u548c\u53d8\u91cf<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u6e90\u6587\u4ef6\u548c\u4ee3\u7801\u884c\u4fe1\u606f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u7c7b\u578b\u4fe1\u606f<\/p>\n<\/td>\n<td>\n<p align=\"center\">FPO\u4fe1\u606f<\/p>\n<\/td>\n<td>\n<p align=\"center\">\u7f16\u8f91\u548c\u7ee7\u7eed\u6267\u884c\u4fe1\u606f<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>COFF<\/td>\n<td>\n<p align=\"center\">\u6709<\/p>\n<p align=\"center\"><a href=\"http:\/\/www.microsoft.com\/whdc\/system\/platform\/firmware\/PECOFF.mspx\" target=\"_blank\" rel=\"noopener\">\u5fae\u8f6f\u53ef\u79fb\u690d\u53ef\u6267\u884c\u548c\u901a\u7528\u5bf9\u8c61\u6587\u4ef6\u683c\u5f0f\u89c4\u8303<\/a><\/p>\n<\/td>\n<td>\n<p align=\"center\">\u53ef\u6267\u884c\u6587\u4ef6\u4e2d<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8211;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8211;<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8211;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>CodeView<\/td>\n<td>\n<p align=\"center\">\u90e8\u5206<\/p>\n<p align=\"center\"><a href=\"http:\/\/www.openwatcom.org\/ftp\/devel\/docs\/CodeView.pdf\" target=\"_blank\" rel=\"noopener\">Microsoft Symbol and Type Information<\/a><\/p>\n<\/td>\n<td>\n<p align=\"center\">\u53ef\u6267\u884c\u6587\u4ef6\u4e2d<\/p>\n<p align=\"center\">\u6216.DBG\u6587\u4ef6\u4e2d<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">&#8211;<\/p>\n<\/td>\n<\/tr>\n<tr>\n<td>Program Database<\/td>\n<td>\u5fae\u8f6f\u6ca1\u6709\u63d0\u4f9b\u7a0b\u5e8f\u6570\u636e\u5e93\u683c\u5f0f\u7684\u6587\u6863\uff0c\u53ea\u63d0\u4f9b\u7279\u6b8a\u7684\u7f16\u7a0b\u63a5\u53e3DbgHelp \u548cDIA\u6765\u8bbf\u95ee\u5b83\u3002<br \/>\n\u76ee\u524d\u6709\u4e24\u4e2a\u7248\u672c\uff0c\u7b2c\u4e00\u7248(PDB2.0)\u4e3aVC6.0\u6240\u7528\uff0c\u7b2c\u4e8c\u7248(PDB 7.0)\u88abVS\u91c7\u7528\u3002<br \/>\nPDB 7.0\u4e0d\u80fd\u5411\u4e0a\u517c\u5bb9\uff0c\u4e5f\u5c31\u662f\u8bf4\uff1aVC6.0\u4e0d\u80fd\u8bfb\u53d6PDB 7.0\u683c\u5f0f\u3002<\/td>\n<td>\n<p align=\"center\">.PDB\u6587\u4ef6\u4e2d<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<td>\n<p align=\"center\">+<\/p>\n<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p><strong>1. \u5728vc6\u4e0b\u914d\u7f6e\u751f\u6210PDB\u6587\u4ef6<\/strong><\/p>\n<p>vc6\u7684Debug\u914d\u7f6e\uff0c\u4f1a\u5728\u7f16\u8bd1\u65f6\u751f\u6210\u79c1\u6709\u7b26\u53f7pdb\u6587\u4ef6\uff1bRelease\u53ef\u901a\u8fc7\u5982\u4e0b\u914d\u7f6e\u6765\u8fbe\u5230\u8fd9\u4e00\u76ee\u7684\uff1a<\/p>\n<p>(1) \u9009\u62e9Project-&gt;Setting\u83dc\u5355\uff0c\u6253\u5f00\u5de5\u7a0b\u8bbe\u7f6e\u5bf9\u8bdd\u6846<\/p>\n<p>(2) \u5728\u201cSetting For:\u201d \u4e2d\u9009\u62e9 \u201cWin32 Release\u201d\uff08\u53ea\u8bbe\u7f6eRelease\u7248\u672c\u5373\u53ef\uff0c\u56e0\u4e3aDebug\u7248\u672c\u9ed8\u8ba4\u751f\u6210PDB\u6587\u4ef6\uff09<\/p>\n<p>(3) \u9009\u62e9\u6807\u7b7e\u9875 \u201cC\/C++\u201d \uff0c\u5728 \u201cDebug info\u201d \u4e2d\u9009\u62e9 \u201cLine Numbers Only\u201d\uff08\u5982\u679c\u9009\u62e9Program Database\u5219\u5305\u542b\u66f4\u591a\u7684\u7b26\u53f7\u4fe1\u606f\uff09<\/p>\n<p>(4) \u9009\u62e9\u6807\u7b7e\u9875 \u201cLink\u201d \uff0c\u52fe\u9009 \u201cGenerate debug info\u201d<\/p>\n<p>(5) \u5728\u6807\u7b7e\u9875 \u201cLink\u201d \u4e2d\uff0c\u9009\u62e9 \u201cCategory-&gt;Customize\u201d\uff0c\u5728\u8fd9\u91cc\u586b\u5199PDB\u6587\u4ef6\u7684\u751f\u6210\u8def\u5f84<\/p>\n<p>\u6ce8\uff1a\u65e0\u8bba\u662fDebug\u8fd8\u662fRelease\u914d\u7f6e\uff0cVC6.0\u7684Link\u9009\u9879\u9700\u8981\u5c06\/pdbtype:sept\u6539\u4e3a\/pdbtype:con, \u5426\u5219\u751f\u6210\u7684pdb\u6587\u4ef6\u4e2d\u5c06\u4e0d\u5305\u542b\u5982\u81ea\u5b9a\u4e49\u7ed3\u6784\u4f53\uff0c\u7c7b\u7b49\u4fe1\u606f<\/p>\n<p>\u66f4\u591a\u5173\u4e8evc6\u548cvs\u7684pdb\u7f16\u8bd1\u548c\u94fe\u63a5\u9009\u9879\u4fe1\u606f\uff0c\u8bf7\u53c2\u8003\uff1a<a href=\"http:\/\/soft.zdnet.com.cn\/software_zone\/2008\/0124\/717532.shtml\" target=\"_blank\" rel=\"noopener\">Windows\u7a0b\u5e8f\u8c03\u8bd5\u7cfb\u5217: \u4f7f\u7528VC++\u751f\u6210\u8c03\u8bd5\u4fe1\u606f<\/a><\/p>\n<p><strong>2. \u4e3avs\u4e0bRelease\u914d\u7f6e\u751f\u6210PDB\u6587\u4ef6<\/strong><\/p>\n<p>(1) \u914d\u7f6eC\/C++ &gt;General&gt;Debug Information Format \u4e3a \u201cProgram Database(\/Zi)\u201d<\/p>\n<p>(2) \u914d\u7f6eC\/C++ &gt;Optimization&gt;Optimization \u4e3a\u201dDisabld(\/Od)\u201d<\/p>\n<p>(3) \u914d\u7f6eLinker&gt;Debugging&gt;Generate Debug Info \u4e3a\u201dYes\/(DEBUG)\u201d<\/p>\n<p><strong>3.\u5728windbg\u4e0b\u4f7f\u7528PDB\u6587\u4ef6<\/strong><\/p>\n<p>\u542f\u52a8windbg\u540e\uff0c\u9009\u62e9 \u3010Symbol File Path\u3011\uff0c\u5f39\u51fa \u201cSymbol Search Path\u201d \u5bf9\u8bdd\u6846\uff0c\u8f93\u5165\u5b58\u653ePDB\u6587\u4ef6\u7684\u8def\u5f84\u3002\u53ef\u4ee5\u8f93\u5165\u591a\u4e2a\u8def\u5f84\uff0c\u8def\u5f84\u4e4b\u95f4\u4f7f\u7528<strong>\u5206\u53f7<\/strong>\u8fdb\u884c\u5206\u9694\u3002<\/p>\n<p>\u5982\u679c\u6b64\u65f6\u6b63\u5728\u8c03\u8bd5\u7a0b\u5e8f\uff0c\u5219\u5bf9\u8bdd\u6846\u4e2d\u7684 \u201creload\u201d \u9009\u62e9\u6846\u662f\u53ef\u4ee5\u9009\u62e9\u7684\uff0c\u52fe\u9009\u540e\u70b9\u51fb\u201c\u786e\u5b9a\u201d\u3002<\/p>\n<p><strong>4.\u4f7f\u7528Windows\u7b26\u53f7\u8868\u670d\u52a1\u5668<\/strong><\/p>\n<p>\u4e3a\u4e86\u65b9\u4fbf\u8c03\u8bd5\uff0c\u9700\u8981\u83b7\u53d6Windows\u7cfb\u7edfDLL\u7684\u7b26\u53f7\u8868\u6587\u4ef6\u3002\u5fae\u8f6f\u516c\u53f8\u63d0\u4f9b\u4e86\u53ef\u4ee5\u901a\u8fc7Internet\u8bbf\u95ee\u7684\u7b26\u53f7\u8868\u670d\u52a1\u5668\u3002<\/p>\n<p>\u7ecf\u8fc7\u8bbe\u7f6e\uff0c\u5728\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\uff0cwindbg\u8c03\u8bd5\u5668\u4f1a\u4ece\u7b26\u53f7\u8868\u670d\u52a1\u5668\u81ea\u52a8\u4e0b\u8f7d\u8c03\u8bd5\u6240\u9700\u7684PDB\u6587\u4ef6\uff0c\u975e\u5e38\u65b9\u4fbf\u3002<\/p>\n<p>\u8bbe\u7f6e\u65b9\u6cd5\uff1a \u5728 \u3010Symbol Search Path\u3011 \u5bf9\u8bdd\u6846\u4e2d\u52a0\u5165\u4e0b\u9762\u7684\u8def\u5f84\uff1asrv*D:\\SystemSymbols*http:\/\/msdl.microsoft.com\/download\/symbols<\/p>\n<p>\u5176\u4e2d\uff1a D:\\SystemSymbols\u4e3a\u5b58\u653e\u7b26\u53f7\u7684\u4e0b\u8f7d\u76ee\u5f55<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201703\/78946-20170303134500657-553884700.png\" alt=\"\" \/><\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201703\/78946-20170303134154938-1885193536.png\" alt=\"\" \/><\/p>\n<p>\u6ce81\uff1a48C58F3D11e000\u4e3a\u5bf9\u5e94\u7248\u672cdbghelp.dll\u7684PE\u5934\u4e2d\u8bb0\u5f55\u7684\u65f6\u95f4\u65e5\u671f\u6233\u548c\u6620\u50cf\u5927\u5c0f\u7684\u7ec4\u5408\uff08\u5b57\u8282\u6570\uff09<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201705\/78946-20170527112504872-1174015112.png\" alt=\"\" \/><\/p>\n<p>timestamp\u4e0e\u65e5\u671f\u65f6\u95f4\u7684\u5728\u7ebf\u8f6c\u6362\u5de5\u5177\uff1a<a href=\"http:\/\/tool.chinaz.com\/Tools\/unixtime.aspx\" target=\"_blank\" rel=\"noopener\">http:\/\/tool.chinaz.com\/Tools\/unixtime.aspx<\/a><\/p>\n<p>\u6ce82\uff1a6B19F261EE434AF59623D1791CE5A7D72\u4e3a\u5bf9\u5e94\u7248\u672cdbghelp.pdb\u7684guid<\/p>\n<p>\u53e6\u5916\uff0c\u4e5f\u53ef\u4ee5\u4f7f\u7528windbg\u63d0\u4f9b\u7684symchk.exe\u5de5\u5177\u63d0\u524d\u4e0b\u8f7d\u67d0\u4e2adll\u53ca\u67d0\u4e2a\u76ee\u5f55\u4e0b\u6240\u6709dll\u7684pdb\u6587\u4ef6\u5230\u672c\u5730<\/p>\n<div class=\"cnblogs_code\">\n<pre>\"C:\\Program Files\\Debugging Tools for Windows (x86)\\symchk.exe\" c:\\windows\\system32\\user32.dll \/s SRV*c:\\symbols\\*http:\/\/msdl.microsoft.com\/download\/symbols  \/\/\u4e0b\u8f7duser32.dll\u7684pdb\u5230c:\\symbols\u76ee\u5f55\u4e2d\r\n\"C:\\Program Files\\Debugging Tools for Windows (x86)\\symchk.exe\" c:\\windows\\system32\\ \/s SRV*c:\\symbols\\*http:\/\/msdl.microsoft.com\/download\/symbols \/\/\u4e0b\u8f7dsystem32\u4e0b\u6240\u6709dll\u7684pdb\u5230c:\\symbols\u76ee\u5f55\u4e2d\r\n\"C:\\Program Files\\Debugging Tools for Windows (x86)\\symchk.exe\" \/r c:\\windows\\system32\\ \/s SRV*c:\\symbols\\*http:\/\/msdl.microsoft.com\/download\/symbols  \/\/\u9012\u5f52\u5b50\u76ee\u5f55\u4e0b\u8f7dsystem32\u4e0b\u6240\u6709dll\u7684pdb\u5230c:\\symbols\u76ee\u5f55\u4e2d<\/pre>\n<\/div>\n<p><strong>5. \u8bbe\u7f6e_NT_SYMBOL_PATH\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<p>\u8bbe\u7f6e\u7cfb\u7edf\u73af\u5883\u53d8\u91cf\u201c<strong>_NT_SYMBOL_PATH<\/strong>\u201d\uff0cVisual Studio\u3001windbg\u3001SysinternalsSuite\u5de5\u5177\u96c6\u7684ProcessExplorer\u3001ProcessMonitor\u7b49\u90fd\u4f1a\u5c06\u8be5\u73af\u5883\u53d8\u91cf\u4e0b\u7684\u8def\u5f84\u6dfb\u52a0\u5230\u81ea\u5df1\u7684Symbol File Path\u4e2d<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201705\/78946-20170525113433154-966917545.png\" alt=\"\" \/><\/p>\n<p><strong>6.\u5efa\u7acb\u81ea\u5df1\u7684\u7b26\u53f7\u8868\u670d\u52a1\u5668<\/strong><\/p>\n<p>\u901a\u8fc7\u4e3a\u4ea7\u54c1\u5efa\u7acb\u81ea\u5df1\u7684\u7b26\u53f7\u8868\u670d\u52a1\u5668\uff0c\u5c31\u4e0d\u9700\u8981\u5173\u5fc3\u590d\u6742\u7684\u7248\u672c\u95ee\u9898\u3002\u5728\u8c03\u8bd5\u8fc7\u7a0b\u4e2d\uff0cwindbg\u53ef\u4ee5\u6839\u636e\u4e8c\u8fdb\u5236\u6587\u4ef6\uff08exe\/dll\uff09\u7684\u54c8\u5e0c\u503c\uff0c\u5728\u7b26\u53f7\u8868\u670d\u52a1\u5668\u4e0a\u81ea\u52a8\u67e5\u627e\u6b63\u786e\u7248\u672c\u7684PDB\u3002<\/p>\n<p>(1)\u5efa\u7acb\u4e00\u4e2a\u5171\u4eab\u6587\u4ef6\u5939\uff0c\u6bd4\u5982 \u201c \\\\server\\symbols\u201d \uff0c\u7136\u540e\u5c06\u6240\u6709\u7684PDB\u6587\u4ef6\u4e0a\u4f20\u5230\u6b64\u5904<\/p>\n<p>(2)\u4f7f\u7528\u4e0b\u9762\u7684\u547d\u4ee4\u4e0a\u4f20\u7b26\u53f7\u8868\u6587\u4ef6<\/p>\n<blockquote><p>symstore\u00a0add \/r\u00a0\/f D:\\MyOutput\\chess.exe \/s\u00a0\\\\server\\symbols\u00a0\/t &#8220;chess&#8221;\u00a0\/v &#8220;exe&#8221;\u00a0\/c &#8220;version build&#8221;<\/p>\n<p>symstore\u00a0add \/r\u00a0\/f D:\\MyOutput\\chess.pdb \/s\u00a0\\\\server\\symbols\u00a0\/t &#8220;chess&#8221;\u00a0\/v &#8220;pdb&#8221;\u00a0\/c &#8220;version build&#8221;<\/p>\n<p>symstore\u00a0add \/r\u00a0\/f D:\\MyOutput\\chess.map \/s\u00a0\\\\server\\symbols\u00a0\/t &#8220;chess&#8221;\u00a0\/v &#8220;map&#8221;\u00a0\/c &#8220;version build&#8221;<\/p><\/blockquote>\n<p><a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/desktop\/ms681378(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">symstore<\/a>\u00a0\u662fwindbg\u9644\u5e26\u7684\u4e00\u4e2aexe\u6587\u4ef6\uff0c\u5b58\u653e\u4e8ewindbg\u5b89\u88c5\u76ee\u5f55\u4e0b\u3002\u9700\u5305\u542b2\u4e2a\u6587\u4ef6\uff1asymstore.exe\u3001symsrv.dll<\/p>\n<p>\u4e0a\u8ff0\u547d\u4ee4\u5b8c\u6210\u7684\u529f\u80fd\u662f\uff1a\u5c06D:\\MyOutput\u76ee\u5f55\u4e0b\u7684chess.exe\u3001chess.pdb\u3001chess.map\u4e0a\u4f20\u5230\\\\server\\symbols\u76ee\u5f55\u4e2d\u3002<\/p>\n<p>\u4ea7\u54c1\u7684\u540d\u79f0\u662f&#8221;chess&#8221;\uff0c\u7248\u672c\u4fe1\u606f\u662f&#8221;exe&#8221;\u3001&#8221;pdb&#8221;\u3001&#8221;map&#8221;\uff0c\u5907\u6ce8\u8bf4\u660e\u662f&#8221;version build&#8221;\u3002<\/p>\n<p>(3)\u5728windbg\u7684 \u3010Symbol Search Path\u3011\u5bf9\u8bdd\u6846\u4e2d\u6dfb\u52a0\u65b0\u7684\u8def\u5f84\uff08\u8def\u5f84\u4e4b\u95f4\u4f7f\u7528\u5206\u53f7[;]\u5206\u9694\uff09\\\\server\\symbols\uff08\u5173\u8054\u4e00\u4e2a\u672c\u5730\u7f13\u5b58\u76ee\u5f55\uff09<\/p>\n<p>srv*D:\\SystemSymbols*http:\/\/msdl.microsoft.com\/download\/symbols;srv*D:\\ServerSymbols*\\\\server\\symbols;f:\\symbols<\/p>\n<p><strong>7. \u67e5\u627e\u51fd\u6570\u7b26\u53f7\u540d<\/strong>\u00a0\u00a0&#8212; \u5217\u51fa\u542bCreateThread\u5b57\u6837\u7684\u7b26\u53f7\u540d<\/p>\n<div class=\"cnblogs_code\">\n<pre>\"D:\\Program Files (x86)\\windbg\\dbh.exe\" -s:srv*D:\\Symbols\\ms*http:\/\/msdl.microsoft.com\/Download\/Symbols -d C:\\Windows\\SysWOW64\\kernel32.dll enum *CreateThread*<\/pre>\n<\/div>\n<p><strong><img decoding=\"async\" src=\"http:\/\/images2015.cnblogs.com\/blog\/78946\/201607\/78946-20160731001214575-1388806785.png\" alt=\"\" \/><\/strong><\/p>\n<p>&nbsp;<\/p>\n<p>&nbsp;<\/p>\n<p><strong>#\u4f7f\u7528windbg<\/strong><\/p>\n<p><strong>0.\u00a0Attach\u65b9\u5f0f<\/strong><\/p>\n<p>\u542f\u52a8windbg\uff0c\u4f7f\u7528\u83dc\u5355\u3010Attach to a Process\u3011\uff0c\u53ef\u4ee5\u9009\u62e9\u6ce8\u5165\u5230\u73b0\u5728\u6b63\u5728\u8fd0\u884c\u7684\u67d0\u4e2a\u8fdb\u7a0b\u4e2d\u3002<\/p>\n<p>\u6ce8\u5165\u5230\u8fdb\u7a0b\u4e2d\u540e\uff0c\u8fdb\u7a0b\u88ab\u6682\u505c\u6267\u884c\uff0cwindbg\u5904\u4e8e\u53ef\u8f93\u5165\u547d\u4ee4\u72b6\u6001\uff0c\u4f46\u6b64\u65f6\u5f53\u524d\u7ebf\u7a0b\u4e3awindbg\u4ea7\u751f\u7684\u7ebf\u7a0b\u3002<\/p>\n<p>\u6309g\u7ee7\u7eed\u8fd0\u884c\u8fdb\u7a0b\u65f6\uff0cwindbg\u4f1a\u968f\u5373\u9500\u6bc1\u8be5\u7ebf\u7a0b\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2017.cnblogs.com\/blog\/78946\/201711\/78946-20171101002305107-1661537787.png\" alt=\"\" \/><\/p>\n<p>\u5982\u679c\u8981\u89c2\u5bdf\u4e3b\u7ebf\u7a0b\u5806\u6808\uff0c\u9700\u8981\u5207\u6362\u5230\u4e3b\u7ebf\u7a0b\uff080\u53f7\u7ebf\u7a0b\uff09\uff08\u5728windbg\u547d\u4ee4\u7a97\u53e3\u8f93\u5165\u8fd9\u4e2a\u547d\u4ee4\uff0c\u7136\u540e\u56de\u8f66\uff09\uff1a<\/p>\n<blockquote><p>~0s<\/p><\/blockquote>\n<p>\u5f53\u7a0b\u5e8f\u51fa\u73b0CPU\u5360\u7528100%\u7684\u60c5\u51b5\u65f6\uff0c\u901a\u5e38\u53ef\u4ee5\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u8fdb\u884c\u6ce8\u5165\uff0c\u7136\u540e\u5207\u6362\u5230\u5360\u7528CPU\u7684\u7ebf\u7a0b\uff0c<\/p>\n<p>\u540c\u65f6\u6839\u636e\u9700\u8981\u4f7f\u7528\u5355\u6b65\u8ddf\u8e2a\u3001\u8bbe\u7f6e\u65ad\u70b9\u7b49\u624b\u6bb5\uff0c\u6765\u5224\u65ad\u662f\u4f55\u5904\u7684\u4ee3\u7801\u5bfc\u81f4CPU100%\u95ee\u9898\u3002<\/p>\n<p><strong>1.\u00a0Open Executable\u65b9\u5f0f<\/strong><\/p>\n<p>\u4f7f\u7528\u3010Open Executable\u3011\u65b9\u5f0f\uff0c\u53ef\u4ee5\u901a\u8fc7windbg\u542f\u52a8\u88ab\u8c03\u8bd5\u7a0b\u5e8f\u3002\u5728\u8fd9\u79cd\u65b9\u5f0f\u4e0b\uff0c\u88ab\u8c03\u8bd5\u7a0b\u5e8f\u4ece\u542f\u52a8\u65f6\u523b\u8d77\u5c31\u5728\u8c03\u8bd5\u5668\u7684\u76d1\u63a7\u4e4b\u4e0b\u3002<\/p>\n<p>\u5bf9\u4e8e\u4e00\u4e9b\u5728\u7a0b\u5e8f\u542f\u52a8\u8fc7\u7a0b\u4e2d\u4ea7\u751f\u7684\u5f02\u5e38\uff0c\u53ef\u4ee5\u4f7f\u7528\u8fd9\u79cd\u65b9\u5f0f\u8fdb\u884c\u8c03\u8bd5\u3002<\/p>\n<p><strong>2.\u00a0Just in time Debugger \u65b9\u5f0f \uff08JIT\uff09<\/strong><\/p>\n<p>\u5f53\u8fdb\u7a0b\u4ea7\u751f\u7ed3\u6784\u5316\u5f02\u5e38\u65f6\uff0c\u5982\u679c\u8fdb\u7a0b\u4e0d\u4f5c\u5904\u7406\uff0c\u4e5f\u6ca1\u6709\u8c03\u8bd5\u5668\u5728\u76d1\u63a7\u8fd9\u4e2a\u8fdb\u7a0b\uff0c\u90a3\u4e48windows\u5c31\u4f1a\u8c03\u7528\u9ed8\u8ba4\u7684\u8c03\u8bd5\u5668\u6765\u8c03\u8bd5\u53d1\u751f\u5f02\u5e38\u7684\u8fdb\u7a0b\u3002<\/p>\n<p>\u901a\u8fc7\u628awindbg\u8bbe\u7f6e\u4e3aJust in time Debugger\uff0c\u53ef\u4ee5\u5728\u4efb\u610f\u8fdb\u7a0b\u53d1\u751f\u5f02\u5e38\u65f6\u81ea\u52a8\u8c03\u7528windbg\u6765\u8fdb\u884c\u8c03\u8bd5\u3002<\/p>\n<p>\u5728\u6ce8\u518c\u8868\u7f16\u8f91\u5668\u4e2d\u4fee\u6539\u4e0b\u9762\u7684\u6ce8\u518c\u8868\u9879\uff1a<\/p>\n<p>HKEY_LOCAL_MACHINE\\Software\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug<\/p>\n<p>HKEY_LOCAL_MACHINE\\Software\\Wow6432Node\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug \u00a0\/\/ \u6ce8\uff1a64\u4f4d\u7cfb\u7edf\u4e0a\u768432\u4f4d\u7a0b\u5e8f\u4f7f\u7528\u8be5\u6ce8\u518c\u8868\u9879<\/p>\n<p>Debugger\u952e\u503c\u4fee\u6539\u4e3a\u4e0b\u9762\u7684\u53d6\u503c\u00a0&#8220;D:\\Tools\\windbg.exe &#8221; -p %ld -e %ld<\/p>\n<p>\u6ce81\uff1a\u5c06\u4f8b\u4e2dwindbg.exe\u7684\u8def\u5f84\u66ff\u6362\u4e3a\u672c\u673awindbg\u7edd\u5bf9\u8def\u5f84\u5373\u53ef<\/p>\n<p>\u6ce82\uff1a\u4e00\u822c\u8be5\u503c\u4e3a\uff1a&#8221;C:\\Windows\\system32\\vsjitdebugger.exe&#8221; -p %ld -e %ld<\/p>\n<p><strong>3. Dump\u6587\u4ef6<\/strong><\/p>\n<p>\u4e3a\u4e86\u5206\u6790\u7a0b\u5e8f\u53d1\u751f\u5f02\u5e38\u7684\u539f\u56e0\uff0c\u8fd8\u53ef\u4ee5\u501f\u52a9Dump\u6587\u4ef6\u3002<\/p>\n<p>\u5f53\u5f02\u5e38\u53d1\u751f\u65f6\uff0c\u628a\u8fdb\u7a0b\u5f53\u524d\u7684\u4fe1\u606f\u4fdd\u5b58\u5230\u4e00\u4e2aDump\u6587\u4ef6\u4e2d\uff0c\u518d\u628a\u8be5Dump\u6587\u4ef6\u53d1\u9001\u7ed9\u5206\u6790\u8005\uff0c\u7531\u5206\u6790\u8005\u901a\u8fc7windbg\u8fdb\u884c\u5206\u6790\u3002<\/p>\n<p>Dump\u5206\u7c7b\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images0.cnblogs.com\/blog2015\/78946\/201504\/062233571804388.png\" alt=\"\" \/><\/p>\n<p>\u5185\u6838dump\uff1a\uff08<strong>\u84dd\u5c4f<\/strong>\u540e\uff0c\u7531\u7cfb\u7edf\u751f\u6210\uff09<\/p>\n<p>1. \u5b8c\u5168\u5185\u5b58\u8f6c\u50a8\u3002\u8fd9\u4e2a\u6587\u4ef6\u6bd4\u8f83\u5927\uff0c\u548c\u7269\u7406\u5185\u5b58\u76f8\u5f53\uff0c\u5305\u542b\u4e86\u7a0b\u5e8f\u5d29\u6e83\u524d\u7cfb\u7edf\u53ca\u7528\u6237\u6a21\u5f0f\u4e0b\u7684\u6240\u6709\u4fe1\u606f\u3002<br \/>\n2. \u6838\u5fc3\u5185\u5b58\u8f6c\u50a8\u3002\u8fd9\u4e2a\u6587\u4ef6\u5927\u5c0f\u7ea6\u7269\u7406\u5185\u5b58\u7684\u4e09\u5206\u4e4b\u4e00\uff0c\u4e3b\u8981\u5305\u542b\u5d29\u6e83\u524d\u7cfb\u7edf\u5185\u6838\u7684\u6240\u6709\u4fe1\u606f\u3002\u4e00\u822c\u4e3a\u4e86\u5206\u6790\u5185\u6838\u9519\u8bef\uff0c\u5c31\u9009\u7528\u8fd9\u79cd\u6587\u4ef6\u3002<br \/>\n3. \u5c0f\u5185\u5b58\u8f6c\u50a8\uff08MiniDump\uff09\u3002\u4fdd\u5b58\u5185\u5b58\u524d64KB\u7684\u57fa\u672c\u7a7a\u95f4\u6570\u636e\uff0c\u4e3b\u8981\u5305\u542bcrash\u8fdb\u7a0b\u53cacrash\u7ebf\u7a0b\u5185\u6838\u4e0a\u4e0b\u6587\u4fe1\u606f\uff0ccrash\u7ebf\u7a0b\u5185\u6838\u6a21\u5f0f\u5806\u6808\uff0c\u52a0\u8f7d\u7684\u9a71\u52a8\u548c\u6a21\u5757\u7b49\u4fe1\u606f\u3002<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images0.cnblogs.com\/blog2015\/78946\/201504\/062238188059093.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u5982\u679c\u6ca1\u6709\u7981\u7528\u201cWindows Error Reporting Service\u201d\u670d\u52a1\uff0c\u91cd\u542f\u540e\u4f1a\u5f39\u51fa\u5982\u4e0b\u5bf9\u8bdd\u6846\u6765\u663e\u793a\u4e00\u4e9b\u84dd\u5c4f\u76f8\u5173\u7684\u4fe1\u606f\uff1a<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201706\/78946-20170607165649215-1685153787.png\" alt=\"\" \/><\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"http:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>\u95ee\u9898\u7b7e\u540d:\r\n  \u95ee\u9898\u4e8b\u4ef6\u540d\u79f0:\tBlueScreen\r\n  OS \u7248\u672c:\t6.1.7601.2.1.0.256.48\r\n  \u533a\u57df\u8bbe\u7f6e ID:\t2052\r\n\r\n\u6709\u5173\u8be5\u95ee\u9898\u7684\u5176\u4ed6\u4fe1\u606f:\r\n  BCCode:\t1000007e\r\n  BCP1:\tFFFFFFFFC0000005\r\n  BCP2:\tFFFFF80004CCC0E4\r\n  BCP3:\tFFFFF88004993668\r\n  BCP4:\tFFFFF88004992EC0\r\n  OS Version:\t6_1_7601\r\n  Service Pack:\t1_0\r\n  Product:\t256_1\r\n\r\n\u6709\u52a9\u4e8e\u63cf\u8ff0\u8be5\u95ee\u9898\u7684\u6587\u4ef6:\r\n  C:\\Windows\\Minidump\\060717-10280-01.dmp\r\n  C:\\Users\\nicochen\\AppData\\Local\\Temp\\WER-41964-0.sysdata.xml\r\n\r\n\u8054\u673a\u9605\u8bfb\u9690\u79c1\u58f0\u660e:\r\n  http:\/\/go.microsoft.com\/fwlink\/?linkid=104288&clcid=0x0804\r\n\r\n\u5982\u679c\u65e0\u6cd5\u83b7\u53d6\u8054\u673a\u9690\u79c1\u58f0\u660e\uff0c\u8bf7\u8131\u673a\u9605\u8bfb\u6211\u4eec\u7684\u9690\u79c1\u58f0\u660e:\r\n  C:\\Windows\\system32\\zh-CN\\erofflps.txt<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"http:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>\u4e8b\u4ef6\u67e5\u770b\u5668\u4e2d\u4e5f\u8bb0\u5f55\u4e86\u90a3\u6b21\u81f4\u547d\u9519\u8bef<\/p>\n<p><img decoding=\"async\" src=\"https:\/\/images2015.cnblogs.com\/blog\/78946\/201706\/78946-20170607171354059-1690133300.png\" alt=\"\" \/><\/p>\n<p>&nbsp;<\/p>\n<p>\u4e0d\u540c\u4fe1\u606f\u91cf\u7684minidump\uff1a<\/p>\n<p>(1)\u6807\u51c6\u7684minidump\u3002\u5305\u542b\u4e86\u76f8\u5bf9\u6bd4\u8f83\u5c11\u7684\u4fe1\u606f\uff0c\u9002\u5408\u5728\u505a\u5728\u7ebf\u5206\u6790\uff1a\u7cfb\u7edf\u4fe1\u606f\u3001\u52a0\u8f7d\u7684\u6a21\u5757\uff08DLL\uff09\u4fe1\u606f\u3001\u8fdb\u7a0b\u4fe1\u606f\u548c\u7ebf\u7a0b\u4fe1\u606f\u3002<br \/>\n.dump \/m c:\\stardardMini.dmp\uff08\u6ce8\uff1a\u4e0d\u6307\u5b9a\/m\u548c\/f\uff0c\/m\u4e3a\u7f3a\u7701\u9009\u9879\uff09<\/p>\n<p>(2) full dump\u3002\u5728\u5185\u6838\u6a21\u5f0f\u4e0b\uff0c\u751f\u6210\u5b8c\u5168\u5185\u5b58\u8f6c\u50a8\uff1b\u7528\u6237\u6a21\u5f0f\u4e0b\uff0c\u6700\u597d\u4e0d\u4f7f\u7528\uff08\/ma\u548c\/mf\u662f\u66f4\u597d\u7684\u9009\u62e9\uff0c\u751f\u6210\u51fa\u7684dump\u4fe1\u606f\u4e5f\u66f4\u4e30\u5bcc\u4e00\u4e9b\uff09<br \/>\n.dump \/f c:\\fullMini.dmp<\/p>\n<p>(3)\u5e26\u6709\u5c3d\u91cf\u591a\u9009\u9879\u7684minidump\u3002\u5305\u62ec\u5b8c\u6574\u7684\u5185\u5b58\u5185\u5bb9\u3001\u53e5\u67c4\u3001\u672a\u52a0\u8f7d\u7684\u6a21\u5757\uff0c\u7b49\u7b49\u3002\u6587\u4ef6\u5f88\u5927\uff08\u672c\u673a\u548c\u5c40\u57df\u7f51\u73af\u5883\u9002\u7528\uff09~<br \/>\n.dump \/ma c:\\bigMini.dmp\uff08\u6ce8\uff1a\/ma\u7b49\u4ef7\u4e8e\/mfFhut\uff1b\/m\u7684\u5b50\u53c2\u6570\u5305\u62ec\uff1aa,A,f,F,h,u,t,i,p,w,d,c,r,R\u00a0\uff09.<a href=\"https:\/\/msdn.microsoft.com\/en-us\/library\/windows\/hardware\/ff562428(v=vs.85).aspx\" target=\"_blank\" rel=\"noopener\">dump\u547d\u4ee4\u8be6\u7ec6\u7528\u6cd5<\/a><\/p>\n<p>\u4e0b\u9762\u5217\u51fa\u516d\u79cd\u751f\u6210Dump\u6587\u4ef6\u7684\u65b9\u6cd5\uff1a<\/p>\n<p>(1)\u5728\u4ea7\u54c1\u4ee3\u7801\u4e2d\u52a0\u5165\u81ea\u52a8\u751f\u6210Dump\u6587\u4ef6\u529f\u80fd<\/p>\n<p>\u4f7f\u7528\u4e0b\u9762\u7684\u51fd\u6570\uff0c\u53ef\u4ee5\u751f\u6210\u4e00\u4e2aDump\u6587\u4ef6\uff1a<\/p>\n<div class=\"cnblogs_code\">\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"http:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<pre>BOOL MiniDumpWriteDump (\r\nHANDLE hProcess,\r\nDWORD ProcessId,\r\nHANDLE hFile,\r\nMINIDUMP_TYPE DumpType,\r\nPMINIDUMP_EXCEPTION_INFORMATION ExceptionParam,\r\nPMINIDUMP_USER_STREAM_INFORMATION UserStreamParam,\r\nPMINIDUMP_CALLBACK_INFORMATION CallbackParam\r\n);<\/pre>\n<div class=\"cnblogs_code_toolbar\"><span class=\"cnblogs_code_copy\"><a title=\"\u590d\u5236\u4ee3\u7801\"><img decoding=\"async\" src=\"http:\/\/common.cnblogs.com\/images\/copycode.gif\" alt=\"\u590d\u5236\u4ee3\u7801\" \/><\/a><\/span><\/div>\n<\/div>\n<p>\u8fd9\u4e2a\u51fd\u6570\u5b9a\u4e49\u5728<strong>dbghelp.dll<\/strong>\u4e2d\uff0cwindbg\u5b89\u88c5\u76ee\u5f55\u4e2d\u5e26\u6709\u8fd9\u4e2adll\uff0c\u540c\u65f6\u5728sdk\u5b50\u76ee\u5f55\u4e2d\u63d0\u4f9b\u4e86.h\u548c.lib\u6587\u4ef6\u3002<br \/>\n\u5728\u8fdb\u7a0b\u6355\u6349\u7ed3\u6784\u5316\u5f02\u5e38\u7684\u5730\u65b9\uff0c\u4f7f\u7528\u8fd9\u4e2aAPI\u751f\u6210\u4e00\u4e2aDump\u6587\u4ef6\u3002<\/p>\n<p>(2)\u00a0\u4f7f\u7528AdPlus\u751f\u6210Dump\u6587\u4ef6<\/p>\n<p>windbg\u9644\u5e26\u4e86\u4e00\u4e2aAdPlus\u7684\u811a\u672c\uff0c\u53ef\u4ee5\u7528\u4e8e\u76d1\u63a7\u8fdb\u7a0b\u8fd0\u884c\u60c5\u51b5\uff0c\u5e76\u4e14\u53ef\u4ee5\u5728\u53d1\u751f\u5f02\u5e38\u65f6\u628a\u8fdb\u7a0b\u4fe1\u606f\u5199\u5165\u5230Dump\u6587\u4ef6\u4e2d\u3002<br \/>\n\u5982\u679c\u4ea7\u54c1\u6ca1\u6709\u81ea\u52a8\u751f\u6210Dump\u6587\u4ef6\u7684\u529f\u80fd\uff0c\u53ef\u4ee5\u901a\u8fc7\u4f7f\u7528\u8fd9\u4e2a\u5de5\u5177\u6765\u5f25\u8865\u7f3a\u9677\u3002<\/p>\n<p>\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u6765\u4f7f\u7528AdPlus\uff1a<\/p>\n<blockquote><p>cscript\u00a0D:\\tools\\windbg\\adplus.vbs\u00a0-crash\u00a0-pn DebugTest.exe\u00a0-o D:\\CrashDumps<\/p><\/blockquote>\n<p>\u4e0a\u8ff0\u547d\u4ee4\u7684\u610f\u601d\u662f\uff1a\u76d1\u63a7\u5f53\u524d\u8fd0\u884c\u7684DebugTest.exe\uff0c\u5982\u679c\u53d1\u751f\u4e86\u7ed3\u6784\u5316\u5f02\u5e38\uff0c\u5219\u751f\u6210\u4e00\u4e2aDump\u6587\u4ef6\u5230D:\\CrashDumps\u76ee\u5f55\u4e2d\u3002<br \/>\n\u5173\u4e8eAdPlus\u66f4\u8be6\u7ec6\u7684\u4ecb\u7ecd\u8bf7\u53c2\u9605\uff1a<a href=\"http:\/\/support.microsoft.com\/kb\/286350\/zh-cn\">http:\/\/support.microsoft.com\/kb\/286350\/zh-cn<\/a><\/p>\n<p>(3) \u4f7f\u7528windbg\u751f\u6210Dump\u6587\u4ef6<\/p>\n<p>windbg\u53ef\u4ee5\u901a\u8fc7\u547d\u4ee4\u751f\u6210mini-Dump\u6587\u4ef6\uff1a<\/p>\n<blockquote><p>.dump \/mfh D:\\CrashDumps\\mydumpfile.dmp<\/p><\/blockquote>\n<p>(4)\u00a0win7\u4efb\u52a1\u7ba1\u7406\u5668 &#8211; \u8fdb\u7a0b\u6807\u7b7e\u9875 &#8211; \u521b\u5efa\u8f6c\u50a8\u6587\u4ef6<\/p>\n<p>(5)\u00a0\u4f7f\u7528vs2010\u4ee5\u4e0a\u7248\u672c\u751f\u6210 \u00a0\u5728\u8c03\u8bd5\u72b6\u6001\u4e0b[\u83dc\u5355]\uff1a\u8c03\u8bd5 &#8211; \u5c06\u8f6c\u50a8\u53e6\u5b58\u4e3a<\/p>\n<p>(6)\u00a0\u7b2c\u4e09\u65b9\u7cfb\u7edf\u5de5\u5177 \u00a0\u5982\uff1a\u6700\u65b0\u7248\u672c\u7684Process Explorer\u3001proccump.exe\u547d\u4ee4\u884c\u5de5\u5177\u7b49<\/p>\n<p>\u6ce8\u610f\uff1a<\/p>\n<p>win32\u7a0b\u5e8f\u572864\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff0c\u9700\u8981\u751f\u6210dump\u65f6\uff0c\u5e94\u8be5\u751f\u621032\u4f4d\u7684dump\uff0c\u5426\u5219windbg\u5728\u83b7\u53d6call stack\u65f6\u53ef\u80fd\u51fa\u9519\uff0c\u4e00\u4e9bsos\u3001psscor2\u7b49\u6269\u5c55\u65e0\u6cd5\u8bfb\u53d6dump\u4e2d\u7684\u6570\u636e\uff0c\u4e00\u4e9b\u547d\u4ee4\u5728\u83b7\u53d6dump\u4e2d\u7684\u4fe1\u606f\u4e5f\u4f1a\u53d7\u9650\u3002<br \/>\n\u5bf9\u4e8e32\u4f4ddump\uff0c\u5e94\u8be5\u7528x86\u7248\u7684windbg\u5206\u6790\uff08\u65e0\u8bba\u662f\u572832\u4f4d\u8fd8\u662f64\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\uff09\uff1b64\u4f4ddump\uff0c\u5e94\u8be5\u7528\u572864\u4f4d\u64cd\u4f5c\u7cfb\u7edf\u4e0a\u4f7f\u7528x64\u7248\u7684windbg\u8fdb\u884c\u5206\u6790\u3002<\/p>\n<p>&nbsp;<\/p>\n<p><strong>\u5206\u6790Dump\u6587\u4ef6<\/strong><\/p>\n<p>\u4f7f\u7528\u83dc\u5355\u3010Open Crash Dump\u3011\u6253\u5f00Dump\u6587\u4ef6\uff0c\u7136\u540e\u6253\u5f00\u5806\u6808\u89c2\u5bdf\u7a97\u53e3\uff0c\u6b64\u65f6\u770b\u5230\u7684\u5806\u6808\u53ef\u80fd\u4e0d\u662f\u5f02\u5e38\u53d1\u751f\u65f6\u7684\u5806\u6808\u3002<\/p>\n<p>\u901a\u8fc7\u5982\u4e0b\u547d\u4ee4\u5207\u6362\u5230\u5f02\u5e38\u53d1\u751f\u65f6\u7684\u5806\u6808\uff1a<\/p>\n<blockquote><p>.ecxr<\/p><\/blockquote>\n<p>\u4e3a\u4e86\u5206\u6790\u5f02\u5e38\uff0c\u53ef\u4ee5\u901a\u8fc7\u4e0b\u9762\u7684\u8bed\u53e5\u6765\u83b7\u53d6\u5206\u6790\u4fe1\u606f\uff0c\u5e2e\u52a9\u5b9a\u4f4d\u95ee\u9898\uff1a<\/p>\n<blockquote><p>!analyze -v<\/p><\/blockquote>\n<p><strong>#\u53c2\u8003<\/strong><\/p>\n<p><a href=\"http:\/\/www.debuginfo.com\/resources.html\"><strong>http:\/\/www.debuginfo.com\/resources.html<\/strong><\/a><\/p>\n<p><a href=\"http:\/\/www.debuginfo.com\/articles\/debuginfomatch.html\" target=\"_blank\" rel=\"noopener\"><strong>http:\/\/www.debuginfo.com\/articles\/debuginfomatch.html<\/strong><\/a><\/p>\n<p><a href=\"http:\/\/www.debuginfo.com\/articles\/gendebuginfo.html\" target=\"_blank\" rel=\"noopener\"><strong>http:\/\/www.debuginfo.com\/articles\/gendebuginfo.html<\/strong><\/a><\/p>\n<p>DbgHelp Functions:\u00a0<strong><a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ms679291(VS.85).aspx\">http:\/\/msdn.microsoft.com\/en-us\/library\/ms679291(VS.85).aspx<\/a><\/strong><\/p>\n<p><a href=\"http:\/\/www.cppblog.com\/woaidongmao\/archive\/2009\/10\/21\/99135.html\"><strong>\u5229\u7528VS2005\u8fdb\u884cdump\u6587\u4ef6\u8c03\u8bd5<\/strong><\/a><\/p>\n<\/div>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p>windbg\u8c03\u8bd5\u57fa\u7840 #\u5de5\u4f5c\u7a7a\u95f4 [Wo<\/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":[118],"class_list":["post-1000","post","type-post","status-publish","format-standard","hentry","tag-02-"],"_links":{"self":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/1000","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=1000"}],"version-history":[{"count":0,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/posts\/1000\/revisions"}],"wp:attachment":[{"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/media?parent=1000"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/categories?post=1000"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/i007.cc\/wordpress\/wp-json\/wp\/v2\/tags?post=1000"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}