@@ -191,6 +191,30 @@ static void printAddr(std::ostream& stream, void const* addr, bool fullPath = tr
191
191
}
192
192
}
193
193
194
+ static void printExtraParameters (std::ostream& stream, DWORD code, ULONG_PTR* params, size_t count) {
195
+ switch (code) {
196
+ case EXCEPTION_ACCESS_VIOLATION: {
197
+ const char * what;
198
+ switch (params[0 ]) {
199
+ case 0 : what = " read from memory" ; break ;
200
+ case 1 : what = " write to memory" ; break ;
201
+ case 8 : what = " execute memory (DEP violation)" ; break ;
202
+ default : what = " ???" ; break ;
203
+ }
204
+
205
+ stream << fmt::format (
206
+ " Exception Details: Failed to {} at 0x{:X}" ,
207
+ what, params[1 ]
208
+ ) << " \n " ;
209
+ } break ;
210
+
211
+ default : {
212
+ // if we can't deduce any useful information, just print the number of parameters
213
+ stream << " Number Parameters: " << count << " \n " ;
214
+ } break ;
215
+ }
216
+ }
217
+
194
218
// https://stackoverflow.com/a/50208684/9124836
195
219
static std::string getStacktrace (PCONTEXT context, Mod*& suspectedFaultyMod) {
196
220
std::stringstream stream;
@@ -450,11 +474,16 @@ static std::string getInfo(LPEXCEPTION_POINTERS info, Mod* faultyMod, Mod* suspe
450
474
<< getExceptionCodeString (info->ExceptionRecord ->ExceptionCode ) << " )" << std::dec
451
475
<< " \n "
452
476
<< " Exception Flags: " << info->ExceptionRecord ->ExceptionFlags << " \n "
453
- << " Exception Address: " << info->ExceptionRecord ->ExceptionAddress << " (" ;
477
+ << " Instruction Address: " << info->ExceptionRecord ->ExceptionAddress << " (" ;
454
478
printAddr (stream, info->ExceptionRecord ->ExceptionAddress , false );
455
- stream << " )"
456
- << " \n "
457
- << " Number Parameters: " << info->ExceptionRecord ->NumberParameters << " \n " ;
479
+ stream << " )\n " ;
480
+
481
+ printExtraParameters (
482
+ stream,
483
+ info->ExceptionRecord ->ExceptionCode ,
484
+ info->ExceptionRecord ->ExceptionInformation ,
485
+ info->ExceptionRecord ->NumberParameters
486
+ );
458
487
}
459
488
460
489
// show the thread that crashed
0 commit comments