2009-08-25 7 views
1

Un de nos clients a signalé un incident. Elle a vu le message d'erreur standard après une exception non gérée:Utilisation de WinDbg pour inspecter les paramètres de la méthode dans la mémoire brute de Crash Dump

"L'application a généré une exception qui n'a pas pu être gérée ... Cliquez sur OK pour terminer l'application.Cliquez sur ANNULER pour déboguer l'application."

J'ai utilisé DebugDiag pour générer un vidage de ce processus. Je regarde la décharge maintenant.

! Threads m'a montré une exception dans mon thread géré. Il y avait plusieurs exceptions imbriquées. Celui-ci était au fond:

0:000> !pe -nested 
... 
Nested exception ------------------------------------------------------------- 
Exception object: 14015a98 
Exception type: System.AccessViolationException 
Message: Attempted to read or write protected memory. This is often an indication that other memory is corrupt. 
InnerException: <none> 
StackTrace (generated): 
    SP  IP  Function 
    0013E958 7B6EEF3B System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.OnThreadException(System.Exception)+0x8b 
    0013E994 7B6F7916 System_Windows_Forms_ni!System.Windows.Forms.Control.WndProcException(System.Exception)+0x16 
    0013E9A0 7B6FA39C System_Windows_Forms_ni!System.Windows.Forms.Control+ControlNativeWindow.OnThreadException(System.Exception)+0xc 
    0013E9A4 7B1C8512 System_Windows_Forms_ni!System.Windows.Forms.NativeWindow.Callback(IntPtr, Int32, IntPtr, IntPtr)+0x72 
    0013EC70 7B1D8D2E System_Windows_Forms_ni!System.Windows.Forms.Application+ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(Int32, Int32, Int32)+0x24e 
    0013ED0C 7B1D8997 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoopInner(Int32, System.Windows.Forms.ApplicationContext)+0x177 
    0013ED60 7B1D87E1 System_Windows_Forms_ni!System.Windows.Forms.Application+ThreadContext.RunMessageLoop(Int32, System.Windows.Forms.ApplicationContext)+0x61 
    0013ED90 7B6EDE2B System_Windows_Forms_ni!System.Windows.Forms.Application.RunDialog(System.Windows.Forms.Form)+0x33 
    0013EDA4 7B7225AB System_Windows_Forms_ni!System.Windows.Forms.Form.ShowDialog(System.Windows.Forms.IWin32Window)+0x373 
    0013EE30 0DF41E76 PDILibReportProcessor!profdata.com.Library.libReportRenderCrystal.RenderToDisplay(System.Windows.Forms.IWin32Window, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig)+0xb6 
    0013EE4C 0DF416EB PDILibReportProcessor!profdata.com.Library.libReportProcessor.Process(System.Windows.Forms.IWin32Window)+0x153 
    0013EE60 07B37644 PDILibReportProcessor!profdata.com.Library.libReportProcessor.ProcessCrystalReport(System.String, System.Type, System.Data.DataSet, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig, System.Windows.Forms.IWin32Window, System.String)+0x74 
    0013EEA4 07B375B8 PDILibReportProcessor!profdata.com.Library.libReportProcessor.ProcessReport(System.String, System.Type, System.Data.DataSet, profdata.com.Library.libOutputSettings, profdata.com.Library.libApplicationConfig, System.Windows.Forms.IWin32Window)+0x18 
    0013EEB8 07B333C4 APRPTCashRequirements!profdata.com.AccountsPayable.frmAPCashRequirements.RunProcessOrReport()+0x7e4 

StackTraceString: <none> 
HResult: 80004003 

Le code a affiché un rapport Crystal à l'utilisateur sous une forme. Lors de l'affichage du rapport, l'application a tenté de faire quelque chose et a obtenu une exception System.AccessViolationException.

regardant la source NativeWindow.CallBack, je vois ceci:

