{"id":274,"date":"2009-08-28T23:49:03","date_gmt":"2009-08-29T06:49:03","guid":{"rendered":"http:\/\/www.cchsu.com\/arthur\/?p=274"},"modified":"2009-08-30T13:16:43","modified_gmt":"2009-08-30T20:16:43","slug":"%e5%a6%82%e4%bd%95%e5%8f%96%e6%a8%a3-memory-dump-1","status":"publish","type":"post","link":"https:\/\/www.cchsu.com\/arthur\/2009\/08\/28\/274\/","title":{"rendered":"\u5982\u4f55\u53d6\u6a23 memory dump (1)"},"content":{"rendered":"<p>\u5728<a href=\"http:\/\/www.cchsu.com\/arthur\/2009\/08\/26\/266\/\" target=\"_blank\">\u4e4b\u524d\u7684\u6587\u7ae0<\/a>\u88e1\uff0c\u6211\u5011\u5beb\u4e86\u4e00\u652f\u6703\u639b\u6389\u7684 HelloCrash \u7a0b\u5f0f\u3002\u7576\u7136\uff0c\u82e5\u662f\u5728\u958b\u767c\u9019\u652f\u7a0b\u5f0f\u7684\u6a5f\u5668\u4e0a\u8dd1\uff0c\u6211\u5011\u76f4\u63a5\u628a debugger \u9023\u4e0a\u53bb\u770b\u5c31\u53ef\u4ee5\u4e86\u3002\u4e0d\u904e\u5462\uff0c\u7406\u60f3\u662f\u7f8e\u9e97\u7684\uff0c\u73fe\u5be6\u662f\u6b98\u9177\u7684\uff0c\u5ba2\u4eba\u7684\u6a5f\u5668\u4e0a\u901a\u5e38\u6c92\u88dd VC++ .\u3002\u6211\u5011\u5df1\u7d93\u79c0\u904e\u600e\u9ebc\u6a23\u5f9e Windows \u4e8b\u4ef6\u8a18\u9304\u4e2d\u628a\u6709\u7528\u7684\u8cc7\u6599\u6316\u51fa\u4f86\uff0c\u4e0d\u904e\u5462\uff0c\u901a\u5e38\u9019\u4e9b\u8cc7\u6599\u662f\u4e0d\u5920\u7684\uff0c\u6bd4\u65b9\u8aaa\u7576\u6211\u5011\u9700\u8981\u77e5\u9053 register \u7684\u5167\u5bb9\u6642\u3002\u9060\u7aef\u9664\u932f\u5728\u67d0\u4e9b\u6642\u5019\u662f\u53ef\u884c\u7684\uff0c\u4e0d\u904e\u5927\u90e8\u4efd\u7684\u72c0\u6cc1\u4e0b\uff0c\u5149\u662f\u641e\u5b9a\u9632\u706b\u7246\u5c31\u662f\u500b\u5927\u554f\u984c\uff0c\u66f4\u5225\u63d0\u5ba2\u4eba\u662f\u4e0d\u662f\u6709\u8db3\u5920\u7684\u8010\u5fc3\u8b93\u4f60\u73a9\u4ed6\u7684\u6a5f\u5668\u6578\u5c0f\u6642\u4f86\u627e\u554f\u984c\u3002\u56e0\u6b64\u5728\u9019\u6a23\u7684\u60c5\u6cc1\u4e0b\uff0c\u6211\u5011\u5f97\u60f3\u60f3\u5225\u7684\u8fa6\u6cd5\uff0c\u901a\u5e38\u6703\u76f4\u63a5\u63a1\u6a23 memory dump\uff0c\u7136\u5f8c\u5e36\u56de\u5bb6\u5206\u6790\u3002<\/p>\n<p>\u5fae\u8edf\u5728<a href=\"http:\/\/support.microsoft.com\/kb\/286350\/zh-tw\">\u9019\u7bc7\u6587\u7ae0\u4e2d<\/a>\u8a73\u7d30\u5730\u89e3\u91cb\u4e86\u5982\u4f55\u4f7f\u7528 ADPlus \u4f86\u63a1\u6a23 memory dump\u3002ADPlus \u5305\u542b\u65bc <a href=\"http:\/\/www.microsoft.com\/whdc\/devtools\/debugging\/default.mspx\">Debugging Tools for Windows<\/a>\u3000\u5957\u4ef6\u4e2d\u3002\u63a5\u4e0b\u4f86\u5c31\u8b93\u6211\u5011\u7167\u5fae\u8edf\u6587\u7ae0\u4e2d\u7684\u6b65\u9a5f\u4f86\u6293\u6293\u770b HelloCrash\u3000\u7684\u554f\u984c\u5728\u54ea\u88e1\u3002\u9996\u5148\u88dd\u597d Debugging Tools for Windows\uff0c\u8b93 Hello Crash \u639b\u6389\uff0c\u6253\u958b\u4e00\u500b\u6709\u7ba1\u7406\u54e1\u6b0a\u9650\u7684\u547d\u4ee4\u5217\u63d0\u793a\uff0c\u8f38\u5165\u4ee5\u4e0b\u7684\u5167\u5bb9:<\/p>\n<blockquote><p>cd <em>&lt;Debugging Tools for Windows folder&gt;<\/em><br \/>\ntlist \/p HelloCrash.exe<br \/>\nadplus -crash -p <em>&lt;PID acquired from tlist \/p&gt;<\/em>\n<\/p><\/blockquote>\n<p>\u5728 Debugging Tools for Windows \u7684\u8cc7\u6599\u593e\u4e2d\u6703\u8dd1\u51fa\u4e00\u500b\u65b0\u7684\u76ee\u9304\uff0c\u88e1\u982d\u6709 memory dump\u3002\u63a5\u4e0b\u4f86\u6211\u5011\u6253\u958b WinDBG\uff0c\u9078 File->Open Crash Dump \u628a\u9019\u500b memory dump \u6253\u958b\u3002\u5e95\u4e0b\u662f\u6700\u5e38\u7528\u7684\u57fa\u672c\u5206\u6790\u65b9\u6cd5:<\/p>\n<blockquote><p><font face=\"courier\" size=\"1\"><br \/>\n0:000> <b><font color=\"green\">!analyze -v<\/font><\/b><br \/>\n*********************************************<br \/>\n*<br \/>\n* Exception Analysis<br \/>\n*<br \/>\n*********************************************<\/p>\n<p>FAULTING_IP:<br \/>\n+0<br \/>\n00000000 ??              ???<\/p>\n<p>EXCEPTION_RECORD:  ffffffff &#8212; (.exr 0xffffffffffffffff)<br \/>\nExceptionAddress: 00000000<br \/>\n   ExceptionCode: 80000003 (Break instruction exception)<br \/>\n  ExceptionFlags: 00000000<br \/>\nNumberParameters: 0<\/p>\n<p>FAULTING_THREAD:  000009c8<\/p>\n<p>DEFAULT_BUCKET_ID:  STATUS_BREAKPOINT<\/p>\n<p>PROCESS_NAME:  HelloCrash.exe<\/p>\n<p>ERROR_CODE: (NTSTATUS) 0x80000003 &#8211; {EXCEPTION}  Breakpoint  A breakpoint has been reached.<\/p>\n<p>NTGLOBALFLAG:  400<\/p>\n<p>APPLICATION_VERIFIER_FLAGS:  0<\/p>\n<p>LAST_CONTROL_TRANSFER:  from 77519e89 to 774f075a<\/p>\n<p><font color=blue>STACK_TEXT:<br \/>\n0035fcf0 77519e89 ffffffff c0000005 0035fd40 ntdll!ZwTerminateProcess+0x12<br \/>\n0035fd00 7754d058 c0000005 7c4c2188 00000000 ntdll!RtlExitUserProcess+0x7a<br \/>\n0035fd40 7754d1ff 001712c8 7efde000 00000000 ntdll!__RtlUserThreadStart+0x84<br \/>\n0035fd58 00000000 001712c8 7efde000 00000000 ntdll!_RtlUserThreadStart+0x1b<\/font><\/p>\n<p>STACK_COMMAND:  ~0s; .ecxr ; kb<\/p>\n<p>FOLLOWUP_IP:<br \/>\nntdll!ZwTerminateProcess+12<br \/>\n774f075a c20800          ret     8<\/p>\n<p>SYMBOL_STACK_INDEX:  0<\/p>\n<p>SYMBOL_NAME:  ntdll!ZwTerminateProcess+12<\/p>\n<p>FOLLOWUP_NAME:  MachineOwner<\/p>\n<p>MODULE_NAME: ntdll<\/p>\n<p>IMAGE_NAME:  ntdll.dll<\/p>\n<p>DEBUG_FLR_IMAGE_TIMESTAMP:  4791a783<\/p>\n<p>PRIMARY_PROBLEM_CLASS:  STATUS_BREAKPOINT<\/p>\n<p>BUGCHECK_STR:  <font color=\"blue\">APPLICATION_FAULT_STATUS_BREAKPOINT<\/font><\/p>\n<p>FAILURE_BUCKET_ID:  APPLICATION_FAULT_STATUS_BREAKPOINT_ntdll!ZwTerminateProcess+12<\/p>\n<p>BUCKET_ID:  APPLICATION_FAULT_STATUS_BREAKPOINT_ntdll!ZwTerminateProcess+12<\/p>\n<p>Followup: MachineOwner<br \/>\n&#8212;&#8212;&#8212;<\/p>\n<p><\/font><\/p><\/blockquote>\n<p>\u7b49\u7b49\uff0c\u9019\u7d50\u679c\u770b\u8d77\u4f86\u4e0d\u592a\u5c0d\u52c1\uff0c\u70ba\u4ec0\u9ebc\u81ea\u52d5\u5206\u6790\u7684\u7d50\u679c\u8dd1\u51fa\u4f86\u8aaa\u662f\u4e2d\u65b7\u9ede (breakpoint)?  \u53e6\u5916\u90a3\u500b stack \u4e5f\u4e0d\u5c0d\uff0c\u9019\u662f\u600e\u9ebc\u56de\u4e8b\u5462? \u9019\u90fd\u662f\u56e0\u70ba VC++ \u4f7f\u7528\u7684 secure CRT (\u5b89\u5168\u7684 C \u57f7\u884c\u7a0b\u5f0f\u5eab) \u5df2\u7d93\u81ea\u884c\u505a\u597d\u932f\u8aa4\u8655\u7406\uff0c\u4e26\u547c\u53eb\u4e86 TerminateProcess() \u51fd\u6578\u3002\u5728\u9019\u7a2e\u72c0\u6cc1\u4e0b\uff0c\u6211\u5011\u5fc5\u9808\u4fee\u6539\u4f7f\u7528 ADPlus \u7684\u65b9\u5f0f:<\/p>\n<blockquote><p>\nadplus -crash -bp kernel32!TerminateProcess -sc <em>&lt;full path of HelloCrash.exe&gt;<\/em>\n<\/p><\/blockquote>\n<p>\u5728 CRT \u547c\u53eb TerminateProcess() \u4e4b\u524d\u5c31\u4e2d\u65b7\u5b83\uff0c\u4e26\u63a1\u53d6 memory dump\u3002\u9019\u500b\u65b9\u6cd5\u5f97\u5230\u7684 memory dump \u7d93\u904e !analyze -v \u7684\u5206\u6790\u5c31\u6709\u7528\u591a\u4e86\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f7f\u7528 ADPlus \u53d6\u6a23\u6642\uff0c\u82e5\u662f\u76ee\u6a19\u7a0b\u5e8f\u6709\u7528\u5230 secure CRT \u7684\u8a71\uff0c\u9700\u8981\u7559\u610f\u4e00\u4e9b\u5c0f\u6280\u5de7 &#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[8,25,6,2],"tags":[],"_links":{"self":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/274"}],"collection":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/comments?post=274"}],"version-history":[{"count":4,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/274\/revisions"}],"predecessor-version":[{"id":283,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/posts\/274\/revisions\/283"}],"wp:attachment":[{"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/media?parent=274"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/categories?post=274"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.cchsu.com\/arthur\/wp-json\/wp\/v2\/tags?post=274"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}