Commit | Line | Data |
---|---|---|
68070c10 | 1 | /* Internal interfaces for the Win32 specific target code for gdbserver. |
ecd75fc8 | 2 | Copyright (C) 2007-2014 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 PA |
18 | |
19 | #include <windows.h> | |
20 | ||
3aee8918 PA |
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 | ||
68070c10 PA |
27 | /* Thread information structure used to track extra information about |
28 | each thread. */ | |
29 | typedef struct win32_thread_info | |
30 | { | |
c436e841 | 31 | /* The Win32 thread identifier. */ |
68070c10 | 32 | DWORD tid; |
c436e841 PA |
33 | |
34 | /* The handle to the thread. */ | |
68070c10 | 35 | HANDLE h; |
c436e841 | 36 | |
711e434b PM |
37 | /* Thread Information Block address. */ |
38 | CORE_ADDR thread_local_base; | |
39 | ||
c436e841 PA |
40 | /* Non zero if SuspendThread was called on this thread. */ |
41 | int suspended; | |
42 | ||
9c6c8194 PA |
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. */ | |
68070c10 PA |
49 | CONTEXT context; |
50 | } win32_thread_info; | |
51 | ||
52 | struct win32_target_ops | |
53 | { | |
d05b4ac3 UW |
54 | /* Architecture-specific setup. */ |
55 | void (*arch_setup) (void); | |
56 | ||
34b34921 | 57 | /* The number of target registers. */ |
68070c10 PA |
58 | int num_regs; |
59 | ||
34b34921 | 60 | /* Perform initializations on startup. */ |
68070c10 PA |
61 | void (*initial_stuff) (void); |
62 | ||
34b34921 | 63 | /* Fetch the context from the inferior. */ |
493e2a69 MS |
64 | void (*get_thread_context) (win32_thread_info *th, |
65 | DEBUG_EVENT *current_event); | |
68070c10 | 66 | |
34b34921 | 67 | /* Flush the context back to the inferior. */ |
493e2a69 MS |
68 | void (*set_thread_context) (win32_thread_info *th, |
69 | DEBUG_EVENT *current_event); | |
34b34921 PA |
70 | |
71 | /* Called when a thread was added. */ | |
72 | void (*thread_added) (win32_thread_info *th); | |
73 | ||
74 | /* Fetch register from gdbserver regcache data. */ | |
442ea881 PA |
75 | void (*fetch_inferior_register) (struct regcache *regcache, |
76 | win32_thread_info *th, int r); | |
34b34921 PA |
77 | |
78 | /* Store a new register value into the thread context of TH. */ | |
442ea881 PA |
79 | void (*store_inferior_register) (struct regcache *regcache, |
80 | win32_thread_info *th, int r); | |
68070c10 PA |
81 | |
82 | void (*single_step) (win32_thread_info *th); | |
83 | ||
84 | const unsigned char *breakpoint; | |
85 | int breakpoint_len; | |
aa5ca48f DE |
86 | |
87 | /* Breakpoint/Watchpoint related functions. See target.h for comments. */ | |
88 | int (*insert_point) (char type, CORE_ADDR addr, int len); | |
89 | int (*remove_point) (char type, CORE_ADDR addr, int len); | |
90 | int (*stopped_by_watchpoint) (void); | |
91 | CORE_ADDR (*stopped_data_address) (void); | |
68070c10 PA |
92 | }; |
93 | ||
94 | extern struct win32_target_ops the_low_target; | |
95 | ||
68070c10 PA |
96 | /* Map the Windows error number in ERROR to a locale-dependent error |
97 | message string and return a pointer to it. Typically, the values | |
98 | for ERROR come from GetLastError. | |
99 | ||
100 | The string pointed to shall not be modified by the application, | |
101 | but may be overwritten by a subsequent call to strwinerror | |
102 | ||
103 | The strwinerror function does not change the current setting | |
104 | of GetLastError. */ | |
105 | extern char * strwinerror (DWORD error); | |
106 | ||
107 | /* in wincecompat.c */ | |
108 | ||
109 | extern void to_back_slashes (char *); |