{"id":451,"date":"2011-01-24T02:57:12","date_gmt":"2011-01-24T09:57:12","guid":{"rendered":"http:\/\/mattfife.net\/wordpress\/?p=451"},"modified":"2012-10-25T10:58:11","modified_gmt":"2012-10-25T17:58:11","slug":"how-to-debug-a-bluescreen-minidump","status":"publish","type":"post","link":"https:\/\/mattfife.com\/?p=451","title":{"rendered":"How to debug a Bluescreen minidump"},"content":{"rendered":"<p>So, your machine is bluescreen-ing on a semi-regular basis.\u00a0 It&#8217;s annoying the @#$% out of you, but you can&#8217;t find anything in the system logs that indicates what&#8217;s causing it.\u00a0 Maybe (like in my case) the computer in question is your DVR box and sometime during the night Media Center is waking up, trying to update a program guide, and then blue-screening.\u00a0 Nothing helpful is left in the logs, but you did get a minidump file.\u00a0 If you get a minidump, my friend, you are in business!<\/p>\n<ol>\n<li>Make sure you have a minidump file with your bluescreen.\u00a0 You should see a numbered file with the .dmp extension with the date\/time for the bluescreen located in\u00a0 <code>C:\\Windows\\Minidump<\/code><\/li>\n<li>Download a handy free tool called <a href=\"http:\/\/www.nirsoft.net\/utils\/blue_screen_view.html\" target=\"_blank\">BlueScreenView <\/a>by Nirsoft.\u00a0 This handy tool will automatically decipher a minidump file and you can verify that it matched what you saw on the blue-screen.\u00a0 It won&#8217;t give you everything you need, but it will tell you if you have the right mini-dump for the crash you saw.  It also shows you the codes thrown so you don&#8217;t have to write them down by hand at the bluescreen.\u00a0 You&#8217;ll note that often BlueScreenView reports a source of the error (ntkrnl.exe in my case) but this is usually NOT the real root cause.\u00a0 As we&#8217;ll soon find out, the high-level source it cites isn&#8217;t always the real problem, but was a module loaded BY that source or the module in which the source was loaded.<\/li>\n<li>Do these one-time setup steps.\u00a0 In order to make sense of the minidumps, you need some tools provided by Microsoft:\n<ol>\n<li>Download and install the <a href=\"http:\/\/www.microsoft.com\/whdc\/devtools\/debugging\/default.mspx\" target=\"_blank\">Debugging Tools for Windows <\/a>pack.\u00a0 Make sure it gives you the right version for your OS (win7 x64, vista x32, etc).\u00a0 This pack contains the kernel debugging tools you&#8217;ll need.<\/li>\n<li>windbg.exe will likely be installed in <code>c:\\program files\\Debugging Tools for Windows (x64)<\/code> (or whatever x32\/x64 you have)<\/li>\n<li>Open a command prompt as administrator, CD to the windbg.exe directory<\/li>\n<li>run:<br \/>\n<code>windbg.exe -IA<\/code><br \/>\nwindbg will start up, and inform you that it is now the registered file association handler for all dump files. Close windbg.exe<\/li>\n<li>Restart windbg, and go to file-&gt;Symbol File Path<\/li>\n<li>Enter:<br \/>\n<code>SRV*C:\\Development\\SymCache*http:\/\/msdl.microsoft.com\/download\/symbols<\/code><br \/>\nYou can set the local directory (<code>'C:\\Development\\symcache'<\/code> in my case) to whatever you want, but everything following the rest must be exact.\u00a0 This instructs windbg to load the needed symbols from Microsoft&#8217;s internet site (release modules usually don&#8217;t have symbols, and letting you recompile your own kernel by giving the source out isn&#8217;t something MS usually lets you do. :))  Whenever you debug something and windbg needs the symbols, it checks your cache location first and downloads the needed symbols if they are not found and stores them  in the cache.\u00a0 So the more you debug the more symbols you build up and faster future debugging will go.\u00a0 Exit windbg and save the settings.<\/li>\n<\/ol>\n<\/li>\n<li>Open windbg.exe (again), and do a file-&gt;open dump and open the minidump in <code>c:\\windows\\minidump<\/code> that corresponds to the bluescreen you&#8217;re trying to debug.\u00a0 You might need to be administrator when starting windbg.<\/li>\n<li>Windbg will automatically start downloading symbols, and doing some basic analysis.\u00a0 It may look like it&#8217;s done\/just sitting there sometimes, but don&#8217;t do anything until you see it&#8217;s &#8216;diagnosis&#8217;.\u00a0 Usually looking like this:<br \/>\n<code>Use !analyze -v to get detailed debugging information.<br \/>\nBugCheck 9F, {3, fffffa800af7f440, fffff80000b9c4d8, fffffa800745f860}<br \/>\nProbably caused by : usbhub.sys<\/code><\/li>\n<li>But don&#8217;t take this as the final word on the crash source and send nasty letters to the usbhub.sys driver writer!\u00a0 Type !analyze -v as it suggest, and you&#8217;ll likely get a more detailed analysis, like this:<code><br \/>\nDRIVER_POWER_STATE_FAILURE (9f)<br \/>\nA driver is causing an inconsistent power state.<br \/>\nArguments:<br \/>\nArg1: 0000000000000003, A device object has been blocking an Irp for too long a time<br \/>\nArg2: fffffa800af7f440, Physical Device Object of the stack<br \/>\nArg3: fffff80000b9c4d8, Functional Device Object of the stack<br \/>\nArg4: fffffa800745f860, The blocked IRP<br \/>\nDebugging Details:<br \/>\n------------------<br \/>\nDRVPOWERSTATE_SUBCODE: 3 IMAGE_NAME: usbhub.sys<br \/>\nDEBUG_FLR_IMAGE_TIMESTAMP: 4a5bcc2d<br \/>\nMODULE_NAME: usbhub<br \/>\nFAULTING_MODULE: fffff8800767a000 usbhub<br \/>\nCUSTOMER_CRASH_COUNT: 1<br \/>\nDEFAULT_BUCKET_ID: VISTA_DRIVER_FAULT<br \/>\nBUGCHECK_STR: 0x9F<br \/>\nPROCESS_NAME: System<br \/>\nCURRENT_IRQL: 2<br \/>\n<\/code><br \/>\n<code><br \/>\nSTACK_TEXT:<br \/>\nfffff800`00b9c488 fffff800`02ef3273 : 00000000`0000009f 00000000`00000003 fffffa80`0af7f440 fffff800`00b9c4d8 : nt!KeBugCheckEx<br \/>\nfffff800`00b9c490 fffff800`02e9029e : fffff800`00b9c5c0 fffff800`00b9c5c0 00000000`00000001 00000000`00000000 : nt! ?? ::FNODOBFM::`string'+0x292b0<br \/>\nfffff800`00b9c530 fffff800`02e8fdd6 : fffff800`03034700 00000000`00146bde 00000000`00000000 00000000`00000000 : nt!KiProcessTimerDpcTable+0x66<br \/>\nfffff800`00b9c5a0 fffff800`02e904be : 00000030`9c591870 fffff800`00b9cc18 00000000`00146bde fffff800`03002e48 : nt!KiProcessExpiredTimerList+0xc6<br \/>\nfffff800`00b9cbf0 fffff800`02e8fcb7 : 00000010`31b602c1 00000010`00146bde 00000010`31b602f2 00000000`000000de : nt!KiTimerExpiration+0x1be<br \/>\nfffff800`00b9cc90 fffff800`02e8ceea : fffff800`02ffee80 fffff800`0300cc40 00000000`00000002 fffff880`00000000 : nt!KiRetireDpcList+0x277<br \/>\nfffff800`00b9cd40 00000000`00000000 : fffff800`00b9d000 fffff800`00b97000 fffff800`00b9cd00 00000000`00000000 : nt!KiIdleLoop+0x5a<\/code><br \/>\n<code>STACK_COMMAND: kb<br \/>\nFOLLOWUP_NAME: MachineOwner<br \/>\nFAILURE_BUCKET_ID: X64_0x9F_3_AiCharger_IMAGE_usbhub.sys<br \/>\nBUCKET_ID: X64_0x9F_3_AiCharger_IMAGE_usbhub.sys<\/code><\/li>\n<\/ol>\n<p>Now we see the whole story.\u00a0 We see that in the usbhub.sys device driver, something listed in it&#8217;s &#8216;DPC&#8217; table failed to respond in time to some request the usbhub.sys made.\u00a0 That process was put on the timer expiration list which threw the bluescreen.\u00a0 Since usbhub.sys is a hub with many things plugged into it, odds are good that the DPC list is the list of device drivers for each device plugged into the hub, a list of events that need handling, or a list of devices themselves.\u00a0 When we look at the &#8216;failure bucket&#8217; we see the AiCharger_IMAGE_usbhub.sys device was the source of the failure.\u00a0 Odds are good the usbhub.sys is loading &#8216;images&#8217; that contain the device&#8217;s driver for each of the devices plugged into the hub; and the one that failed in this case has the name AiCharger.\u00a0\u00a0 If I look in my Device Manager in Windows, I find a driver called AiCharger.sys &#8211; under the USB devices.\u00a0 Ah ha!\u00a0 A quick Google reveals this is a driver that enables smart\/high-speed USB charging of iPhone\/iPod devices on my Asus motherboard. If I go one step further, I can speculate that the bug is in the portion of the driver that is supposed to respond to sleep\/wake\/power events and that somehow the call to wake up the iPhone I have plugged in isn&#8217;t responding.\u00a0 Dang &#8211; Asus owes me a donut for doing all the work for them.<\/p>\n<p>So, now you know who&#8217;s really responsible.\u00a0 You send a bug note to Asus with the dump results and un-install the AiCharger tool\/stop leaving your iPhone connected at night to the machine when it&#8217;s asleep until they get a fix for AiCharger.\u00a0 You also find out that someone else already had the <a href=\"http:\/\/social.answers.microsoft.com\/Forums\/en-US\/w7repair\/thread\/107b8ec1-45f0-4e2f-9a17-cbe38f86bb14\" target=\"_blank\">same problem<\/a>&#8230;<br \/>\nThere are many other debugging commands you can also use, and those are all <a href=\"http:\/\/www.sevenforums.com\/crash-lockup-debug-how\/26584-configuring-debugging-tools.html\" target=\"_blank\">outlined here<\/a>.\u00a0 Hopefully this will help YOU out the next time some crazy bluescreen you can&#8217;t figure out; and you won&#8217;t be re-installing the OS to get rid of it.<\/p>\n<p><strong>Protips:<\/strong> 99% of the time, bluescreens are usually a driver and not something in the actual Windows system.\u00a0 Especially if they are repeatable.\u00a0 Always get the latest drivers first.<br \/>\nWhen the crashes are wake\/sleep\/resume\/power related, often you should go to the device driver in the Device Manager and uncheck any &#8216;allow system to turn off the power of this device&#8217; as a second step if the latest driver doesn&#8217;t solve it.\u00a0 This prevents Windows from making calls into possibly faulty driver code.\u00a0 Power mangament issues are very common with drivers still.<br \/>\nIf you get dumps and the crashes are different places every time or random in timing &#8211; then you might have bad memory or a bad motherboard that&#8217;s corrupting things.\u00a0 Check heat sinks or temps and possibly change ram\/mb&#8217;s.<\/p>\n<p><strong>Other resources:<\/strong><br \/>\n-The official Microsoft list of bluescreen failure codes with documentation on each one:<br \/>\n<a href=\"http:\/\/msdn.microsoft.com\/en-us\/library\/ff542347%28v=VS.85%29.aspx\" target=\"_blank\">http:\/\/msdn.microsoft.com\/en-us\/library\/ff542347%28v=VS.85%29.aspx<\/a><\/p>\n<p>-Another list of the various bluescreen failure codes and their plaintext sub-code descriptions with some notes from external folks:<br \/>\n<a href=\"http:\/\/www.faultwire.com\/solutions_index\/fatal_error-1.html#IssueList\" target=\"_blank\">http:\/\/www.faultwire.com\/solutions_index\/fatal_error-1.html#IssueList<\/a><\/p>\n<p>-Microsoft Answers forum that has really responsive and informative threads on just about every blue-screen investigation ever done.\u00a0 These guys chew up minidumps all day and can help you track down just about anything that&#8217;s going on (if just searching the forum doesn&#8217;t do it for you automatically):<br \/>\n<a href=\"http:\/\/social.answers.microsoft.com\/Forums\/en-US\/w7repair\/threads\" target=\"_blank\">http:\/\/social.answers.microsoft.com\/Forums\/en-US\/w7repair\/threads <\/a><\/p>\n<p>-Another Microsoft forum that seems to do a fair amount of this kind of debug work:<br \/>\n<a href=\"http:\/\/social.technet.microsoft.com\/Forums\/en\/w7itproperf\/threads\" target=\"_blank\">http:\/\/social.technet.microsoft.com\/Forums\/en\/w7itproperf\/threads<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>So, your machine is bluescreen-ing on a semi-regular basis.\u00a0 It&#8217;s annoying the @#$% out of you, but you can&#8217;t find anything in the system logs that indicates what&#8217;s causing it.\u00a0 Maybe (like in my case) the computer in question is your DVR box and sometime during the night Media Center is waking up, trying to update a program guide, and then blue-screening.\u00a0 Nothing helpful is left in the logs, but you did get a minidump file.\u00a0 If you get a&#8230;<\/p>\n<p class=\"read-more\"><a class=\"btn btn-default\" href=\"https:\/\/mattfife.com\/?p=451\"> Read More<span class=\"screen-reader-text\">  Read More<\/span><\/a><\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"jetpack_post_was_ever_published":false,"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2}},"categories":[7],"tags":[],"class_list":["post-451","post","type-post","status-publish","format-standard","hentry","category-technicalprogramming"],"jetpack_publicize_connections":[],"jetpack_featured_media_url":"","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p4WECr-7h","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/451","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=451"}],"version-history":[{"count":5,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/451\/revisions"}],"predecessor-version":[{"id":724,"href":"https:\/\/mattfife.com\/index.php?rest_route=\/wp\/v2\/posts\/451\/revisions\/724"}],"wp:attachment":[{"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=451"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=451"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mattfife.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=451"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}