]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Display ExceptionRecord for $_siginfo
authorHannes Domani <ssbssa@yahoo.de>
Fri, 17 Jan 2020 14:28:09 +0000 (15:28 +0100)
committerHannes Domani <ssbssa@yahoo.de>
Sun, 9 Feb 2020 11:14:51 +0000 (12:14 +0100)
commit7928d571c5f742a10d98b0de0ef85284c5959845
tree3a728942f516e96dc543fc73b17b848f7aa9849d
parent98d3eb9390ef5eca14200c424f22812982c06b19
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.
gdb/ChangeLog
gdb/NEWS
gdb/windows-nat.c
gdb/windows-tdep.c
gdbserver/ChangeLog
gdbserver/win32-low.c