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