Implement stopped_by_sw_breakpoint for Windows gdbserver
[deliverable/binutils-gdb.git] / gdbserver / win32-low.h
1 /* Internal interfaces for the Win32 specific target code for gdbserver.
2 Copyright (C) 2007-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 GDBSERVER_WIN32_LOW_H
20 #define GDBSERVER_WIN32_LOW_H
21
22 #include <windows.h>
23 #include "nat/windows-nat.h"
24
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
31 struct win32_target_ops
32 {
33 /* Architecture-specific setup. */
34 void (*arch_setup) (void);
35
36 /* The number of target registers. */
37 int num_regs;
38
39 /* Perform initializations on startup. */
40 void (*initial_stuff) (void);
41
42 /* Fetch the context from the inferior. */
43 void (*get_thread_context) (windows_nat::windows_thread_info *th);
44
45 /* Called just before resuming the thread. */
46 void (*prepare_to_resume) (windows_nat::windows_thread_info *th);
47
48 /* Called when a thread was added. */
49 void (*thread_added) (windows_nat::windows_thread_info *th);
50
51 /* Fetch register from gdbserver regcache data. */
52 void (*fetch_inferior_register) (struct regcache *regcache,
53 windows_nat::windows_thread_info *th,
54 int r);
55
56 /* Store a new register value into the thread context of TH. */
57 void (*store_inferior_register) (struct regcache *regcache,
58 windows_nat::windows_thread_info *th,
59 int r);
60
61 void (*single_step) (windows_nat::windows_thread_info *th);
62
63 const unsigned char *breakpoint;
64 int breakpoint_len;
65
66 /* Amount by which to decrement the PC after a breakpoint is
67 hit. */
68 int decr_pc_after_break;
69
70 /* Get the PC register from REGCACHE. */
71 CORE_ADDR (*get_pc) (struct regcache *regcache);
72 /* Set the PC register in REGCACHE. */
73 void (*set_pc) (struct regcache *regcache, CORE_ADDR newpc);
74
75 /* Breakpoint/Watchpoint related functions. See target.h for comments. */
76 int (*supports_z_point_type) (char z_type);
77 int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
78 int size, struct raw_breakpoint *bp);
79 int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
80 int size, struct raw_breakpoint *bp);
81 int (*stopped_by_watchpoint) (void);
82 CORE_ADDR (*stopped_data_address) (void);
83 };
84
85 extern struct win32_target_ops the_low_target;
86
87 /* Target ops definitions for a Win32 target. */
88
89 class win32_process_target : public process_stratum_target
90 {
91 public:
92
93 int create_inferior (const char *program,
94 const std::vector<char *> &program_args) override;
95
96 int attach (unsigned long pid) override;
97
98 int kill (process_info *proc) override;
99
100 int detach (process_info *proc) override;
101
102 void mourn (process_info *proc) override;
103
104 void join (int pid) override;
105
106 bool thread_alive (ptid_t pid) override;
107
108 void resume (thread_resume *resume_info, size_t n) override;
109
110 ptid_t wait (ptid_t ptid, target_waitstatus *status,
111 int options) override;
112
113 void fetch_registers (regcache *regcache, int regno) override;
114
115 void store_registers (regcache *regcache, int regno) override;
116
117 int read_memory (CORE_ADDR memaddr, unsigned char *myaddr,
118 int len) override;
119
120 int write_memory (CORE_ADDR memaddr, const unsigned char *myaddr,
121 int len) override;
122
123 void request_interrupt () override;
124
125 bool supports_z_point_type (char z_type) override;
126
127 int insert_point (enum raw_bkpt_type type, CORE_ADDR addr,
128 int size, raw_breakpoint *bp) override;
129
130 int remove_point (enum raw_bkpt_type type, CORE_ADDR addr,
131 int size, raw_breakpoint *bp) override;
132
133 bool supports_hardware_single_step () override;
134
135 bool stopped_by_watchpoint () override;
136
137 CORE_ADDR stopped_data_address () override;
138
139 #ifdef _WIN32_WCE
140 void hostio_last_error (char *buf) override;
141 #endif
142
143 bool supports_qxfer_siginfo () override;
144
145 int qxfer_siginfo (const char *annex, unsigned char *readbuf,
146 unsigned const char *writebuf,
147 CORE_ADDR offset, int len) override;
148
149 bool supports_get_tib_address () override;
150
151 int get_tib_address (ptid_t ptid, CORE_ADDR *addr) override;
152
153 const gdb_byte *sw_breakpoint_from_kind (int kind, int *size) override;
154
155 CORE_ADDR read_pc (regcache *regcache) override;
156
157 void write_pc (regcache *regcache, CORE_ADDR pc) override;
158
159 bool stopped_by_sw_breakpoint () override;
160
161 bool supports_stopped_by_sw_breakpoint () override;
162 };
163
164 /* Retrieve the context for this thread, if not already retrieved. */
165 extern void win32_require_context (windows_nat::windows_thread_info *th);
166
167 /* Map the Windows error number in ERROR to a locale-dependent error
168 message string and return a pointer to it. Typically, the values
169 for ERROR come from GetLastError.
170
171 The string pointed to shall not be modified by the application,
172 but may be overwritten by a subsequent call to strwinerror
173
174 The strwinerror function does not change the current setting
175 of GetLastError. */
176 extern char * strwinerror (DWORD error);
177
178 /* in wincecompat.c */
179
180 extern void to_back_slashes (char *);
181
182 #endif /* GDBSERVER_WIN32_LOW_H */
This page took 0.04364 seconds and 4 git commands to generate.