[FEATURE] Add minidump feature. Make sure that at every release, PDB and exe binaries are saved.
git-svn-id: svn://svn.tuxfamily.org/svnroot/notepadplus/repository@406 f5eea248-9336-0410-98b8-ebc06183d4e3
This commit is contained in:
parent
6fe5d8ac78
commit
8dcd31a77d
@ -7,10 +7,11 @@
|
|||||||
#include "Win32Exception.h"
|
#include "Win32Exception.h"
|
||||||
#include "eh.h"
|
#include "eh.h"
|
||||||
|
|
||||||
Win32Exception::Win32Exception(const EXCEPTION_RECORD * info) {
|
Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) {
|
||||||
_location = info->ExceptionAddress;
|
_location = info->ExceptionRecord->ExceptionAddress;
|
||||||
_code = info->ExceptionCode;
|
_code = info->ExceptionRecord->ExceptionCode;
|
||||||
switch (info->ExceptionCode) {
|
_info = info;
|
||||||
|
switch (_code) {
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
_event = "Access violation";
|
_event = "Access violation";
|
||||||
break;
|
break;
|
||||||
@ -35,14 +36,14 @@ void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS * info) {
|
|||||||
// Windows guarantees that *(info->ExceptionRecord) is valid
|
// Windows guarantees that *(info->ExceptionRecord) is valid
|
||||||
switch (code) {
|
switch (code) {
|
||||||
case EXCEPTION_ACCESS_VIOLATION:
|
case EXCEPTION_ACCESS_VIOLATION:
|
||||||
throw Win32AccessViolation(info->ExceptionRecord);
|
throw Win32AccessViolation(info);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
throw Win32Exception(info->ExceptionRecord);
|
throw Win32Exception(info);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Win32AccessViolation::Win32AccessViolation(const EXCEPTION_RECORD * info) : Win32Exception(info) {
|
Win32AccessViolation::Win32AccessViolation(EXCEPTION_POINTERS * info) : Win32Exception(info) {
|
||||||
_isWrite = info->ExceptionInformation[0] == 1;
|
_isWrite = info->ExceptionRecord->ExceptionInformation[0] == 1;
|
||||||
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionInformation[1]);
|
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionRecord->ExceptionInformation[1]);
|
||||||
}
|
}
|
||||||
|
@ -16,16 +16,19 @@ public:
|
|||||||
static void removeHandler();
|
static void removeHandler();
|
||||||
virtual const char* what() const throw() { return _event; };
|
virtual const char* what() const throw() { return _event; };
|
||||||
ExceptionAddress where() const { return _location; };
|
ExceptionAddress where() const { return _location; };
|
||||||
unsigned code() const { return _code; };
|
unsigned int code() const { return _code; };
|
||||||
|
EXCEPTION_POINTERS* info() const { return _info; };
|
||||||
|
|
||||||
protected:
|
protected:
|
||||||
Win32Exception(const EXCEPTION_RECORD * info); //Constructor only accessible by exception handler
|
Win32Exception(EXCEPTION_POINTERS * info); //Constructor only accessible by exception handler
|
||||||
static void translate(unsigned code, EXCEPTION_POINTERS * info);
|
static void translate(unsigned code, EXCEPTION_POINTERS * info);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
const char * _event;
|
const char * _event;
|
||||||
ExceptionAddress _location;
|
ExceptionAddress _location;
|
||||||
unsigned int _code;
|
unsigned int _code;
|
||||||
|
|
||||||
|
EXCEPTION_POINTERS * _info;
|
||||||
};
|
};
|
||||||
|
|
||||||
class Win32AccessViolation: public Win32Exception
|
class Win32AccessViolation: public Win32Exception
|
||||||
@ -34,7 +37,7 @@ public:
|
|||||||
bool isWrite() const { return _isWrite; };
|
bool isWrite() const { return _isWrite; };
|
||||||
ExceptionAddress badAddress() const { return _badAddress; };
|
ExceptionAddress badAddress() const { return _badAddress; };
|
||||||
private:
|
private:
|
||||||
Win32AccessViolation(const EXCEPTION_RECORD * info);
|
Win32AccessViolation(EXCEPTION_POINTERS * info);
|
||||||
|
|
||||||
bool _isWrite;
|
bool _isWrite;
|
||||||
ExceptionAddress _badAddress;
|
ExceptionAddress _badAddress;
|
||||||
|
@ -21,6 +21,7 @@
|
|||||||
|
|
||||||
#include <exception> //default C++ exception
|
#include <exception> //default C++ exception
|
||||||
#include "Win32Exception.h" //Win32 exception
|
#include "Win32Exception.h" //Win32 exception
|
||||||
|
#include "MiniDumper.h" //Write dump files
|
||||||
|
|
||||||
typedef std::vector<const TCHAR*> ParamVector;
|
typedef std::vector<const TCHAR*> ParamVector;
|
||||||
|
|
||||||
@ -148,6 +149,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
|
|||||||
ParamVector params;
|
ParamVector params;
|
||||||
parseCommandLine(cmdLine, params);
|
parseCommandLine(cmdLine, params);
|
||||||
|
|
||||||
|
MiniDumper mdump(); //for debugging purposes.
|
||||||
|
|
||||||
bool TheFirstOne = true;
|
bool TheFirstOne = true;
|
||||||
::SetLastError(NO_ERROR);
|
::SetLastError(NO_ERROR);
|
||||||
::CreateMutex(NULL, false, TEXT("nppInstance"));
|
::CreateMutex(NULL, false, TEXT("nppInstance"));
|
||||||
@ -318,6 +321,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
|
|||||||
#endif
|
#endif
|
||||||
ex.code(), ex.what(), ex.where());
|
ex.code(), ex.what(), ex.where());
|
||||||
printMsg(message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
printMsg(message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
||||||
|
mdump.writeDump(ex.info());
|
||||||
doException(notepad_plus_plus);
|
doException(notepad_plus_plus);
|
||||||
} catch(std::exception ex) {
|
} catch(std::exception ex) {
|
||||||
#ifdef UNICODE
|
#ifdef UNICODE
|
||||||
|
Loading…
Reference in New Issue
Block a user