GDBserver

win32-low.h
Go to the documentation of this file.
1 /* Internal interfaces for the Win32 specific target code for gdbserver.
2 Copyright (C) 2007-2018 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 #include <windows.h>
20
21 struct target_desc;
22
23 /* The inferior's target description. This is a global because the
24 Windows ports support neither bi-arch nor multi-process. */
25 extern const struct target_desc *win32_tdesc;
26
27 /* Thread information structure used to track extra information about
28 each thread. */
29 typedef struct win32_thread_info
30 {
31 /* The Win32 thread identifier. */
32 DWORD tid;
33
34 /* The handle to the thread. */
35 HANDLE h;
36
37 /* Thread Information Block address. */
38 CORE_ADDR thread_local_base;
39
40 /* Non zero if SuspendThread was called on this thread. */
41 int suspended;
42
43 #ifdef _WIN32_WCE
44 /* The context as retrieved right after suspending the thread. */
45 CONTEXT base_context;
46 #endif
47
48 /* The context of the thread, including any manipulations. */
49 CONTEXT context;
50
51 /* Whether debug registers changed since we last set CONTEXT back to
52 the thread. */
53 int debug_registers_changed;
54 } win32_thread_info;
55
56 struct win32_target_ops
57 {
58 /* Architecture-specific setup. */
59 void (*arch_setup) (void);
60
61 /* The number of target registers. */
62 int num_regs;
63
64 /* Perform initializations on startup. */
65 void (*initial_stuff) (void);
66
67 /* Fetch the context from the inferior. */
68 void (*get_thread_context) (win32_thread_info *th);
69
70 /* Called just before resuming the thread. */
71 void (*prepare_to_resume) (win32_thread_info *th);
72
73 /* Called when a thread was added. */
74 void (*thread_added) (win32_thread_info *th);
75
76 /* Fetch register from gdbserver regcache data. */
77 void (*fetch_inferior_register) (struct regcache *regcache,
78 win32_thread_info *th, int r);
79
80 /* Store a new register value into the thread context of TH. */
81 void (*store_inferior_register) (struct regcache *regcache,
82 win32_thread_info *th, int r);
83
84 void (*single_step) (win32_thread_info *th);
85
86 const unsigned char *breakpoint;
87 int breakpoint_len;
88
89 /* Breakpoint/Watchpoint related functions. See target.h for comments. */
90 int (*supports_z_point_type) (char z_type);
91 int (*insert_point) (enum raw_bkpt_type type, CORE_ADDR addr,
92 int size, struct raw_breakpoint *bp);
93 int (*remove_point) (enum raw_bkpt_type type, CORE_ADDR addr,
94 int size, struct raw_breakpoint *bp);
95 int (*stopped_by_watchpoint) (void);
96 CORE_ADDR (*stopped_data_address) (void);
97 };
98
99 extern struct win32_target_ops the_low_target;
100
101 /* Retrieve the context for this thread, if not already retrieved. */
102 extern void win32_require_context (win32_thread_info *th);
103
104 /* Map the Windows error number in ERROR to a locale-dependent error
105 message string and return a pointer to it. Typically, the values
106 for ERROR come from GetLastError.
107
108 The string pointed to shall not be modified by the application,
109 but may be overwritten by a subsequent call to strwinerror
110
111 The strwinerror function does not change the current setting
112 of GetLastError. */
113 extern char * strwinerror (DWORD error);
114
115 /* in wincecompat.c */
116
117 extern void to_back_slashes (char *);
win32_target_ops::single_step
void(* single_step)(win32_thread_info *th)
Definition: win32-low.h:84
win32_target_ops::store_inferior_register
void(* store_inferior_register)(struct regcache *regcache, win32_thread_info *th, int r)
Definition: win32-low.h:81
win32_thread_info::thread_local_base
CORE_ADDR thread_local_base
Definition: win32-low.h:38
CORE_ADDR
bfd_vma CORE_ADDR
Definition: common-types.h:41
to_back_slashes
void to_back_slashes(char *)
Definition: wincecompat.c:33
win32_thread_info::suspended
int suspended
Definition: win32-low.h:41
the_low_target
struct win32_target_ops the_low_target
Definition: linux-aarch64-low.c:2955
win32_tdesc
const struct target_desc * win32_tdesc
Definition: win32-low.c:95
win32_target_ops::fetch_inferior_register
void(* fetch_inferior_register)(struct regcache *regcache, win32_thread_info *th, int r)
Definition: win32-low.h:77
regcache
Definition: regcache.h:31
win32_target_ops
Definition: win32-low.h:56
raw_breakpoint
Definition: mem-break.c:85
raw_bkpt_type
raw_bkpt_type
Definition: mem-break.h:41
win32_target_ops::insert_point
int(* insert_point)(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
Definition: win32-low.h:91
win32_target_ops::prepare_to_resume
void(* prepare_to_resume)(win32_thread_info *th)
Definition: win32-low.h:71
win32_require_context
void win32_require_context(win32_thread_info *th)
Definition: win32-low.c:171
win32_target_ops::remove_point
int(* remove_point)(enum raw_bkpt_type type, CORE_ADDR addr, int size, struct raw_breakpoint *bp)
Definition: win32-low.h:93
win32_target_ops::num_regs
int num_regs
Definition: win32-low.h:62
win32_target_ops::stopped_by_watchpoint
int(* stopped_by_watchpoint)(void)
Definition: win32-low.h:95
win32_target_ops::breakpoint_len
int breakpoint_len
Definition: win32-low.h:87
target_desc
Definition: tdesc.h:33
win32_target_ops::supports_z_point_type
int(* supports_z_point_type)(char z_type)
Definition: win32-low.h:90
win32_target_ops::thread_added
void(* thread_added)(win32_thread_info *th)
Definition: win32-low.h:74
win32_thread_info::debug_registers_changed
int debug_registers_changed
Definition: win32-low.h:53
win32_target_ops::initial_stuff
void(* initial_stuff)(void)
Definition: win32-low.h:65
win32_thread_info::tid
DWORD tid
Definition: win32-low.h:32
strwinerror
char * strwinerror(DWORD error)
Definition: win32-low.c:510
win32_thread_info::context
CONTEXT context
Definition: win32-low.h:49
win32_thread_info::h
HANDLE h
Definition: win32-low.h:35
win32_target_ops::stopped_data_address
CORE_ADDR(* stopped_data_address)(void)
Definition: win32-low.h:96
win32_target_ops::breakpoint
const unsigned char * breakpoint
Definition: win32-low.h:86
win32_thread_info
Definition: win32-low.h:29
error
void error(const char *fmt,...)
Definition: errors.c:38
win32_target_ops::arch_setup
void(* arch_setup)(void)
Definition: win32-low.h:59
win32_target_ops::get_thread_context
void(* get_thread_context)(win32_thread_info *th)
Definition: win32-low.h:68
win32_thread_info
struct win32_thread_info win32_thread_info