private IntPtr Callback(IntPtr hWnd, int msg, IntPtr wparam, IntPtr lparam) 
{ 
    Message m = Message.Create(hWnd, msg, wparam, lparam); 
    try 
    { 
     // calls WndProc or DefWndProc 
    } 
    catch (Exception exception) 
    { 
     this.OnThreadException(exception); 
    } 
    finally {...} 
} 

Je veux connaître le message, wParam et arguments lParam qui ont provoqué l'exception. (Je voudrais également vérifier que je regarde l'objet d'exception correct.) Cela peut être une invocation dans le thread d'interface utilisateur, ou il peut s'agir d'un événement Windows normal, auquel cas je veux savoir lequel.

J'ai obtenu le bloc d'environnement de fil:

0:000> !teb 
TEB at 7ffdf000 
    ExceptionList:  00134144 
    StackBase:   00140000 
    StackLimit:   00130000 

Et déversée la mémoire de la pile:

0:000> !dqs 00130000 00140000 
... 
0013e968 00000000`00000000 
0013e970 00000000`00000000 
0013e978 00000000`00000000 
0013e980 140ea9fc`00000000 
0013e988 0013e998`0013ea44 
0013e990 140c1d4c`7b6f7916 
0013e998 7b6fa39c`0013ea54 <--- is NativeWindow.Callback 
0013e9a0 0013ea6c`7b1c8512 
0013e9a8 0013ec60`79edd757 
0013e9b0 0013ec60`00000000 
0013e9b8 0013ea6c`e0434f4d 
0013e9c0 00000000`0013ea1c 
0013e9c8 00000000`00000000 
... 

Donc, si la signature est la suivante: SP IP 0013E9A4 7B1C8512 NativeWindow.CallBack (IntPtr, Int32, IntPtr, IntPtr) + 0x72

  1. Où exactement sont les ameters sur la pile? Comment puis-je les inspecter pour obtenir leurs valeurs?

Je n'ai toujours pas l'impression d'avoir trouvé la cause première. Nous avons un gestionnaire ThreadException. Pourquoi n'a-t-il pas été appelé? Qu'est-ce qui a causé le System.AccessViolationException?

Notez que !analyze -v a signalé STATUS_BREAKPOINT, car l'utilisateur est arrêté dans la boîte de dialogue d'erreur "L'application a généré une exception ...".

Répondre

3

Vous devez d'abord définir le contexte dans le contexte d'exception:

.ecxr 

faire alors que vous avez un sympath qui télécharge derniers symboles publics pour tous les modules NT, avec un chemin de cache local:

.sympath srv*C:\<cache>\sym*http://msdl.microsoft.com/download/symbols 

Ces étapes doivent garantir que vous obtenez une pile native correcte de k, qui doit également refléter dans la pile gérée. Pour obtenir les paramètres pour les trames natives sans symboles privés est difficile, vous devez essentiellement les reconstruire à partir de la pile en connaissant la convention d'appel et les positions des paramètres.Un simple dv ne fonctionnera pas avec les symboles publics.

En ce qui concerne la question du gestionnaire ThreadException, avez-vous mis l'Application.SetUnhandledExceptionMode à CatchException?

+1

Si vous êtes pressé, .symfix se régler plus rapidement :) –

+0

Ou mettre _NT_SYMBOL_PATH pour tous les utilisateurs et ne plus jamais vous inquiétez pas;) –

+0

Problème: Je crée la décharge alors qu'il était à un point d'arrêt. Si j'essaie .ecxr, j'obtiens "Minidump n'a pas de contexte d'exception". Le chemin du symbole est défini. Le mode d'exception non géré est Automatique et n'est pas désactivé par le fichier de configuration. –

0

Si tout ce que vous voulez est le message de la fenêtre, tirez d'un des cadres natifs en utilisant dv/V

Edit: Le fait que vous chasse AccessViolationException signifie que vous devriez être certainement recherche à la pile native en utilisant kn100 et .frame pour comprendre l'AV réelle

0

kn100 retourne la pile ci-dessous. Je ne suis pas sûr de ce qu'il faut faire ici. Définir le .frame à où? Et puis faire quoi?

L'application est un grand C# WinForms client. Nous n'avons pas écrit de code natif. Je peux habituellement diagnostiquer les exceptions non gérées dans notre code assez rapidement, mais c'est la première erreur native j'ai essayé de diagnostiquer.

00 00132d4c 7739bf53 ntdll!KiFastSystemCallRet 
01 00132d84 7738965e user32!NtUserWaitMessage+0xc 
02 00132dac 7739f762 user32!InternalDialogBox+0xd0 
03 0013306c 7739f047 user32!SoftModalMessageBox+0x94b 
04 001331bc 7739eec9 user32!MessageBoxWorker+0x2ba 
05 00133214 7739ee65 user32!MessageBoxTimeoutW+0x7a 
06 00133234 7739ee41 user32!MessageBoxExW+0x1b 
07 00133250 7a14c82e user32!MessageBoxW+0x45 
08 00133274 7a1507ae mscorwks!WszMessageBox+0x8b 
09 00134150 7a1509ea mscorwks!UtilMessageBoxNonLocalizedVA+0x351 
0a 001341d4 7a2cea8d mscorwks!UtilMessageBoxVA+0x6b 
0b 001341f4 7a2cf209 mscorwks!Debugger::MessageBox+0x1a 
0c 00134230 7a2d2cae mscorwks!Debugger::NotifyUserOfFault+0x65 
0d 00134270 7a2d5c67 mscorwks!Debugger::ShouldAttachDebugger+0xa2 
0e 001342b4 7a2d95fa mscorwks!Debugger::ShouldAttachDebuggerProxy+0x66 
0f 001342c0 7a0974d1 mscorwks!Debugger::FallbackJITAttachPrompt+0x9 
10 001342dc 7a09c0c7 mscorwks!WatsonLastChance+0x63 
11 00134334 7a09c173 mscorwks!CLRAddVectoredHandlers+0x209 
12 0013433c 7c35f0c3 mscorwks!InternalUnhandledExceptionFilter+0x22 
13 00134348 61585e4e msvcr71!__CxxUnhandledExceptionFilter+0x46 
WARNING: Stack unwind information not available. Following frames may be wrong. 
14 00134620 77e76a20 SACommLayer_RES_EN!GetResDllVersion+0x4e2e 
15 00134628 77e61ac1 kernel32!BaseProcessStart+0x39 
16 00134650 7c828772 kernel32!_except_handler3+0x61 
17 00134674 7c828743 ntdll!ExecuteHandler2+0x26 
18 0013471c 7c82865c ntdll!ExecuteHandler+0x24 
19 001349fc 77e4bef7 ntdll!RtlRaiseException+0x3d 
1a 00134a5c 7a1997f7 kernel32!RaiseException+0x53 
1b 00134a74 7a1915c4 mscorwks!RtlRaiseStatus+0x13 
1c 00134a7c 79e9a8a9 mscorwks!_purecall+0xa 
1d 00134a8c 79e9a92c mscorwks!MethodDataCache::FindHelper+0x17 
1e 00134ac4 79e8a9b0 mscorwks!MethodDataCache::Find+0x52 
1f 00134b00 79e8aa6a mscorwks!MethodTable::GetMethodDataHelper+0x23 
20 00134b38 79e8aab3 mscorwks!MethodTable::GetMethodData+0x1a 
21 00134b50 79e8aad9 mscorwks!MethodTable::MethodIterator::Init+0x13 
22 00134b64 79e8b677 mscorwks!MethodTable::MethodIterator::MethodIterator+0x11 
23 00134bb4 79e8b874 mscorwks!EEClass::FindMethod+0x38 
24 00134c38 79e89332 mscorwks!MemberLoader::GetDescFromMemberDefOrRefThrowing+0x3e8 
25 00134ec0 79fc44bf mscorwks!MemberLoader::GetMethodDescFromMemberDefOrRefOrSpecThrowing+0x219 
26 00134f88 79fc43cf mscorwks!CEEInfo::findMethodInternal+0x12a 
27 00134ff4 79062ea6 mscorwks!CEEInfo::findMethod+0xc4 
28 0013500c 79062fa9 mscorjit!Compiler::eeFindMethod+0x22 
29 001350f4 790633e8 mscorjit!Compiler::impImportCall+0xda 
2a 001356fc 790643a1 mscorjit!Compiler::impImportBlockCode+0x2bbb 
2b 00135774 790644d6 mscorjit!Compiler::impImportBlock+0x1df 
2c 0013578c 7906465c mscorjit!Compiler::impImport+0xe2 
2d 00135798 7906467a mscorjit!Compiler::fgImport+0x20 
2e 001357a8 79065b8e mscorjit!Compiler::compCompile+0xc 
2f 001357f4 79065d33 mscorjit!Compiler::compCompile+0x44f 
30 0013587c 79066448 mscorjit!jitNativeCode+0xef 
31 001358a0 79fc722c mscorjit!CILJit::compileMethod+0x25 
32 0013590c 79fc72c5 mscorwks!invokeCompileMethodHelper+0x72 
33 00135950 79fc7338 mscorwks!invokeCompileMethod+0x31 
34 001359a4 79fc70ad mscorwks!CallCompileMethodWithSEHWrapper+0x5b 
35 00135d4c 79fc6e6f mscorwks!UnsafeJitFunction+0x31b 
36 00135df0 79e811eb mscorwks!MethodDesc::MakeJitWorker+0x1a8 
37 00135e48 79e813ab mscorwks!MethodDesc::DoPrestub+0x41b 
38 00135e98 00361efe mscorwks!PreStubWorker+0xf3 
39 00135eb0 7b6eef3b 0x361efe 
3a 00135f10 7b6f7916 System_Windows_Forms_ni+0x71ef3b 
3b 00135f1c 7b6fa39c System_Windows_Forms_ni+0x727916 
3c 0013f17c 7739b6e3 System_Windows_Forms_ni+0x72a39c 
3d 0013f1a8 7739b874 user32!InternalCallWinProc+0x28 
3e 0013f220 7739ba92 user32!UserCallWinProcCheckWow+0x151 
3f 0013f288 7739bad0 user32!DispatchMessageWorker+0x327 
40 0013f298 03c341d2 user32!DispatchMessageW+0xf 
41 0013f2b4 7b1d8d2e 0x3c341d2 
42 0013f368 7b1d8997 System_Windows_Forms_ni+0x208d2e 
43 0013f3c0 7b1d87e1 System_Windows_Forms_ni+0x208997 
44 0013f3f0 7b195931 System_Windows_Forms_ni+0x2087e1 
45 0013f480 79e71b4c System_Windows_Forms_ni+0x1c5931 
46 0013f490 79e821f9 mscorwks!CallDescrWorker+0x33 
47 0013f510 79e96571 mscorwks!CallDescrWorkerWithHandler+0xa3 
48 0013f648 79e965a4 mscorwks!MethodDesc::CallDescr+0x19c 
49 0013f664 79e965c2 mscorwks!MethodDesc::CallTargetWorker+0x1f 
4a 0013f67c 79eefac5 mscorwks!MethodDescCallSite::CallWithValueTypes+0x1a 
4b 0013f7e0 79eef9e5 mscorwks!ClassLoader::RunMain+0x223 
4c 0013fa48 79eeff35 mscorwks!Assembly::ExecuteMainMethod+0xa6 
4d 0013ff18 79ef011f mscorwks!SystemDomain::ExecuteMainMethod+0x456 
4e 0013ff68 79ef004f mscorwks!ExecuteEXE+0x59 
4f 0013ffb0 79007c24 mscorwks!_CorExeMain+0x15c 
50 0013ffc0 77e6f23b mscoree!_CorExeMain+0x2c 
51 0013fff0 00000000 kernel32!BaseProcessStart+0x23 
Questions connexes