Commit | Line | Data |
---|---|---|
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 | 22 | #include <windows.h> |
ae1f8880 | 23 | #include "nat/windows-nat.h" |
68070c10 | 24 | |
3aee8918 PA |
25 | struct target_desc; |
26 | ||
27 | /* The inferior's target description. This is a global because the | |
28 | Windows ports support neither bi-arch nor multi-process. */ | |
29 | extern const struct target_desc *win32_tdesc; | |
30 | ||
68070c10 PA |
31 | struct win32_target_ops |
32 | { | |
d05b4ac3 UW |
33 | /* Architecture-specific setup. */ |
34 | void (*arch_setup) (void); | |
35 | ||
34b34921 | 36 | /* The number of target registers. */ |
68070c10 PA |
37 | int num_regs; |
38 | ||
34b34921 | 39 | /* Perform initializations on startup. */ |
68070c10 PA |
40 | void (*initial_stuff) (void); |
41 | ||
34b34921 | 42 | /* Fetch the context from the inferior. */ |
e56f8ccb | 43 | void (*get_thread_context) (windows_thread_info *th); |
68070c10 | 44 | |
a2abc7de | 45 | /* Called just before resuming the thread. */ |
e56f8ccb | 46 | void (*prepare_to_resume) (windows_thread_info *th); |
34b34921 PA |
47 | |
48 | /* Called when a thread was added. */ | |
e56f8ccb | 49 | void (*thread_added) (windows_thread_info *th); |
34b34921 PA |
50 | |
51 | /* Fetch register from gdbserver regcache data. */ | |
442ea881 | 52 | void (*fetch_inferior_register) (struct regcache *regcache, |
e56f8ccb | 53 | windows_thread_info *th, int r); |
34b34921 PA |
54 | |
55 | /* Store a new register value into the thread context of TH. */ | |
442ea881 | 56 | void (*store_inferior_register) (struct regcache *regcache, |
e56f8ccb | 57 | windows_thread_info *th, int r); |
68070c10 | 58 | |
e56f8ccb | 59 | void (*single_step) (windows_thread_info *th); |
68070c10 PA |
60 | |
61 | const unsigned char *breakpoint; | |
62 | int breakpoint_len; | |
aa5ca48f DE |
63 | |
64 | /* Breakpoint/Watchpoint related functions. See target.h for comments. */ | |
802e8e6d PA |
65 | int (*supports_z_point_type) (char z_type); |
66 | int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr, | |
67 | int size, struct raw_breakpoint *bp); | |
68 | int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr, | |
69 | int size, struct raw_breakpoint *bp); | |
aa5ca48f DE |
70 | int (*stopped_by_watchpoint) (void); |
71 | CORE_ADDR (*stopped_data_address) (void); | |
68070c10 PA |
72 | }; |
73 | ||
74 | extern struct win32_target_ops the_low_target; | |
75 | ||
5ef9273d TBA |
76 | /* Target ops definitions for a Win32 target. */ |
77 | ||
52405d85 | 78 | class win32_process_target : public process_stratum_target |
5ef9273d TBA |
79 | { |
80 | public: | |
81 | ||
15295543 TBA |
82 | int create_inferior (const char *program, |
83 | const std::vector<char *> &program_args) override; | |
ef03dad8 TBA |
84 | |
85 | int attach (unsigned long pid) override; | |
c6885a57 TBA |
86 | |
87 | int kill (process_info *proc) override; | |
9061c9cf TBA |
88 | |
89 | int detach (process_info *proc) override; | |
8adb37b9 TBA |
90 | |
91 | void mourn (process_info *proc) override; | |
95a49a39 TBA |
92 | |
93 | void join (int pid) override; | |
13d3d99b TBA |
94 | |
95 | bool thread_alive (ptid_t pid) override; | |
0e4d7e35 TBA |
96 | |
97 | void resume (thread_resume *resume_info, size_t n) override; | |
6532e7e3 TBA |
98 | |
99 | ptid_t wait (ptid_t ptid, target_waitstatus *status, | |
100 | int options) override; | |
a5a4d4cd TBA |
101 | |
102 | void fetch_registers (regcache *regcache, int regno) override; | |
103 | ||
104 | void store_registers (regcache *regcache, int regno) override; | |
e2558df3 TBA |
105 | |
106 | int read_memory (CORE_ADDR memaddr, unsigned char *myaddr, | |
107 | int len) override; | |
108 | ||
109 | int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr, | |
110 | int len) override; | |
eb497a2a TBA |
111 | |
112 | void request_interrupt () override; | |
a2b2297a TBA |
113 | |
114 | bool supports_z_point_type (char z_type) override; | |
7e0bde70 TBA |
115 | |
116 | int insert_point (enum raw_bkpt_type type, CORE_ADDR addr, | |
117 | int size, raw_breakpoint *bp) override; | |
118 | ||
119 | int remove_point (enum raw_bkpt_type type, CORE_ADDR addr, | |
120 | int size, raw_breakpoint *bp) override; | |
22aa6223 TBA |
121 | |
122 | bool supports_hardware_single_step () override; | |
6eeb5c55 TBA |
123 | |
124 | bool stopped_by_watchpoint () override; | |
125 | ||
126 | CORE_ADDR stopped_data_address () override; | |
ea06bbaa TBA |
127 | |
128 | #ifdef _WIN32_WCE | |
129 | void hostio_last_error (char *buf) override; | |
130 | #endif | |
d7abedf7 TBA |
131 | |
132 | bool supports_qxfer_siginfo () override; | |
133 | ||
134 | int qxfer_siginfo (const char *annex, unsigned char *readbuf, | |
135 | unsigned const char *writebuf, | |
136 | CORE_ADDR offset, int len) override; | |
4e2e869c TBA |
137 | |
138 | bool supports_get_tib_address () override; | |
139 | ||
140 | int get_tib_address (ptid_t ptid, CORE_ADDR *addr) override; | |
d367006f TBA |
141 | |
142 | const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override; | |
5ef9273d TBA |
143 | }; |
144 | ||
a2abc7de | 145 | /* Retrieve the context for this thread, if not already retrieved. */ |
e56f8ccb | 146 | extern void win32_require_context (windows_thread_info *th); |
a2abc7de | 147 | |
68070c10 PA |
148 | /* Map the Windows error number in ERROR to a locale-dependent error |
149 | message string and return a pointer to it. Typically, the values | |
150 | for ERROR come from GetLastError. | |
151 | ||
152 | The string pointed to shall not be modified by the application, | |
153 | but may be overwritten by a subsequent call to strwinerror | |
154 | ||
155 | The strwinerror function does not change the current setting | |
156 | of GetLastError. */ | |
157 | extern char * strwinerror (DWORD error); | |
158 | ||
159 | /* in wincecompat.c */ | |
160 | ||
161 | extern void to_back_slashes (char *); | |
1a5c2598 TT |
162 | |
163 | #endif /* GDBSERVER_WIN32_LOW_H */ |