[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 "eh.h"
|
||||
|
||||
Win32Exception::Win32Exception(const EXCEPTION_RECORD * info) {
|
||||
_location = info->ExceptionAddress;
|
||||
_code = info->ExceptionCode;
|
||||
switch (info->ExceptionCode) {
|
||||
Win32Exception::Win32Exception(EXCEPTION_POINTERS * info) {
|
||||
_location = info->ExceptionRecord->ExceptionAddress;
|
||||
_code = info->ExceptionRecord->ExceptionCode;
|
||||
_info = info;
|
||||
switch (_code) {
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
_event = "Access violation";
|
||||
break;
|
||||
@ -35,14 +36,14 @@ void Win32Exception::translate(unsigned code, EXCEPTION_POINTERS * info) {
|
||||
// Windows guarantees that *(info->ExceptionRecord) is valid
|
||||
switch (code) {
|
||||
case EXCEPTION_ACCESS_VIOLATION:
|
||||
throw Win32AccessViolation(info->ExceptionRecord);
|
||||
throw Win32AccessViolation(info);
|
||||
break;
|
||||
default:
|
||||
throw Win32Exception(info->ExceptionRecord);
|
||||
throw Win32Exception(info);
|
||||
}
|
||||
}
|
||||
|
||||
Win32AccessViolation::Win32AccessViolation(const EXCEPTION_RECORD * info) : Win32Exception(info) {
|
||||
_isWrite = info->ExceptionInformation[0] == 1;
|
||||
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionInformation[1]);
|
||||
Win32AccessViolation::Win32AccessViolation(EXCEPTION_POINTERS * info) : Win32Exception(info) {
|
||||
_isWrite = info->ExceptionRecord->ExceptionInformation[0] == 1;
|
||||
_badAddress = reinterpret_cast<ExceptionAddress>(info->ExceptionRecord->ExceptionInformation[1]);
|
||||
}
|
||||
|
@ -16,16 +16,19 @@ public:
|
||||
static void removeHandler();
|
||||
virtual const char* what() const throw() { return _event; };
|
||||
ExceptionAddress where() const { return _location; };
|
||||
unsigned code() const { return _code; };
|
||||
unsigned int code() const { return _code; };
|
||||
EXCEPTION_POINTERS* info() const { return _info; };
|
||||
|
||||
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);
|
||||
|
||||
private:
|
||||
const char * _event;
|
||||
ExceptionAddress _location;
|
||||
unsigned int _code;
|
||||
|
||||
EXCEPTION_POINTERS * _info;
|
||||
};
|
||||
|
||||
class Win32AccessViolation: public Win32Exception
|
||||
@ -34,7 +37,7 @@ public:
|
||||
bool isWrite() const { return _isWrite; };
|
||||
ExceptionAddress badAddress() const { return _badAddress; };
|
||||
private:
|
||||
Win32AccessViolation(const EXCEPTION_RECORD * info);
|
||||
Win32AccessViolation(EXCEPTION_POINTERS * info);
|
||||
|
||||
bool _isWrite;
|
||||
ExceptionAddress _badAddress;
|
||||
|
@ -21,6 +21,7 @@
|
||||
|
||||
#include <exception> //default C++ exception
|
||||
#include "Win32Exception.h" //Win32 exception
|
||||
#include "MiniDumper.h" //Write dump files
|
||||
|
||||
typedef std::vector<const TCHAR*> ParamVector;
|
||||
|
||||
@ -148,6 +149,8 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
|
||||
ParamVector params;
|
||||
parseCommandLine(cmdLine, params);
|
||||
|
||||
MiniDumper mdump(); //for debugging purposes.
|
||||
|
||||
bool TheFirstOne = true;
|
||||
::SetLastError(NO_ERROR);
|
||||
::CreateMutex(NULL, false, TEXT("nppInstance"));
|
||||
@ -318,6 +321,7 @@ int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE, LPSTR cmdLineAnsi, int nCmdSh
|
||||
#endif
|
||||
ex.code(), ex.what(), ex.where());
|
||||
printMsg(message, TEXT("Win32Exception"), MB_OK | MB_ICONERROR);
|
||||
mdump.writeDump(ex.info());
|
||||
doException(notepad_plus_plus);
|
||||
} catch(std::exception ex) {
|
||||
#ifdef UNICODE
|
||||
|
Loading…
Reference in New Issue
Block a user