added more overlay handler infos
[TortoiseGit.git] / src / crashrpt / excprpt.h
bloba89b949a3e0fb42d8ab01883a909aad1fb1ca321
1 ///////////////////////////////////////////////////////////////////////////////
2 //
3 // Module: excprpt.h
4 //
5 // Desc: This class generates the dump and xml overview files.
6 //
7 // Copyright (c) 2003 Michael Carruth
8 //
9 ///////////////////////////////////////////////////////////////////////////////
11 #pragma once
13 #include <dbghelp.h>
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)
24 #include <vector>
25 #pragma warning(pop)
27 // Import MSXML interfaces
28 #import "msxml6.dll" named_guids raw_interfaces_only
31 // COM helper macros
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 // ===========================================================================
40 // CExceptionReport
41 //
42 // See the module comment at top of file.
44 class CExceptionReport
46 public:
47 CExceptionReport(PEXCEPTION_POINTERS ExceptionInfo, BSTR message);
49 string getSymbolFile(int index);
50 int getNumSymbolFiles();
51 string getCrashLog();
52 string getCrashFile();
53 string getModuleName() { return m_sModule; };
54 string getExceptionCode() { return m_sException; };
55 string getExceptionAddr() { return m_sAddress; };
57 private:
58 string m_sCommandLine;
59 string m_sModule;
60 string m_sException;
61 string m_sAddress;
63 PEXCEPTION_POINTERS m_excpInfo;
64 BSTR m_message;
65 vector<string> m_symFiles;
67 // used by stack walkback
68 MSXML2::IXMLDOMElement* m_stack_element;
69 MSXML2::IXMLDOMDocument* m_stack_doc;
70 int m_frameNumber;
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,
81 int type,
82 BSTR bstrName);
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,
89 void *data);
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,
104 void *data);
106 static BOOL CALLBACK miniDumpCallback(PVOID CallbackParam,
107 CONST PMINIDUMP_CALLBACK_INPUT CallbackInput,
108 PMINIDUMP_CALLBACK_OUTPUT CallbackOutput);