Share Windows thread-suspend and -resume code
[deliverable/binutils-gdb.git] / gdb / nat / windows-nat.h
1 /* Internal interfaces for the Windows code
2 Copyright (C) 1995-2020 Free Software Foundation, Inc.
3
4 This file is part of GDB.
5
6 This program is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3 of the License, or
9 (at your option) any later version.
10
11 This program is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
15
16 You should have received a copy of the GNU General Public License
17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
18
19 #ifndef NAT_WINDOWS_NAT_H
20 #define NAT_WINDOWS_NAT_H
21
22 #include <windows.h>
23
24 /* Thread information structure used to track extra information about
25 each thread. */
26 struct windows_thread_info
27 {
28 windows_thread_info (DWORD tid_, HANDLE h_, CORE_ADDR tlb)
29 : tid (tid_),
30 h (h_),
31 thread_local_base (tlb)
32 {
33 }
34
35 DISABLE_COPY_AND_ASSIGN (windows_thread_info);
36
37 /* Ensure that this thread has been suspended. */
38 void suspend ();
39
40 /* Resume the thread if it has been suspended. */
41 void resume ();
42
43 /* The Win32 thread identifier. */
44 DWORD tid;
45
46 /* The handle to the thread. */
47 HANDLE h;
48
49 /* Thread Information Block address. */
50 CORE_ADDR thread_local_base;
51
52 /* This keeps track of whether SuspendThread was called on this
53 thread. -1 means there was a failure or that the thread was
54 explicitly not suspended, 1 means it was called, and 0 means it
55 was not. */
56 int suspended = 0;
57
58 #ifdef _WIN32_WCE
59 /* The context as retrieved right after suspending the thread. */
60 CONTEXT base_context {};
61 #endif
62
63 /* The context of the thread, including any manipulations. */
64 union
65 {
66 CONTEXT context {};
67 #ifdef __x86_64__
68 WOW64_CONTEXT wow64_context;
69 #endif
70 };
71
72 /* Whether debug registers changed since we last set CONTEXT back to
73 the thread. */
74 bool debug_registers_changed = false;
75
76 /* Nonzero if CONTEXT is invalidated and must be re-read from the
77 inferior thread. */
78 bool reload_context = false;
79
80 /* The name of the thread, allocated by xmalloc. */
81 gdb::unique_xmalloc_ptr<char> name;
82 };
83
84 #endif
This page took 0.031228 seconds and 4 git commands to generate.