aboutsummaryrefslogtreecommitdiff
path: root/gdb/windows-nat.c
diff options
context:
space:
mode:
authorPedro Alves <pedro@palves.net>2023-05-22 18:17:54 +0100
committerPedro Alves <pedro@palves.net>2024-05-10 11:26:00 +0100
commita0bc4291f1d98739c6b1add026ee55c3f0d72e88 (patch)
treecdda48e6c30514261a87a2bdaff1e88ea4e1837b /gdb/windows-nat.c
parent41f9f2d609d128d6fc1414ad5c0dbcb74b019183 (diff)
downloadfsf-binutils-gdb-a0bc4291f1d98739c6b1add026ee55c3f0d72e88.zip
fsf-binutils-gdb-a0bc4291f1d98739c6b1add026ee55c3f0d72e88.tar.gz
fsf-binutils-gdb-a0bc4291f1d98739c6b1add026ee55c3f0d72e88.tar.bz2
Windows gdb+gdbserver: Share $_siginfo reading code
Both GDB and GDBserver have similar code to read the $_siginfo data. This patch moves the bulk of it to gdb/nat/windows-nat.c so it can be shared. Change-Id: I47fc0d3323be5b6f6fcfe912b768051a41910666
Diffstat (limited to 'gdb/windows-nat.c')
-rw-r--r--gdb/windows-nat.c40
1 files changed, 3 insertions, 37 deletions
diff --git a/gdb/windows-nat.c b/gdb/windows-nat.c
index 1608c47..4871d18 100644
--- a/gdb/windows-nat.c
+++ b/gdb/windows-nat.c
@@ -3111,44 +3111,10 @@ windows_xfer_siginfo (gdb_byte *readbuf, ULONGEST offset, ULONGEST len,
{
windows_thread_info *th = windows_process.find_thread (inferior_ptid);
- if (th->last_event.dwDebugEventCode != EXCEPTION_DEBUG_EVENT)
- return TARGET_XFER_E_IO;
-
- EXCEPTION_RECORD &er = th->last_event.u.Exception.ExceptionRecord;
-
- char *buf = (char *) &er;
- size_t bufsize = sizeof (er);
-
-#ifdef __x86_64__
- EXCEPTION_RECORD32 er32;
- if (windows_process.wow64_process)
- {
- buf = (char *) &er32;
- bufsize = sizeof (er32);
-
- er32.ExceptionCode = er.ExceptionCode;
- er32.ExceptionFlags = er.ExceptionFlags;
- er32.ExceptionRecord = (uintptr_t) er.ExceptionRecord;
- er32.ExceptionAddress = (uintptr_t) er.ExceptionAddress;
- er32.NumberParameters = er.NumberParameters;
- for (int i = 0; i < EXCEPTION_MAXIMUM_PARAMETERS; i++)
- er32.ExceptionInformation[i] = er.ExceptionInformation[i];
- }
-#endif
-
- if (readbuf == nullptr)
- return TARGET_XFER_E_IO;
-
- if (offset > bufsize)
+ if (th->xfer_siginfo (readbuf, offset, len, xfered_len))
+ return TARGET_XFER_OK;
+ else
return TARGET_XFER_E_IO;
-
- if (offset + len > bufsize)
- len = bufsize - offset;
-
- memcpy (readbuf, buf + offset, len);
- *xfered_len = len;
-
- return TARGET_XFER_OK;
}
enum target_xfer_status