From ae1f8880758d8087ad9fdb137d45c4abc1137b52 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Wed, 8 Apr 2020 14:33:35 -0600 Subject: Share windows_thread_info between gdb and gdbserver This introduces a new file, nat/windows-nat.h, which holds the definition of windows_thread_info. This is now shared between gdb and gdbserver. Note that the two implementations different slightly. gdb had a couple of fields ("name" and "reload_context") that gdbserver did not; while gdbserver had one field ("base_context") that gdb did not, plus better comments. The new file preserves all the fields, and the comments. gdb/ChangeLog 2020-04-08 Tom Tromey * windows-nat.c (struct windows_thread_info): Remove. * nat/windows-nat.h: New file. gdbserver/ChangeLog 2020-04-08 Tom Tromey * win32-low.h (struct windows_thread_info): Remove. --- gdb/nat/windows-nat.h | 66 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 gdb/nat/windows-nat.h (limited to 'gdb/nat') diff --git a/gdb/nat/windows-nat.h b/gdb/nat/windows-nat.h new file mode 100644 index 0000000..71df097 --- /dev/null +++ b/gdb/nat/windows-nat.h @@ -0,0 +1,66 @@ +/* Internal interfaces for the Windows code + Copyright (C) 1995-2020 Free Software Foundation, Inc. + + This file is part of GDB. + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . */ + +#ifndef NAT_WINDOWS_NAT_H +#define NAT_WINDOWS_NAT_H + +#include + +/* Thread information structure used to track extra information about + each thread. */ +struct windows_thread_info +{ + /* The Win32 thread identifier. */ + DWORD tid; + + /* The handle to the thread. */ + HANDLE h; + + /* Thread Information Block address. */ + CORE_ADDR thread_local_base; + + /* Non zero if SuspendThread was called on this thread. */ + int suspended; + +#ifdef _WIN32_WCE + /* The context as retrieved right after suspending the thread. */ + CONTEXT base_context; +#endif + + /* The context of the thread, including any manipulations. */ + union + { + CONTEXT context; +#ifdef __x86_64__ + WOW64_CONTEXT wow64_context; +#endif + }; + + /* Whether debug registers changed since we last set CONTEXT back to + the thread. */ + int debug_registers_changed; + + /* Nonzero if CONTEXT is invalidated and must be re-read from the + inferior thread. */ + int reload_context; + + /* The name of the thread, allocated by xmalloc. */ + char *name; +}; + +#endif -- cgit v1.1