Use enums for human-readable exception information.
Changes to $_siginfo type to this:
(gdb) pt $_siginfo
type = struct EXCEPTION_RECORD {
enum ExceptionCode ExceptionCode;
DWORD ExceptionFlags;
struct EXCEPTION_RECORD *ExceptionRecord;
PVOID ExceptionAddress;
DWORD NumberParameters;
union {
ULONG_PTR ExceptionInformation[15];
struct {...} AccessViolationInformation;
};
}
(gdb) pt $_siginfo.ExceptionCode
type = enum ExceptionCode {FATAL_APP_EXIT =
1073741845,
DBG_CONTROL_C =
1073807365, DBG_CONTROL_BREAK =
1073807368,
DATATYPE_MISALIGNMENT =
2147483650, BREAKPOINT, SINGLE_STEP,
ACCESS_VIOLATION =
3221225477, IN_PAGE_ERROR,
ILLEGAL_INSTRUCTION =
3221225501, NONCONTINUABLE_EXCEPTION =
3221225509,
INVALID_DISPOSITION, ARRAY_BOUNDS_EXCEEDED =
3221225612,
FLOAT_DENORMAL_OPERAND, FLOAT_DIVIDE_BY_ZERO, FLOAT_INEXACT_RESULT,
FLOAT_INVALID_OPERATION, FLOAT_OVERFLOW, FLOAT_STACK_CHECK,
FLOAT_UNDERFLOW, INTEGER_DIVIDE_BY_ZERO, INTEGER_OVERFLOW,
PRIV_INSTRUCTION, STACK_OVERFLOW =
3221225725, FAST_FAIL =
3221226505}
(gdb) pt $_siginfo.AccessViolationInformation
type = struct {
enum ViolationType Type;
PVOID Address;
}
(gdb) pt $_siginfo.AccessViolationInformation.Type
type = enum ViolationType {READ_ACCESS_VIOLATION, WRITE_ACCESS_VIOLATION,
DATA_EXECUTION_PREVENTION_VIOLATION = 8}
Which makes it easier to understand the reason of the exception:
(gdb) p $_siginfo
$1 = {
ExceptionCode = ACCESS_VIOLATION,
ExceptionFlags = 0,
ExceptionRecord = 0x0,
ExceptionAddress = 0x401632 <main+18>,
NumberParameters = 2,
{
ExceptionInformation = {1, 291, 0 <repeats 13 times>},
AccessViolationInformation = {
Type = WRITE_ACCESS_VIOLATION,
Address = 0x123
}
}
}
gdb/ChangeLog:
2020-02-09 Hannes Domani <ssbssa@yahoo.de>
* windows-tdep.c (struct enum_value_name): New struct.
(create_enum): New function.
(windows_get_siginfo_type): Create and use enum types.