]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - gdbserver/win32-low.h
Namespace the reg class to avoid clashes with OS headers
[thirdparty/binutils-gdb.git] / gdbserver / win32-low.h
CommitLineData
68070c10 1/* Internal interfaces for the Win32 specific target code for gdbserver.
b811d2c2 2 Copyright (C) 2007-2020 Free Software Foundation, Inc.
68070c10
PA
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
a9762ec7 8 the Free Software Foundation; either version 3 of the License, or
68070c10
PA
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
a9762ec7 17 along with this program. If not, see <http://www.gnu.org/licenses/>. */
68070c10 18
1a5c2598
TT
19#ifndef GDBSERVER_WIN32_LOW_H
20#define GDBSERVER_WIN32_LOW_H
21
68070c10
PA
22#include <windows.h>
23
3aee8918
PA
24struct target_desc;
25
26/* The inferior's target description. This is a global because the
27 Windows ports support neither bi-arch nor multi-process. */
28extern const struct target_desc *win32_tdesc;
29
68070c10
PA
30/* Thread information structure used to track extra information about
31 each thread. */
32typedef struct win32_thread_info
33{
c436e841 34 /* The Win32 thread identifier. */
68070c10 35 DWORD tid;
c436e841
PA
36
37 /* The handle to the thread. */
68070c10 38 HANDLE h;
c436e841 39
711e434b
PM
40 /* Thread Information Block address. */
41 CORE_ADDR thread_local_base;
42
c436e841
PA
43 /* Non zero if SuspendThread was called on this thread. */
44 int suspended;
45
9c6c8194
PA
46#ifdef _WIN32_WCE
47 /* The context as retrieved right after suspending the thread. */
48 CONTEXT base_context;
49#endif
50
51 /* The context of the thread, including any manipulations. */
68070c10 52 CONTEXT context;
a2abc7de
PA
53
54 /* Whether debug registers changed since we last set CONTEXT back to
55 the thread. */
56 int debug_registers_changed;
68070c10
PA
57} win32_thread_info;
58
59struct win32_target_ops
60{
d05b4ac3
UW
61 /* Architecture-specific setup. */
62 void (*arch_setup) (void);
63
34b34921 64 /* The number of target registers. */
68070c10
PA
65 int num_regs;
66
34b34921 67 /* Perform initializations on startup. */
68070c10
PA
68 void (*initial_stuff) (void);
69
34b34921 70 /* Fetch the context from the inferior. */
a2abc7de 71 void (*get_thread_context) (win32_thread_info *th);
68070c10 72
a2abc7de
PA
73 /* Called just before resuming the thread. */
74 void (*prepare_to_resume) (win32_thread_info *th);
34b34921
PA
75
76 /* Called when a thread was added. */
77 void (*thread_added) (win32_thread_info *th);
78
79 /* Fetch register from gdbserver regcache data. */
442ea881
PA
80 void (*fetch_inferior_register) (struct regcache *regcache,
81 win32_thread_info *th, int r);
34b34921
PA
82
83 /* Store a new register value into the thread context of TH. */
442ea881
PA
84 void (*store_inferior_register) (struct regcache *regcache,
85 win32_thread_info *th, int r);
68070c10
PA
86
87 void (*single_step) (win32_thread_info *th);
88
89 const unsigned char *breakpoint;
90 int breakpoint_len;
aa5ca48f
DE
91
92 /* Breakpoint/Watchpoint related functions. See target.h for comments. */
802e8e6d
PA
93 int (*supports_z_point_type) (char z_type);
94 int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
95 int size, struct raw_breakpoint *bp);
96 int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
97 int size, struct raw_breakpoint *bp);
aa5ca48f
DE
98 int (*stopped_by_watchpoint) (void);
99 CORE_ADDR (*stopped_data_address) (void);
68070c10
PA
100};
101
102extern struct win32_target_ops the_low_target;
103
5ef9273d
TBA
104/* Target ops definitions for a Win32 target. */
105
52405d85 106class win32_process_target : public process_stratum_target
5ef9273d
TBA
107{
108public:
109
15295543
TBA
110 int create_inferior (const char *program,
111 const std::vector<char *> &program_args) override;
ef03dad8
TBA
112
113 int attach (unsigned long pid) override;
c6885a57
TBA
114
115 int kill (process_info *proc) override;
9061c9cf
TBA
116
117 int detach (process_info *proc) override;
8adb37b9
TBA
118
119 void mourn (process_info *proc) override;
95a49a39
TBA
120
121 void join (int pid) override;
13d3d99b
TBA
122
123 bool thread_alive (ptid_t pid) override;
0e4d7e35
TBA
124
125 void resume (thread_resume *resume_info, size_t n) override;
6532e7e3
TBA
126
127 ptid_t wait (ptid_t ptid, target_waitstatus *status,
128 int options) override;
a5a4d4cd
TBA
129
130 void fetch_registers (regcache *regcache, int regno) override;
131
132 void store_registers (regcache *regcache, int regno) override;
e2558df3
TBA
133
134 int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
135 int len) override;
136
137 int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
138 int len) override;
eb497a2a
TBA
139
140 void request_interrupt () override;
a2b2297a
TBA
141
142 bool supports_z_point_type (char z_type) override;
7e0bde70
TBA
143
144 int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
145 int size, raw_breakpoint *bp) override;
146
147 int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
148 int size, raw_breakpoint *bp) override;
22aa6223
TBA
149
150 bool supports_hardware_single_step () override;
6eeb5c55
TBA
151
152 bool stopped_by_watchpoint () override;
153
154 CORE_ADDR stopped_data_address () override;
ea06bbaa
TBA
155
156#ifdef _WIN32_WCE
157 void hostio_last_error (char *buf) override;
158#endif
d7abedf7
TBA
159
160 bool supports_qxfer_siginfo () override;
161
162 int qxfer_siginfo (const char *annex, unsigned char *readbuf,
163 unsigned const char *writebuf,
164 CORE_ADDR offset, int len) override;
4e2e869c
TBA
165
166 bool supports_get_tib_address () override;
167
168 int get_tib_address (ptid_t ptid, CORE_ADDR *addr) override;
d367006f
TBA
169
170 const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
5ef9273d
TBA
171};
172
a2abc7de
PA
173/* Retrieve the context for this thread, if not already retrieved. */
174extern void win32_require_context (win32_thread_info *th);
175
68070c10
PA
176/* Map the Windows error number in ERROR to a locale-dependent error
177 message string and return a pointer to it. Typically, the values
178 for ERROR come from GetLastError.
179
180 The string pointed to shall not be modified by the application,
181 but may be overwritten by a subsequent call to strwinerror
182
183 The strwinerror function does not change the current setting
184 of GetLastError. */
185extern char * strwinerror (DWORD error);
186
187/* in wincecompat.c */
188
189extern void to_back_slashes (char *);
1a5c2598
TT
190
191#endif /* GDBSERVER_WIN32_LOW_H */