Skip to content

Commit 6c9a7b2

Browse files
Add an option to configure full or partial dump
1 parent c3e2bba commit 6c9a7b2

File tree

3 files changed

+9
-6
lines changed

3 files changed

+9
-6
lines changed

src/amulet_faulthandler/_faulthandler.py.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,8 @@ void init_module(py::module m)
1010
m.def(
1111
"install",
1212
&Amulet::faulthandler::install,
13-
py::arg("path"));
13+
py::arg("path"),
14+
py::arg("full_dump"));
1415
}
1516

1617
PYBIND11_MODULE(_faulthandler, m)

src/amulet_faulthandler/faulthandler.cpp

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,7 @@ void dump_stack(EXCEPTION_POINTERS* p)
8383
}
8484

8585
static std::wstring _path;
86+
static bool _full_dump = false;
8687

8788
void dump_process(EXCEPTION_POINTERS* p)
8889
{
@@ -99,13 +100,13 @@ void dump_process(EXCEPTION_POINTERS* p)
99100
MINIDUMP_EXCEPTION_INFORMATION info;
100101
info.ThreadId = GetCurrentThreadId();
101102
info.ExceptionPointers = p;
102-
info.ClientPointers = FALSE;
103+
info.ClientPointers = TRUE;
103104

104105
MiniDumpWriteDump(
105106
GetCurrentProcess(),
106107
GetCurrentProcessId(),
107108
dump_handle,
108-
MiniDumpWithFullMemory,
109+
_full_dump ? MiniDumpWithFullMemory : MiniDumpNormal,
109110
&info,
110111
nullptr,
111112
nullptr);
@@ -122,9 +123,10 @@ LONG WINAPI CrashHandler(EXCEPTION_POINTERS* p)
122123

123124
namespace Amulet {
124125
namespace faulthandler {
125-
void install(std::filesystem::path path)
126+
void install(std::filesystem::path path, bool full_dump)
126127
{
127128
_path = path.wstring();
129+
_full_dump = full_dump;
128130
SetUnhandledExceptionFilter(CrashHandler);
129131
}
130132
}
@@ -134,7 +136,7 @@ namespace faulthandler {
134136

135137
namespace Amulet {
136138
namespace faulthandler {
137-
void install(std::filesystem::path path)
139+
void install(std::filesystem::path path, bool full_dump)
138140
{
139141
}
140142
}

src/amulet_faulthandler/faulthandler.hpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,6 @@
44

55
namespace Amulet {
66
namespace faulthandler {
7-
void install(std::filesystem::path path);
7+
void install(std::filesystem::path path, bool full_dump);
88
}
99
}

0 commit comments

Comments
 (0)