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