reactos/base/applications/drwtsn32/drwtsn32.h
Mark Jansen 280d7a9775
[DRWTSN32] Implement basic crash report functionality
On application crash, drwtsn32 will attach to the application and try to get a dump, consisting of:
- List of loaded modules
- List of loaded threads
- Per thread, a stacktrace
- Per thread, a small hexdump from the stack
- Per thread, a dump of the most common registers

This dump is saved to the desktop, and the user is notified of the dump being dropped there.

CORE-14180
#145
2018-01-06 11:47:54 +01:00

68 lines
1.3 KiB
C++

/*
* PROJECT: Dr. Watson crash reporter
* LICENSE: GPL-2.0+ (https://spdx.org/licenses/GPL-2.0+)
* PURPOSE: Project header
* COPYRIGHT: Copyright 2017 Mark Jansen (mark.jansen@reactos.org)
*/
#pragma once
struct ModuleData
{
std::string ModuleName;
void *BaseAddress;
DWORD Size;
bool Unloaded;
ModuleData(void* addr);
void Update(HANDLE hProcess);
};
struct ThreadData
{
HANDLE Handle;
CONTEXT Context;
ThreadData(HANDLE handle = NULL);
void Update();
};
typedef std::vector<ModuleData> ModuleList;
typedef std::map<DWORD, ThreadData> ThreadMap;
class DumpData
{
public:
std::string ProcessPath;
std::string ProcessName;
DWORD ProcessID;
DWORD ThreadID;
HANDLE ProcessHandle;
ModuleList Modules;
ThreadMap Threads;
EXCEPTION_DEBUG_INFO ExceptionInfo;
HANDLE Event;
bool FirstBPHit;
DumpData();
};
#define NEWLINE "\r\n"
/* main.cpp */
void xfprintf(FILE* stream, const char *fmt, ...);
/* drwtsn32.cpp */
bool UpdateFromEvent(DEBUG_EVENT& evt, DumpData& data);
/* sysinfo.cpp */
void PrintSystemInfo(FILE* output, DumpData& data);
/* stacktrace.cpp */
void BeginStackBacktrace(DumpData& data);
void PrintStackBacktrace(FILE* output, DumpData& data, ThreadData& thread);
void EndStackBacktrace(DumpData& data);