Commit | Line | Data |
---|---|---|
b811d2c2 | 1 | /* Copyright (C) 2008-2020 Free Software Foundation, Inc. |
bfb87e33 JB |
2 | |
3 | This file is part of GDB. | |
4 | ||
5 | This program is free software; you can redistribute it and/or modify | |
6 | it under the terms of the GNU General Public License as published by | |
7 | the Free Software Foundation; either version 3 of the License, or | |
8 | (at your option) any later version. | |
9 | ||
10 | This program is distributed in the hope that it will be useful, | |
11 | but WITHOUT ANY WARRANTY; without even the implied warranty of | |
12 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | |
13 | GNU General Public License for more details. | |
14 | ||
15 | You should have received a copy of the GNU General Public License | |
16 | along with this program. If not, see <http://www.gnu.org/licenses/>. */ | |
17 | ||
18 | #include "defs.h" | |
31b060a2 | 19 | #include "windows-tdep.h" |
bfb87e33 JB |
20 | #include "gdb_obstack.h" |
21 | #include "xml-support.h" | |
711e434b PM |
22 | #include "gdbarch.h" |
23 | #include "target.h" | |
24 | #include "value.h" | |
25 | #include "inferior.h" | |
26 | #include "command.h" | |
27 | #include "gdbcmd.h" | |
28 | #include "gdbthread.h" | |
a8e1bb34 | 29 | #include "objfiles.h" |
3999122f PM |
30 | #include "symfile.h" |
31 | #include "coff-pe-read.h" | |
32 | #include "gdb_bfd.h" | |
33 | #include "complaints.h" | |
64870a42 YQ |
34 | #include "solib.h" |
35 | #include "solib-target.h" | |
2938e6cf | 36 | #include "gdbcore.h" |
584cf46d HD |
37 | #include "coff/internal.h" |
38 | #include "libcoff.h" | |
39 | #include "solist.h" | |
711e434b | 40 | |
559e7e50 EZ |
41 | /* Windows signal numbers differ between MinGW flavors and between |
42 | those and Cygwin. The below enumeration was gleaned from the | |
43 | respective headers; the ones marked with MinGW64/Cygwin are defined | |
44 | only by MinGW64 and Cygwin, not by mingw.org's MinGW. FIXME: We | |
45 | should really have distinct MinGW vs Cygwin OSABIs, and two | |
46 | separate enums, selected at runtime. */ | |
47 | ||
48 | enum | |
49 | { | |
50 | WINDOWS_SIGHUP = 1, /* MinGW64/Cygwin */ | |
51 | WINDOWS_SIGINT = 2, | |
52 | WINDOWS_SIGQUIT = 3, /* MinGW64/Cygwin */ | |
53 | WINDOWS_SIGILL = 4, | |
54 | WINDOWS_SIGTRAP = 5, /* MinGW64/Cygwin */ | |
55 | #ifdef __CYGWIN__ | |
89a65580 | 56 | WINDOWS_SIGABRT = 6, |
559e7e50 EZ |
57 | #else |
58 | WINDOWS_SIGIOT = 6, /* MinGW64 */ | |
59 | #endif | |
60 | WINDOWS_SIGEMT = 7, /* MinGW64/Cygwin */ | |
61 | WINDOWS_SIGFPE = 8, | |
62 | WINDOWS_SIGKILL = 9, /* MinGW64/Cygwin */ | |
63 | WINDOWS_SIGBUS = 10, /* MinGW64/Cygwin */ | |
64 | WINDOWS_SIGSEGV = 11, | |
65 | WINDOWS_SIGSYS = 12, /* MinGW64/Cygwin */ | |
66 | WINDOWS_SIGPIPE = 13,/* MinGW64/Cygwin */ | |
67 | WINDOWS_SIGALRM = 14,/* MinGW64/Cygwin */ | |
68 | WINDOWS_SIGTERM = 15, | |
69 | #ifdef __CYGWIN__ | |
70 | WINDOWS_SIGURG = 16, | |
71 | WINDOWS_SIGSTOP = 17, | |
72 | WINDOWS_SIGTSTP = 18, | |
73 | WINDOWS_SIGCONT = 19, | |
74 | WINDOWS_SIGCHLD = 20, | |
75 | WINDOWS_SIGTTIN = 21, | |
76 | WINDOWS_SIGTTOU = 22, | |
77 | WINDOWS_SIGIO = 23, | |
78 | WINDOWS_SIGXCPU = 24, | |
79 | WINDOWS_SIGXFSZ = 25, | |
80 | WINDOWS_SIGVTALRM = 26, | |
81 | WINDOWS_SIGPROF = 27, | |
82 | WINDOWS_SIGWINCH = 28, | |
83 | WINDOWS_SIGLOST = 29, | |
84 | WINDOWS_SIGUSR1 = 30, | |
85 | WINDOWS_SIGUSR2 = 31 | |
86 | #else | |
87 | WINDOWS_SIGBREAK = 21, | |
88 | WINDOWS_SIGABRT = 22 | |
89 | #endif | |
90 | }; | |
91 | ||
711e434b PM |
92 | struct cmd_list_element *info_w32_cmdlist; |
93 | ||
94 | typedef struct thread_information_block_32 | |
95 | { | |
96 | uint32_t current_seh; /* %fs:0x0000 */ | |
97 | uint32_t current_top_of_stack; /* %fs:0x0004 */ | |
98 | uint32_t current_bottom_of_stack; /* %fs:0x0008 */ | |
99 | uint32_t sub_system_tib; /* %fs:0x000c */ | |
100 | uint32_t fiber_data; /* %fs:0x0010 */ | |
101 | uint32_t arbitrary_data_slot; /* %fs:0x0014 */ | |
102 | uint32_t linear_address_tib; /* %fs:0x0018 */ | |
103 | uint32_t environment_pointer; /* %fs:0x001c */ | |
104 | uint32_t process_id; /* %fs:0x0020 */ | |
105 | uint32_t current_thread_id; /* %fs:0x0024 */ | |
106 | uint32_t active_rpc_handle; /* %fs:0x0028 */ | |
107 | uint32_t thread_local_storage; /* %fs:0x002c */ | |
108 | uint32_t process_environment_block; /* %fs:0x0030 */ | |
109 | uint32_t last_error_number; /* %fs:0x0034 */ | |
110 | } | |
111 | thread_information_32; | |
112 | ||
113 | typedef struct thread_information_block_64 | |
114 | { | |
115 | uint64_t current_seh; /* %gs:0x0000 */ | |
116 | uint64_t current_top_of_stack; /* %gs:0x0008 */ | |
117 | uint64_t current_bottom_of_stack; /* %gs:0x0010 */ | |
118 | uint64_t sub_system_tib; /* %gs:0x0018 */ | |
119 | uint64_t fiber_data; /* %gs:0x0020 */ | |
120 | uint64_t arbitrary_data_slot; /* %gs:0x0028 */ | |
121 | uint64_t linear_address_tib; /* %gs:0x0030 */ | |
122 | uint64_t environment_pointer; /* %gs:0x0038 */ | |
123 | uint64_t process_id; /* %gs:0x0040 */ | |
124 | uint64_t current_thread_id; /* %gs:0x0048 */ | |
125 | uint64_t active_rpc_handle; /* %gs:0x0050 */ | |
126 | uint64_t thread_local_storage; /* %gs:0x0058 */ | |
127 | uint64_t process_environment_block; /* %gs:0x0060 */ | |
128 | uint64_t last_error_number; /* %gs:0x0068 */ | |
129 | } | |
130 | thread_information_64; | |
131 | ||
132 | ||
133 | static const char* TIB_NAME[] = | |
134 | { | |
135 | " current_seh ", /* %fs:0x0000 */ | |
136 | " current_top_of_stack ", /* %fs:0x0004 */ | |
137 | " current_bottom_of_stack ", /* %fs:0x0008 */ | |
138 | " sub_system_tib ", /* %fs:0x000c */ | |
139 | " fiber_data ", /* %fs:0x0010 */ | |
140 | " arbitrary_data_slot ", /* %fs:0x0014 */ | |
141 | " linear_address_tib ", /* %fs:0x0018 */ | |
142 | " environment_pointer ", /* %fs:0x001c */ | |
143 | " process_id ", /* %fs:0x0020 */ | |
144 | " current_thread_id ", /* %fs:0x0024 */ | |
145 | " active_rpc_handle ", /* %fs:0x0028 */ | |
146 | " thread_local_storage ", /* %fs:0x002c */ | |
147 | " process_environment_block ", /* %fs:0x0030 */ | |
148 | " last_error_number " /* %fs:0x0034 */ | |
149 | }; | |
150 | ||
581e13c1 MS |
151 | static const int MAX_TIB32 = |
152 | sizeof (thread_information_32) / sizeof (uint32_t); | |
153 | static const int MAX_TIB64 = | |
154 | sizeof (thread_information_64) / sizeof (uint64_t); | |
711e434b PM |
155 | static const int FULL_TIB_SIZE = 0x1000; |
156 | ||
491144b5 | 157 | static bool maint_display_all_tib = false; |
711e434b | 158 | |
7928d571 HD |
159 | static struct gdbarch_data *windows_gdbarch_data_handle; |
160 | ||
161 | struct windows_gdbarch_data | |
162 | { | |
163 | struct type *siginfo_type; | |
cd5900f3 | 164 | struct type *tib_ptr_type; /* Type of thread information block */ |
7928d571 HD |
165 | }; |
166 | ||
167 | /* Allocate windows_gdbarch_data for an arch. */ | |
168 | ||
169 | static void * | |
170 | init_windows_gdbarch_data (struct gdbarch *gdbarch) | |
171 | { | |
172 | return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct windows_gdbarch_data); | |
173 | } | |
174 | ||
175 | /* Get windows_gdbarch_data of an arch. */ | |
176 | ||
177 | static struct windows_gdbarch_data * | |
178 | get_windows_gdbarch_data (struct gdbarch *gdbarch) | |
179 | { | |
180 | return ((struct windows_gdbarch_data *) | |
181 | gdbarch_data (gdbarch, windows_gdbarch_data_handle)); | |
182 | } | |
183 | ||
711e434b PM |
184 | /* Define Thread Local Base pointer type. */ |
185 | ||
186 | static struct type * | |
187 | windows_get_tlb_type (struct gdbarch *gdbarch) | |
188 | { | |
189 | struct type *dword_ptr_type, *dword32_type, *void_ptr_type; | |
190 | struct type *peb_ldr_type, *peb_ldr_ptr_type; | |
870f88f7 | 191 | struct type *peb_type, *peb_ptr_type, *list_type; |
711e434b PM |
192 | struct type *module_list_ptr_type; |
193 | struct type *tib_type, *seh_type, *tib_ptr_type, *seh_ptr_type; | |
e0cdfe3c HD |
194 | struct type *word_type, *wchar_type, *wchar_ptr_type; |
195 | struct type *uni_str_type, *rupp_type, *rupp_ptr_type; | |
711e434b | 196 | |
cd5900f3 HD |
197 | windows_gdbarch_data *windows_gdbarch_data |
198 | = get_windows_gdbarch_data (gdbarch); | |
199 | if (windows_gdbarch_data->tib_ptr_type != nullptr) | |
200 | return windows_gdbarch_data->tib_ptr_type; | |
201 | ||
711e434b PM |
202 | dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), |
203 | 1, "DWORD_PTR"); | |
204 | dword32_type = arch_integer_type (gdbarch, 32, | |
205 | 1, "DWORD32"); | |
e0cdfe3c HD |
206 | word_type = arch_integer_type (gdbarch, 16, |
207 | 1, "WORD"); | |
208 | wchar_type = arch_integer_type (gdbarch, 16, | |
209 | 1, "wchar_t"); | |
711e434b | 210 | void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void); |
e0cdfe3c HD |
211 | wchar_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), |
212 | NULL, wchar_type); | |
711e434b PM |
213 | |
214 | /* list entry */ | |
215 | ||
216 | list_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
217 | TYPE_NAME (list_type) = xstrdup ("list"); | |
218 | ||
711e434b PM |
219 | module_list_ptr_type = void_ptr_type; |
220 | ||
581e13c1 MS |
221 | append_composite_type_field (list_type, "forward_list", |
222 | module_list_ptr_type); | |
711e434b PM |
223 | append_composite_type_field (list_type, "backward_list", |
224 | module_list_ptr_type); | |
225 | ||
226 | /* Structured Exception Handler */ | |
227 | ||
228 | seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
229 | TYPE_NAME (seh_type) = xstrdup ("seh"); | |
230 | ||
231 | seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, | |
77b7c781 UW |
232 | TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, |
233 | NULL); | |
711e434b PM |
234 | TYPE_TARGET_TYPE (seh_ptr_type) = seh_type; |
235 | ||
236 | append_composite_type_field (seh_type, "next_seh", seh_ptr_type); | |
e8e6c82e PM |
237 | append_composite_type_field (seh_type, "handler", |
238 | builtin_type (gdbarch)->builtin_func_ptr); | |
711e434b PM |
239 | |
240 | /* struct _PEB_LDR_DATA */ | |
241 | peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
242 | TYPE_NAME (peb_ldr_type) = xstrdup ("peb_ldr_data"); | |
243 | ||
244 | append_composite_type_field (peb_ldr_type, "length", dword32_type); | |
245 | append_composite_type_field (peb_ldr_type, "initialized", dword32_type); | |
246 | append_composite_type_field (peb_ldr_type, "ss_handle", void_ptr_type); | |
247 | append_composite_type_field (peb_ldr_type, "in_load_order", list_type); | |
248 | append_composite_type_field (peb_ldr_type, "in_memory_order", list_type); | |
249 | append_composite_type_field (peb_ldr_type, "in_init_order", list_type); | |
250 | append_composite_type_field (peb_ldr_type, "entry_in_progress", | |
251 | void_ptr_type); | |
252 | peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, | |
77b7c781 UW |
253 | TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, |
254 | NULL); | |
711e434b PM |
255 | TYPE_TARGET_TYPE (peb_ldr_ptr_type) = peb_ldr_type; |
256 | ||
e0cdfe3c HD |
257 | /* struct UNICODE_STRING */ |
258 | uni_str_type = arch_composite_type (gdbarch, "unicode_string", | |
259 | TYPE_CODE_STRUCT); | |
260 | ||
261 | append_composite_type_field (uni_str_type, "length", word_type); | |
262 | append_composite_type_field (uni_str_type, "maximum_length", word_type); | |
263 | append_composite_type_field_aligned (uni_str_type, "buffer", | |
264 | wchar_ptr_type, | |
265 | TYPE_LENGTH (wchar_ptr_type)); | |
266 | ||
267 | /* struct _RTL_USER_PROCESS_PARAMETERS */ | |
268 | rupp_type = arch_composite_type (gdbarch, "rtl_user_process_parameters", | |
269 | TYPE_CODE_STRUCT); | |
270 | ||
271 | append_composite_type_field (rupp_type, "maximum_length", dword32_type); | |
272 | append_composite_type_field (rupp_type, "length", dword32_type); | |
273 | append_composite_type_field (rupp_type, "flags", dword32_type); | |
274 | append_composite_type_field (rupp_type, "debug_flags", dword32_type); | |
275 | append_composite_type_field (rupp_type, "console_handle", void_ptr_type); | |
276 | append_composite_type_field (rupp_type, "console_flags", dword32_type); | |
277 | append_composite_type_field_aligned (rupp_type, "standard_input", | |
278 | void_ptr_type, | |
279 | TYPE_LENGTH (void_ptr_type)); | |
280 | append_composite_type_field (rupp_type, "standard_output", void_ptr_type); | |
281 | append_composite_type_field (rupp_type, "standard_error", void_ptr_type); | |
282 | append_composite_type_field (rupp_type, "current_directory", uni_str_type); | |
283 | append_composite_type_field (rupp_type, "current_directory_handle", | |
284 | void_ptr_type); | |
285 | append_composite_type_field (rupp_type, "dll_path", uni_str_type); | |
286 | append_composite_type_field (rupp_type, "image_path_name", uni_str_type); | |
287 | append_composite_type_field (rupp_type, "command_line", uni_str_type); | |
288 | append_composite_type_field (rupp_type, "environment", void_ptr_type); | |
289 | append_composite_type_field (rupp_type, "starting_x", dword32_type); | |
290 | append_composite_type_field (rupp_type, "starting_y", dword32_type); | |
291 | append_composite_type_field (rupp_type, "count_x", dword32_type); | |
292 | append_composite_type_field (rupp_type, "count_y", dword32_type); | |
293 | append_composite_type_field (rupp_type, "count_chars_x", dword32_type); | |
294 | append_composite_type_field (rupp_type, "count_chars_y", dword32_type); | |
295 | append_composite_type_field (rupp_type, "fill_attribute", dword32_type); | |
296 | append_composite_type_field (rupp_type, "window_flags", dword32_type); | |
297 | append_composite_type_field (rupp_type, "show_window_flags", dword32_type); | |
298 | append_composite_type_field_aligned (rupp_type, "window_title", | |
299 | uni_str_type, | |
300 | TYPE_LENGTH (void_ptr_type)); | |
301 | append_composite_type_field (rupp_type, "desktop_info", uni_str_type); | |
302 | append_composite_type_field (rupp_type, "shell_info", uni_str_type); | |
303 | append_composite_type_field (rupp_type, "runtime_data", uni_str_type); | |
304 | ||
305 | rupp_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), | |
306 | NULL, rupp_type); | |
307 | ||
711e434b PM |
308 | |
309 | /* struct process environment block */ | |
310 | peb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
311 | TYPE_NAME (peb_type) = xstrdup ("peb"); | |
312 | ||
313 | /* First bytes contain several flags. */ | |
314 | append_composite_type_field (peb_type, "flags", dword_ptr_type); | |
315 | append_composite_type_field (peb_type, "mutant", void_ptr_type); | |
316 | append_composite_type_field (peb_type, "image_base_address", void_ptr_type); | |
317 | append_composite_type_field (peb_type, "ldr", peb_ldr_ptr_type); | |
e0cdfe3c | 318 | append_composite_type_field (peb_type, "process_parameters", rupp_ptr_type); |
711e434b PM |
319 | append_composite_type_field (peb_type, "sub_system_data", void_ptr_type); |
320 | append_composite_type_field (peb_type, "process_heap", void_ptr_type); | |
321 | append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type); | |
322 | peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, | |
77b7c781 UW |
323 | TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, |
324 | NULL); | |
711e434b PM |
325 | TYPE_TARGET_TYPE (peb_ptr_type) = peb_type; |
326 | ||
327 | ||
328 | /* struct thread information block */ | |
329 | tib_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
330 | TYPE_NAME (tib_type) = xstrdup ("tib"); | |
331 | ||
332 | /* uint32_t current_seh; %fs:0x0000 */ | |
333 | append_composite_type_field (tib_type, "current_seh", seh_ptr_type); | |
334 | /* uint32_t current_top_of_stack; %fs:0x0004 */ | |
581e13c1 MS |
335 | append_composite_type_field (tib_type, "current_top_of_stack", |
336 | void_ptr_type); | |
711e434b PM |
337 | /* uint32_t current_bottom_of_stack; %fs:0x0008 */ |
338 | append_composite_type_field (tib_type, "current_bottom_of_stack", | |
339 | void_ptr_type); | |
340 | /* uint32_t sub_system_tib; %fs:0x000c */ | |
341 | append_composite_type_field (tib_type, "sub_system_tib", void_ptr_type); | |
342 | ||
343 | /* uint32_t fiber_data; %fs:0x0010 */ | |
344 | append_composite_type_field (tib_type, "fiber_data", void_ptr_type); | |
345 | /* uint32_t arbitrary_data_slot; %fs:0x0014 */ | |
346 | append_composite_type_field (tib_type, "arbitrary_data_slot", void_ptr_type); | |
347 | /* uint32_t linear_address_tib; %fs:0x0018 */ | |
348 | append_composite_type_field (tib_type, "linear_address_tib", void_ptr_type); | |
349 | /* uint32_t environment_pointer; %fs:0x001c */ | |
350 | append_composite_type_field (tib_type, "environment_pointer", void_ptr_type); | |
351 | /* uint32_t process_id; %fs:0x0020 */ | |
352 | append_composite_type_field (tib_type, "process_id", dword_ptr_type); | |
353 | /* uint32_t current_thread_id; %fs:0x0024 */ | |
354 | append_composite_type_field (tib_type, "thread_id", dword_ptr_type); | |
355 | /* uint32_t active_rpc_handle; %fs:0x0028 */ | |
356 | append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type); | |
357 | /* uint32_t thread_local_storage; %fs:0x002c */ | |
581e13c1 MS |
358 | append_composite_type_field (tib_type, "thread_local_storage", |
359 | void_ptr_type); | |
711e434b PM |
360 | /* uint32_t process_environment_block; %fs:0x0030 */ |
361 | append_composite_type_field (tib_type, "process_environment_block", | |
362 | peb_ptr_type); | |
363 | /* uint32_t last_error_number; %fs:0x0034 */ | |
364 | append_composite_type_field (tib_type, "last_error_number", dword_ptr_type); | |
365 | ||
366 | tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR, | |
77b7c781 UW |
367 | TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT, |
368 | NULL); | |
711e434b PM |
369 | TYPE_TARGET_TYPE (tib_ptr_type) = tib_type; |
370 | ||
cd5900f3 | 371 | windows_gdbarch_data->tib_ptr_type = tib_ptr_type; |
ea1fae46 | 372 | |
711e434b PM |
373 | return tib_ptr_type; |
374 | } | |
375 | ||
376 | /* The $_tlb convenience variable is a bit special. We don't know | |
377 | for sure the type of the value until we actually have a chance to | |
378 | fetch the data. The type can change depending on gdbarch, so it is | |
379 | also dependent on which thread you have selected. */ | |
380 | ||
381 | /* This function implements the lval_computed support for reading a | |
382 | $_tlb value. */ | |
383 | ||
384 | static void | |
385 | tlb_value_read (struct value *val) | |
386 | { | |
387 | CORE_ADDR tlb; | |
388 | struct type *type = check_typedef (value_type (val)); | |
389 | ||
390 | if (!target_get_tib_address (inferior_ptid, &tlb)) | |
391 | error (_("Unable to read tlb")); | |
392 | store_typed_address (value_contents_raw (val), type, tlb); | |
393 | } | |
394 | ||
395 | /* This function implements the lval_computed support for writing a | |
396 | $_tlb value. */ | |
397 | ||
398 | static void | |
399 | tlb_value_write (struct value *v, struct value *fromval) | |
400 | { | |
401 | error (_("Impossible to change the Thread Local Base")); | |
402 | } | |
403 | ||
c8f2448a | 404 | static const struct lval_funcs tlb_value_funcs = |
711e434b PM |
405 | { |
406 | tlb_value_read, | |
407 | tlb_value_write | |
408 | }; | |
409 | ||
410 | ||
411 | /* Return a new value with the correct type for the tlb object of | |
412 | the current thread using architecture GDBARCH. Return a void value | |
413 | if there's no object available. */ | |
414 | ||
415 | static struct value * | |
22d2b532 | 416 | tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore) |
711e434b | 417 | { |
d7e15655 | 418 | if (target_has_stack && inferior_ptid != null_ptid) |
711e434b PM |
419 | { |
420 | struct type *type = windows_get_tlb_type (gdbarch); | |
421 | return allocate_computed_value (type, &tlb_value_funcs, NULL); | |
422 | } | |
423 | ||
424 | return allocate_value (builtin_type (gdbarch)->builtin_void); | |
425 | } | |
426 | ||
427 | ||
428 | /* Display thread information block of a given thread. */ | |
429 | ||
430 | static int | |
431 | display_one_tib (ptid_t ptid) | |
432 | { | |
433 | gdb_byte *tib = NULL; | |
434 | gdb_byte *index; | |
435 | CORE_ADDR thread_local_base; | |
436 | ULONGEST i, val, max, max_name, size, tib_size; | |
f5656ead TT |
437 | ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch ()); |
438 | enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ()); | |
711e434b PM |
439 | |
440 | if (sizeof_ptr == 64) | |
441 | { | |
442 | size = sizeof (uint64_t); | |
443 | tib_size = sizeof (thread_information_64); | |
444 | max = MAX_TIB64; | |
445 | } | |
446 | else | |
447 | { | |
448 | size = sizeof (uint32_t); | |
449 | tib_size = sizeof (thread_information_32); | |
450 | max = MAX_TIB32; | |
451 | } | |
452 | ||
453 | max_name = max; | |
454 | ||
455 | if (maint_display_all_tib) | |
456 | { | |
457 | tib_size = FULL_TIB_SIZE; | |
458 | max = tib_size / size; | |
459 | } | |
460 | ||
224c3ddb | 461 | tib = (gdb_byte *) alloca (tib_size); |
711e434b PM |
462 | |
463 | if (target_get_tib_address (ptid, &thread_local_base) == 0) | |
464 | { | |
465 | printf_filtered (_("Unable to get thread local base for %s\n"), | |
a068643d | 466 | target_pid_to_str (ptid).c_str ()); |
711e434b PM |
467 | return -1; |
468 | } | |
469 | ||
8b88a78e | 470 | if (target_read (current_top_target (), TARGET_OBJECT_MEMORY, |
711e434b PM |
471 | NULL, tib, thread_local_base, tib_size) != tib_size) |
472 | { | |
581e13c1 MS |
473 | printf_filtered (_("Unable to read thread information " |
474 | "block for %s at address %s\n"), | |
a068643d TT |
475 | target_pid_to_str (ptid).c_str (), |
476 | paddress (target_gdbarch (), thread_local_base)); | |
711e434b PM |
477 | return -1; |
478 | } | |
479 | ||
480 | printf_filtered (_("Thread Information Block %s at %s\n"), | |
a068643d | 481 | target_pid_to_str (ptid).c_str (), |
f5656ead | 482 | paddress (target_gdbarch (), thread_local_base)); |
711e434b PM |
483 | |
484 | index = (gdb_byte *) tib; | |
485 | ||
486 | /* All fields have the size of a pointer, this allows to iterate | |
487 | using the same for loop for both layouts. */ | |
488 | for (i = 0; i < max; i++) | |
489 | { | |
490 | val = extract_unsigned_integer (index, size, byte_order); | |
491 | if (i < max_name) | |
492 | printf_filtered (_("%s is 0x%s\n"), TIB_NAME[i], phex (val, size)); | |
493 | else if (val != 0) | |
494 | printf_filtered (_("TIB[0x%s] is 0x%s\n"), phex (i * size, 2), | |
495 | phex (val, size)); | |
496 | index += size; | |
497 | } | |
498 | return 1; | |
499 | } | |
500 | ||
5d5658a1 | 501 | /* Display thread information block of the current thread. */ |
711e434b PM |
502 | |
503 | static void | |
c281872e | 504 | display_tib (const char * args, int from_tty) |
711e434b | 505 | { |
d7e15655 | 506 | if (inferior_ptid != null_ptid) |
711e434b PM |
507 | display_one_tib (inferior_ptid); |
508 | } | |
bfb87e33 JB |
509 | |
510 | void | |
dc05df57 | 511 | windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr, |
c162ed3e | 512 | CORE_ADDR *text_offset_cached, |
5af949e3 | 513 | struct gdbarch *gdbarch, struct obstack *obstack) |
bfb87e33 | 514 | { |
c162ed3e | 515 | CORE_ADDR text_offset = text_offset_cached ? *text_offset_cached : 0; |
3999122f | 516 | |
bfb87e33 | 517 | obstack_grow_str (obstack, "<library name=\""); |
5e187554 SM |
518 | std::string p = xml_escape_text (so_name); |
519 | obstack_grow_str (obstack, p.c_str ()); | |
5af949e3 | 520 | obstack_grow_str (obstack, "\"><segment address=\""); |
c162ed3e HD |
521 | |
522 | if (!text_offset) | |
523 | { | |
524 | gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget, -1)); | |
525 | /* The following calls are OK even if dll is NULL. | |
526 | The default value 0x1000 is returned by pe_text_section_offset | |
527 | in that case. */ | |
528 | text_offset = pe_text_section_offset (dll.get ()); | |
529 | if (text_offset_cached) | |
530 | *text_offset_cached = text_offset; | |
531 | } | |
532 | ||
3999122f | 533 | obstack_grow_str (obstack, paddress (gdbarch, load_addr + text_offset)); |
bfb87e33 JB |
534 | obstack_grow_str (obstack, "\"/></library>"); |
535 | } | |
711e434b | 536 | |
a8e1bb34 JB |
537 | /* Implement the "iterate_over_objfiles_in_search_order" gdbarch |
538 | method. It searches all objfiles, starting with CURRENT_OBJFILE | |
539 | first (if not NULL). | |
540 | ||
541 | On Windows, the system behaves a little differently when two | |
542 | objfiles each define a global symbol using the same name, compared | |
543 | to other platforms such as GNU/Linux for instance. On GNU/Linux, | |
544 | all instances of the symbol effectively get merged into a single | |
545 | one, but on Windows, they remain distinct. | |
546 | ||
547 | As a result, it usually makes sense to start global symbol searches | |
548 | with the current objfile before expanding it to all other objfiles. | |
549 | This helps for instance when a user debugs some code in a DLL that | |
550 | refers to a global variable defined inside that DLL. When trying | |
551 | to print the value of that global variable, it would be unhelpful | |
552 | to print the value of another global variable defined with the same | |
553 | name, but in a different DLL. */ | |
554 | ||
64870a42 | 555 | static void |
a8e1bb34 JB |
556 | windows_iterate_over_objfiles_in_search_order |
557 | (struct gdbarch *gdbarch, | |
558 | iterate_over_objfiles_in_search_order_cb_ftype *cb, | |
559 | void *cb_data, struct objfile *current_objfile) | |
560 | { | |
561 | int stop; | |
a8e1bb34 JB |
562 | |
563 | if (current_objfile) | |
564 | { | |
565 | stop = cb (current_objfile, cb_data); | |
566 | if (stop) | |
567 | return; | |
568 | } | |
569 | ||
2030c079 | 570 | for (objfile *objfile : current_program_space->objfiles ()) |
a8e1bb34 JB |
571 | { |
572 | if (objfile != current_objfile) | |
573 | { | |
574 | stop = cb (objfile, cb_data); | |
575 | if (stop) | |
576 | return; | |
577 | } | |
578 | } | |
579 | } | |
580 | ||
711e434b PM |
581 | static void |
582 | show_maint_show_all_tib (struct ui_file *file, int from_tty, | |
583 | struct cmd_list_element *c, const char *value) | |
584 | { | |
581e13c1 MS |
585 | fprintf_filtered (file, _("Show all non-zero elements of " |
586 | "Thread Information Block is %s.\n"), value); | |
711e434b PM |
587 | } |
588 | ||
589 | static void | |
981a3fb3 | 590 | info_w32_command (const char *args, int from_tty) |
711e434b PM |
591 | { |
592 | help_list (info_w32_cmdlist, "info w32 ", class_info, gdb_stdout); | |
593 | } | |
594 | ||
595 | static int w32_prefix_command_valid = 0; | |
596 | void | |
597 | init_w32_command_list (void) | |
598 | { | |
599 | if (!w32_prefix_command_valid) | |
600 | { | |
601 | add_prefix_cmd ("w32", class_info, info_w32_command, | |
602 | _("Print information specific to Win32 debugging."), | |
603 | &info_w32_cmdlist, "info w32 ", 0, &infolist); | |
604 | w32_prefix_command_valid = 1; | |
605 | } | |
606 | } | |
607 | ||
559e7e50 EZ |
608 | /* Implementation of `gdbarch_gdb_signal_to_target'. */ |
609 | ||
610 | static int | |
611 | windows_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal) | |
612 | { | |
613 | switch (signal) | |
614 | { | |
615 | case GDB_SIGNAL_0: | |
616 | return 0; | |
617 | case GDB_SIGNAL_HUP: | |
618 | return WINDOWS_SIGHUP; | |
619 | case GDB_SIGNAL_INT: | |
620 | return WINDOWS_SIGINT; | |
621 | case GDB_SIGNAL_QUIT: | |
622 | return WINDOWS_SIGQUIT; | |
623 | case GDB_SIGNAL_ILL: | |
624 | return WINDOWS_SIGILL; | |
625 | case GDB_SIGNAL_TRAP: | |
626 | return WINDOWS_SIGTRAP; | |
627 | case GDB_SIGNAL_ABRT: | |
628 | return WINDOWS_SIGABRT; | |
629 | case GDB_SIGNAL_EMT: | |
630 | return WINDOWS_SIGEMT; | |
631 | case GDB_SIGNAL_FPE: | |
632 | return WINDOWS_SIGFPE; | |
633 | case GDB_SIGNAL_KILL: | |
634 | return WINDOWS_SIGKILL; | |
635 | case GDB_SIGNAL_BUS: | |
636 | return WINDOWS_SIGBUS; | |
637 | case GDB_SIGNAL_SEGV: | |
638 | return WINDOWS_SIGSEGV; | |
639 | case GDB_SIGNAL_SYS: | |
640 | return WINDOWS_SIGSYS; | |
641 | case GDB_SIGNAL_PIPE: | |
642 | return WINDOWS_SIGPIPE; | |
643 | case GDB_SIGNAL_ALRM: | |
644 | return WINDOWS_SIGALRM; | |
645 | case GDB_SIGNAL_TERM: | |
646 | return WINDOWS_SIGTERM; | |
647 | #ifdef __CYGWIN__ | |
648 | case GDB_SIGNAL_URG: | |
649 | return WINDOWS_SIGURG; | |
650 | case GDB_SIGNAL_STOP: | |
651 | return WINDOWS_SIGSTOP; | |
652 | case GDB_SIGNAL_TSTP: | |
653 | return WINDOWS_SIGTSTP; | |
654 | case GDB_SIGNAL_CONT: | |
655 | return WINDOWS_SIGCONT; | |
656 | case GDB_SIGNAL_CHLD: | |
657 | return WINDOWS_SIGCHLD; | |
658 | case GDB_SIGNAL_TTIN: | |
659 | return WINDOWS_SIGTTIN; | |
660 | case GDB_SIGNAL_TTOU: | |
661 | return WINDOWS_SIGTTOU; | |
662 | case GDB_SIGNAL_IO: | |
663 | return WINDOWS_SIGIO; | |
664 | case GDB_SIGNAL_XCPU: | |
665 | return WINDOWS_SIGXCPU; | |
666 | case GDB_SIGNAL_XFSZ: | |
667 | return WINDOWS_SIGXFSZ; | |
668 | case GDB_SIGNAL_VTALRM: | |
669 | return WINDOWS_SIGVTALRM; | |
670 | case GDB_SIGNAL_PROF: | |
671 | return WINDOWS_SIGPROF; | |
672 | case GDB_SIGNAL_WINCH: | |
673 | return WINDOWS_SIGWINCH; | |
674 | case GDB_SIGNAL_PWR: | |
675 | return WINDOWS_SIGLOST; | |
676 | case GDB_SIGNAL_USR1: | |
677 | return WINDOWS_SIGUSR1; | |
678 | case GDB_SIGNAL_USR2: | |
679 | return WINDOWS_SIGUSR2; | |
680 | #endif /* __CYGWIN__ */ | |
681 | } | |
682 | return -1; | |
683 | } | |
684 | ||
6bafc845 HD |
685 | struct enum_value_name |
686 | { | |
687 | uint32_t value; | |
688 | const char *name; | |
689 | }; | |
690 | ||
691 | /* Allocate a TYPE_CODE_ENUM type structure with its named values. */ | |
692 | ||
693 | static struct type * | |
694 | create_enum (struct gdbarch *gdbarch, int bit, const char *name, | |
695 | const struct enum_value_name *values, int count) | |
696 | { | |
697 | struct type *type; | |
698 | int i; | |
699 | ||
700 | type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name); | |
701 | TYPE_NFIELDS (type) = count; | |
702 | TYPE_FIELDS (type) = (struct field *) | |
703 | TYPE_ZALLOC (type, sizeof (struct field) * count); | |
704 | TYPE_UNSIGNED (type) = 1; | |
705 | ||
706 | for (i = 0; i < count; i++) | |
707 | { | |
708 | TYPE_FIELD_NAME (type, i) = values[i].name; | |
709 | SET_FIELD_ENUMVAL (TYPE_FIELD (type, i), values[i].value); | |
710 | } | |
711 | ||
712 | return type; | |
713 | } | |
714 | ||
715 | static const struct enum_value_name exception_values[] = | |
716 | { | |
717 | { 0x40000015, "FATAL_APP_EXIT" }, | |
718 | { 0x40010005, "DBG_CONTROL_C" }, | |
719 | { 0x40010008, "DBG_CONTROL_BREAK" }, | |
720 | { 0x80000002, "DATATYPE_MISALIGNMENT" }, | |
721 | { 0x80000003, "BREAKPOINT" }, | |
722 | { 0x80000004, "SINGLE_STEP" }, | |
723 | { 0xC0000005, "ACCESS_VIOLATION" }, | |
724 | { 0xC0000006, "IN_PAGE_ERROR" }, | |
725 | { 0xC000001D, "ILLEGAL_INSTRUCTION" }, | |
726 | { 0xC0000025, "NONCONTINUABLE_EXCEPTION" }, | |
727 | { 0xC0000026, "INVALID_DISPOSITION" }, | |
728 | { 0xC000008C, "ARRAY_BOUNDS_EXCEEDED" }, | |
729 | { 0xC000008D, "FLOAT_DENORMAL_OPERAND" }, | |
730 | { 0xC000008E, "FLOAT_DIVIDE_BY_ZERO" }, | |
731 | { 0xC000008F, "FLOAT_INEXACT_RESULT" }, | |
732 | { 0xC0000090, "FLOAT_INVALID_OPERATION" }, | |
733 | { 0xC0000091, "FLOAT_OVERFLOW" }, | |
734 | { 0xC0000092, "FLOAT_STACK_CHECK" }, | |
735 | { 0xC0000093, "FLOAT_UNDERFLOW" }, | |
736 | { 0xC0000094, "INTEGER_DIVIDE_BY_ZERO" }, | |
737 | { 0xC0000095, "INTEGER_OVERFLOW" }, | |
738 | { 0xC0000096, "PRIV_INSTRUCTION" }, | |
739 | { 0xC00000FD, "STACK_OVERFLOW" }, | |
740 | { 0xC0000409, "FAST_FAIL" }, | |
741 | }; | |
742 | ||
743 | static const struct enum_value_name violation_values[] = | |
744 | { | |
745 | { 0, "READ_ACCESS_VIOLATION" }, | |
746 | { 1, "WRITE_ACCESS_VIOLATION" }, | |
747 | { 8, "DATA_EXECUTION_PREVENTION_VIOLATION" }, | |
748 | }; | |
749 | ||
7928d571 HD |
750 | /* Implement the "get_siginfo_type" gdbarch method. */ |
751 | ||
752 | static struct type * | |
753 | windows_get_siginfo_type (struct gdbarch *gdbarch) | |
754 | { | |
755 | struct windows_gdbarch_data *windows_gdbarch_data; | |
756 | struct type *dword_type, *pvoid_type, *ulongptr_type; | |
6bafc845 HD |
757 | struct type *code_enum, *violation_enum; |
758 | struct type *violation_type, *para_type, *siginfo_ptr_type, *siginfo_type; | |
7928d571 HD |
759 | |
760 | windows_gdbarch_data = get_windows_gdbarch_data (gdbarch); | |
761 | if (windows_gdbarch_data->siginfo_type != NULL) | |
762 | return windows_gdbarch_data->siginfo_type; | |
763 | ||
764 | dword_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch), | |
765 | 1, "DWORD"); | |
766 | pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID", | |
767 | builtin_type (gdbarch)->builtin_void); | |
768 | ulongptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch), | |
769 | 1, "ULONG_PTR"); | |
770 | ||
6bafc845 HD |
771 | /* ExceptionCode value names */ |
772 | code_enum = create_enum (gdbarch, gdbarch_int_bit (gdbarch), | |
773 | "ExceptionCode", exception_values, | |
774 | ARRAY_SIZE (exception_values)); | |
775 | ||
776 | /* ACCESS_VIOLATION type names */ | |
777 | violation_enum = create_enum (gdbarch, gdbarch_ptr_bit (gdbarch), | |
778 | "ViolationType", violation_values, | |
779 | ARRAY_SIZE (violation_values)); | |
780 | ||
781 | /* ACCESS_VIOLATION information */ | |
782 | violation_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT); | |
783 | append_composite_type_field (violation_type, "Type", violation_enum); | |
784 | append_composite_type_field (violation_type, "Address", pvoid_type); | |
785 | ||
786 | /* Unnamed union of the documented field ExceptionInformation, | |
787 | and the alternative AccessViolationInformation (which displays | |
788 | human-readable values for ExceptionCode ACCESS_VIOLATION). */ | |
789 | para_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION); | |
790 | append_composite_type_field (para_type, "ExceptionInformation", | |
791 | lookup_array_range_type (ulongptr_type, 0, 14)); | |
792 | append_composite_type_field (para_type, "AccessViolationInformation", | |
793 | violation_type); | |
794 | ||
7928d571 HD |
795 | siginfo_type = arch_composite_type (gdbarch, "EXCEPTION_RECORD", |
796 | TYPE_CODE_STRUCT); | |
797 | siginfo_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), | |
798 | NULL, siginfo_type); | |
799 | ||
6bafc845 HD |
800 | /* ExceptionCode is documented as type DWORD, but here a helper |
801 | enum type is used instead to display a human-readable value. */ | |
802 | append_composite_type_field (siginfo_type, "ExceptionCode", code_enum); | |
7928d571 HD |
803 | append_composite_type_field (siginfo_type, "ExceptionFlags", dword_type); |
804 | append_composite_type_field (siginfo_type, "ExceptionRecord", | |
805 | siginfo_ptr_type); | |
806 | append_composite_type_field (siginfo_type, "ExceptionAddress", | |
807 | pvoid_type); | |
808 | append_composite_type_field (siginfo_type, "NumberParameters", dword_type); | |
809 | /* The 64-bit variant needs some padding. */ | |
6bafc845 HD |
810 | append_composite_type_field_aligned (siginfo_type, "", |
811 | para_type, TYPE_LENGTH (ulongptr_type)); | |
7928d571 HD |
812 | |
813 | windows_gdbarch_data->siginfo_type = siginfo_type; | |
814 | ||
815 | return siginfo_type; | |
816 | } | |
817 | ||
584cf46d HD |
818 | /* Implement the "solib_create_inferior_hook" target_so_ops method. */ |
819 | ||
820 | static void | |
821 | windows_solib_create_inferior_hook (int from_tty) | |
822 | { | |
823 | CORE_ADDR exec_base = 0; | |
824 | ||
825 | /* Find base address of main executable in | |
826 | TIB->process_environment_block->image_base_address. */ | |
827 | struct gdbarch *gdbarch = target_gdbarch (); | |
828 | enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); | |
829 | int ptr_bytes; | |
830 | int peb_offset; /* Offset of process_environment_block in TIB. */ | |
831 | int base_offset; /* Offset of image_base_address in PEB. */ | |
832 | if (gdbarch_ptr_bit (gdbarch) == 32) | |
833 | { | |
834 | ptr_bytes = 4; | |
835 | peb_offset = 48; | |
836 | base_offset = 8; | |
837 | } | |
838 | else | |
839 | { | |
840 | ptr_bytes = 8; | |
841 | peb_offset = 96; | |
842 | base_offset = 16; | |
843 | } | |
844 | CORE_ADDR tlb; | |
845 | gdb_byte buf[8]; | |
846 | if (target_get_tib_address (inferior_ptid, &tlb) | |
847 | && !target_read_memory (tlb + peb_offset, buf, ptr_bytes)) | |
848 | { | |
849 | CORE_ADDR peb = extract_unsigned_integer (buf, ptr_bytes, byte_order); | |
850 | if (!target_read_memory (peb + base_offset, buf, ptr_bytes)) | |
851 | exec_base = extract_unsigned_integer (buf, ptr_bytes, byte_order); | |
852 | } | |
853 | ||
854 | /* Rebase executable if the base address changed because of ASLR. */ | |
855 | if (symfile_objfile != nullptr && exec_base != 0) | |
856 | { | |
857 | CORE_ADDR vmaddr = pe_data (exec_bfd)->pe_opthdr.ImageBase; | |
858 | if (vmaddr != exec_base) | |
859 | objfile_rebase (symfile_objfile, exec_base - vmaddr); | |
860 | } | |
861 | } | |
862 | ||
863 | static struct target_so_ops windows_so_ops; | |
864 | ||
64870a42 YQ |
865 | /* To be called from the various GDB_OSABI_CYGWIN handlers for the |
866 | various Windows architectures and machine types. */ | |
867 | ||
868 | void | |
869 | windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) | |
870 | { | |
53375380 PA |
871 | set_gdbarch_wchar_bit (gdbarch, 16); |
872 | set_gdbarch_wchar_signed (gdbarch, 0); | |
873 | ||
64870a42 YQ |
874 | /* Canonical paths on this target look like |
875 | `c:\Program Files\Foo App\mydll.dll', for example. */ | |
876 | set_gdbarch_has_dos_based_file_system (gdbarch, 1); | |
877 | ||
878 | set_gdbarch_iterate_over_objfiles_in_search_order | |
879 | (gdbarch, windows_iterate_over_objfiles_in_search_order); | |
880 | ||
559e7e50 EZ |
881 | set_gdbarch_gdb_signal_to_target (gdbarch, windows_gdb_signal_to_target); |
882 | ||
584cf46d HD |
883 | windows_so_ops = solib_target_so_ops; |
884 | windows_so_ops.solib_create_inferior_hook | |
885 | = windows_solib_create_inferior_hook; | |
886 | set_solib_ops (gdbarch, &windows_so_ops); | |
7928d571 HD |
887 | |
888 | set_gdbarch_get_siginfo_type (gdbarch, windows_get_siginfo_type); | |
64870a42 YQ |
889 | } |
890 | ||
22d2b532 SDJ |
891 | /* Implementation of `tlb' variable. */ |
892 | ||
893 | static const struct internalvar_funcs tlb_funcs = | |
894 | { | |
895 | tlb_make_value, | |
896 | NULL, | |
897 | NULL | |
898 | }; | |
899 | ||
6c265988 | 900 | void _initialize_windows_tdep (); |
711e434b | 901 | void |
6c265988 | 902 | _initialize_windows_tdep () |
711e434b | 903 | { |
7928d571 HD |
904 | windows_gdbarch_data_handle |
905 | = gdbarch_data_register_post_init (init_windows_gdbarch_data); | |
906 | ||
711e434b PM |
907 | init_w32_command_list (); |
908 | add_cmd ("thread-information-block", class_info, display_tib, | |
909 | _("Display thread information block."), | |
910 | &info_w32_cmdlist); | |
911 | add_alias_cmd ("tib", "thread-information-block", class_info, 1, | |
912 | &info_w32_cmdlist); | |
913 | ||
914 | add_setshow_boolean_cmd ("show-all-tib", class_maintenance, | |
915 | &maint_display_all_tib, _("\ | |
916 | Set whether to display all non-zero fields of thread information block."), _("\ | |
917 | Show whether to display all non-zero fields of thread information block."), _("\ | |
918 | Use \"on\" to enable, \"off\" to disable.\n\ | |
919 | If enabled, all non-zero fields of thread information block are displayed,\n\ | |
920 | even if their meaning is unknown."), | |
921 | NULL, | |
922 | show_maint_show_all_tib, | |
923 | &maintenance_set_cmdlist, | |
924 | &maintenance_show_cmdlist); | |
925 | ||
926 | /* Explicitly create without lookup, since that tries to create a | |
927 | value with a void typed value, and when we get here, gdbarch | |
928 | isn't initialized yet. At this point, we're quite sure there | |
929 | isn't another convenience variable of the same name. */ | |
22d2b532 | 930 | create_internalvar_type_lazy ("_tlb", &tlb_funcs, NULL); |
711e434b | 931 | } |