1 ///////////////////////////////////////////////////////////////////////////////
5 // Desc: This class generates the dump and xml overview files.
7 // Copyright (c) 2003 Michael Carruth
9 ///////////////////////////////////////////////////////////////////////////////
14 // STL generates various warnings.
15 // 4100: unreferenced formal parameter
16 // 4663: C++ language change: to explicitly specialize class template...
17 // 4018: signed/unsigned mismatch
18 // 4245: conversion from <a> to <b>: signed/unsigned mismatch
19 #pragma warning(push, 3)
20 #pragma warning(disable: 4100)
21 #pragma warning(disable: 4663)
22 #pragma warning(disable: 4018)
23 #pragma warning(disable: 4245)
27 // Import MSXML interfaces
28 #import "msxml6.dll" named_guids raw_interfaces_only
33 #define CHECKHR(x) {HRESULT hr = x; if (FAILED(hr)) goto CleanUp;}
34 #define SAFERELEASE(p) {if (p) {(p)->Release(); p = NULL;}}
37 ////////////////////////////// Class Definitions /////////////////////////////
39 // ===========================================================================
42 // See the module comment at top of file.
44 class CExceptionReport
47 CExceptionReport(PEXCEPTION_POINTERS ExceptionInfo
, BSTR message
);
49 string
getSymbolFile(int index
);
50 int getNumSymbolFiles();
52 string
getCrashFile();
53 string
getModuleName() { return m_sModule
; };
54 string
getExceptionCode() { return m_sException
; };
55 string
getExceptionAddr() { return m_sAddress
; };
58 string m_sCommandLine
;
63 PEXCEPTION_POINTERS m_excpInfo
;
65 vector
<string
> m_symFiles
;
67 // used by stack walkback
68 MSXML2::IXMLDOMElement
* m_stack_element
;
69 MSXML2::IXMLDOMDocument
* m_stack_doc
;
72 // used by exception node creation, symbol translations
73 MSXML2::IXMLDOMElement
* m_exception_element
;
75 // used by dump callback
76 std::vector
<MINIDUMP_MODULE_CALLBACK
> m_modules
;
78 static void writeDumpFile(HANDLE file
, PEXCEPTION_POINTERS m_excpInfo
, void *data
);
80 MSXML2::IXMLDOMNode
* CreateDOMNode(MSXML2::IXMLDOMDocument
* pDoc
,
84 MSXML2::IXMLDOMNode
* CreateExceptionRecordNode(MSXML2::IXMLDOMDocument
* pDoc
,
85 EXCEPTION_RECORD
* pExceptionRecord
);
86 static void CreateExceptionSymbolAttributes(DWORD_PTR address
, const char *ImageName
,
87 const char *FunctionName
, DWORD_PTR functionDisp
,
88 const char *Filename
, DWORD LineNumber
, DWORD lineDisp
,
91 MSXML2::IXMLDOMNode
* CreateProcessorNode(MSXML2::IXMLDOMDocument
* pDoc
);
93 MSXML2::IXMLDOMNode
* CreateOSNode(MSXML2::IXMLDOMDocument
* pDoc
);
95 MSXML2::IXMLDOMNode
* CreateModulesNode(MSXML2::IXMLDOMDocument
* pDoc
);
97 MSXML2::IXMLDOMNode
* CreateMsgNode(MSXML2::IXMLDOMDocument
* pDoc
, BSTR message
);
99 MSXML2::IXMLDOMNode
* CreateWalkbackNode(MSXML2::IXMLDOMDocument
* pDoc
, CONTEXT
*pContext
);
101 static void CreateWalkbackEntryNode(DWORD_PTR address
, const char *ImageName
,
102 const char *FunctionName
, DWORD_PTR functionDisp
,
103 const char *Filename
, DWORD LineNumber
, DWORD lineDisp
,
106 static BOOL CALLBACK
miniDumpCallback(PVOID CallbackParam
,
107 CONST PMINIDUMP_CALLBACK_INPUT CallbackInput
,
108 PMINIDUMP_CALLBACK_OUTPUT CallbackOutput
);