Display ExceptionRecord for $_siginfo
Uses the $_siginfo convenience variable to show the last exception.
The type looks like this:
(gdb) pt $_siginfo
type = struct EXCEPTION_RECORD {
DWORD ExceptionCode;
DWORD ExceptionFlags;
struct EXCEPTION_RECORD *ExceptionRecord;
PVOID ExceptionAddress;
DWORD NumberParameters;
ULONG_PTR ExceptionInformation[15];
}
EXCEPTION_RECORD is documented at [1].
Example:
Program received signal SIGSEGV, Segmentation fault.
main () at crasher.c:4
4 *(int*)0x123 = 0;
(gdb) p $_siginfo
$1 = {
ExceptionCode =
3221225477,
ExceptionFlags = 0,
ExceptionRecord = 0x0,
ExceptionAddress = 0x401632 <main+18>,
NumberParameters = 2,
ExceptionInformation = {1, 291, 0 <repeats 13 times>}
}
(gdb) p/x $_siginfo.ExceptionCode
$2 = 0xc0000005
(gdb) p/x $_siginfo.ExceptionInformation[1]
$3 = 0x123
And 0xc0000005 is the value of EXCEPTION_ACCESS_VIOLATION.
[1] https://docs.microsoft.com/en-us/windows/win32/api/winnt/ns-winnt-exception_record
gdb/ChangeLog:
2020-02-09 Hannes Domani <ssbssa@yahoo.de>
* NEWS: Mention $_siginfo support for Windows.
* windows-nat.c (handle_exception): Set siginfo_er.
(windows_nat_target::mourn_inferior): Reset siginfo_er.
(windows_xfer_siginfo): New function.
(windows_nat_target::xfer_partial): Call windows_xfer_siginfo.
* windows-tdep.c (struct windows_gdbarch_data): New struct.
(init_windows_gdbarch_data): New function.
(get_windows_gdbarch_data): New function.
(windows_get_siginfo_type): New function.
(windows_init_abi): Register windows_get_siginfo_type.
(_initialize_windows_tdep): Register init_windows_gdbarch_data.
gdbserver/ChangeLog:
2020-02-09 Hannes Domani <ssbssa@yahoo.de>
* win32-low.c (win32_clear_inferiors): Reset siginfo_er.
(handle_exception): Set siginfo_er.
(win32_xfer_siginfo): New function.