Stop the MIPS assembler from accepting ifunc symbols.
[deliverable/binutils-gdb.git] / gdb / windows-tdep.c
CommitLineData
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
8db52437
SM
41#define CYGWIN_DLL_NAME "cygwin1.dll"
42
559e7e50 43/* Windows signal numbers differ between MinGW flavors and between
0f2265e2
SM
44 those and Cygwin. The below enumerations were gleaned from the
45 respective headers. */
46
47/* Signal numbers for the various MinGW flavors. The ones marked with
48 MinGW-w64 are defined by MinGW-w64, not by mingw.org's MinGW. */
559e7e50
EZ
49
50enum
0f2265e2
SM
51{
52 WINDOWS_SIGHUP = 1, /* MinGW-w64 */
53 WINDOWS_SIGINT = 2,
54 WINDOWS_SIGQUIT = 3, /* MinGW-w64 */
55 WINDOWS_SIGILL = 4,
56 WINDOWS_SIGTRAP = 5, /* MinGW-w64 */
57 WINDOWS_SIGIOT = 6, /* MinGW-w64 */
58 WINDOWS_SIGEMT = 7, /* MinGW-w64 */
59 WINDOWS_SIGFPE = 8,
60 WINDOWS_SIGKILL = 9, /* MinGW-w64 */
61 WINDOWS_SIGBUS = 10, /* MinGW-w64 */
62 WINDOWS_SIGSEGV = 11,
63 WINDOWS_SIGSYS = 12, /* MinGW-w64 */
64 WINDOWS_SIGPIPE = 13, /* MinGW-w64 */
65 WINDOWS_SIGALRM = 14, /* MinGW-w64 */
66 WINDOWS_SIGTERM = 15,
67 WINDOWS_SIGBREAK = 21,
68 WINDOWS_SIGABRT = 22,
69};
70
71/* Signal numbers for Cygwin. */
72
73enum
74{
75 CYGWIN_SIGHUP = 1,
76 CYGWIN_SIGINT = 2,
77 CYGWIN_SIGQUIT = 3,
78 CYGWIN_SIGILL = 4,
79 CYGWIN_SIGTRAP = 5,
80 CYGWIN_SIGABRT = 6,
81 CYGWIN_SIGEMT = 7,
82 CYGWIN_SIGFPE = 8,
83 CYGWIN_SIGKILL = 9,
84 CYGWIN_SIGBUS = 10,
85 CYGWIN_SIGSEGV = 11,
86 CYGWIN_SIGSYS = 12,
87 CYGWIN_SIGPIPE = 13,
88 CYGWIN_SIGALRM = 14,
89 CYGWIN_SIGTERM = 15,
90 CYGWIN_SIGURG = 16,
91 CYGWIN_SIGSTOP = 17,
92 CYGWIN_SIGTSTP = 18,
93 CYGWIN_SIGCONT = 19,
94 CYGWIN_SIGCHLD = 20,
95 CYGWIN_SIGTTIN = 21,
96 CYGWIN_SIGTTOU = 22,
97 CYGWIN_SIGIO = 23,
98 CYGWIN_SIGXCPU = 24,
99 CYGWIN_SIGXFSZ = 25,
100 CYGWIN_SIGVTALRM = 26,
101 CYGWIN_SIGPROF = 27,
102 CYGWIN_SIGWINCH = 28,
103 CYGWIN_SIGLOST = 29,
104 CYGWIN_SIGUSR1 = 30,
105 CYGWIN_SIGUSR2 = 31,
106};
559e7e50 107
711e434b
PM
108struct cmd_list_element *info_w32_cmdlist;
109
110typedef struct thread_information_block_32
111 {
112 uint32_t current_seh; /* %fs:0x0000 */
113 uint32_t current_top_of_stack; /* %fs:0x0004 */
114 uint32_t current_bottom_of_stack; /* %fs:0x0008 */
115 uint32_t sub_system_tib; /* %fs:0x000c */
116 uint32_t fiber_data; /* %fs:0x0010 */
117 uint32_t arbitrary_data_slot; /* %fs:0x0014 */
118 uint32_t linear_address_tib; /* %fs:0x0018 */
119 uint32_t environment_pointer; /* %fs:0x001c */
120 uint32_t process_id; /* %fs:0x0020 */
121 uint32_t current_thread_id; /* %fs:0x0024 */
122 uint32_t active_rpc_handle; /* %fs:0x0028 */
123 uint32_t thread_local_storage; /* %fs:0x002c */
124 uint32_t process_environment_block; /* %fs:0x0030 */
125 uint32_t last_error_number; /* %fs:0x0034 */
126 }
127thread_information_32;
128
129typedef struct thread_information_block_64
130 {
131 uint64_t current_seh; /* %gs:0x0000 */
132 uint64_t current_top_of_stack; /* %gs:0x0008 */
133 uint64_t current_bottom_of_stack; /* %gs:0x0010 */
134 uint64_t sub_system_tib; /* %gs:0x0018 */
135 uint64_t fiber_data; /* %gs:0x0020 */
136 uint64_t arbitrary_data_slot; /* %gs:0x0028 */
137 uint64_t linear_address_tib; /* %gs:0x0030 */
138 uint64_t environment_pointer; /* %gs:0x0038 */
139 uint64_t process_id; /* %gs:0x0040 */
140 uint64_t current_thread_id; /* %gs:0x0048 */
141 uint64_t active_rpc_handle; /* %gs:0x0050 */
142 uint64_t thread_local_storage; /* %gs:0x0058 */
143 uint64_t process_environment_block; /* %gs:0x0060 */
144 uint64_t last_error_number; /* %gs:0x0068 */
145 }
146thread_information_64;
147
148
149static const char* TIB_NAME[] =
150 {
151 " current_seh ", /* %fs:0x0000 */
152 " current_top_of_stack ", /* %fs:0x0004 */
153 " current_bottom_of_stack ", /* %fs:0x0008 */
154 " sub_system_tib ", /* %fs:0x000c */
155 " fiber_data ", /* %fs:0x0010 */
156 " arbitrary_data_slot ", /* %fs:0x0014 */
157 " linear_address_tib ", /* %fs:0x0018 */
158 " environment_pointer ", /* %fs:0x001c */
159 " process_id ", /* %fs:0x0020 */
160 " current_thread_id ", /* %fs:0x0024 */
161 " active_rpc_handle ", /* %fs:0x0028 */
162 " thread_local_storage ", /* %fs:0x002c */
163 " process_environment_block ", /* %fs:0x0030 */
164 " last_error_number " /* %fs:0x0034 */
165 };
166
581e13c1
MS
167static const int MAX_TIB32 =
168 sizeof (thread_information_32) / sizeof (uint32_t);
169static const int MAX_TIB64 =
170 sizeof (thread_information_64) / sizeof (uint64_t);
711e434b
PM
171static const int FULL_TIB_SIZE = 0x1000;
172
491144b5 173static bool maint_display_all_tib = false;
711e434b 174
7928d571
HD
175static struct gdbarch_data *windows_gdbarch_data_handle;
176
177struct windows_gdbarch_data
178{
179 struct type *siginfo_type;
cd5900f3 180 struct type *tib_ptr_type; /* Type of thread information block */
7928d571
HD
181};
182
183/* Allocate windows_gdbarch_data for an arch. */
184
185static void *
186init_windows_gdbarch_data (struct gdbarch *gdbarch)
187{
188 return GDBARCH_OBSTACK_ZALLOC (gdbarch, struct windows_gdbarch_data);
189}
190
191/* Get windows_gdbarch_data of an arch. */
192
193static struct windows_gdbarch_data *
194get_windows_gdbarch_data (struct gdbarch *gdbarch)
195{
196 return ((struct windows_gdbarch_data *)
197 gdbarch_data (gdbarch, windows_gdbarch_data_handle));
198}
199
711e434b
PM
200/* Define Thread Local Base pointer type. */
201
202static struct type *
203windows_get_tlb_type (struct gdbarch *gdbarch)
204{
205 struct type *dword_ptr_type, *dword32_type, *void_ptr_type;
206 struct type *peb_ldr_type, *peb_ldr_ptr_type;
870f88f7 207 struct type *peb_type, *peb_ptr_type, *list_type;
711e434b
PM
208 struct type *module_list_ptr_type;
209 struct type *tib_type, *seh_type, *tib_ptr_type, *seh_ptr_type;
e0cdfe3c
HD
210 struct type *word_type, *wchar_type, *wchar_ptr_type;
211 struct type *uni_str_type, *rupp_type, *rupp_ptr_type;
711e434b 212
cd5900f3
HD
213 windows_gdbarch_data *windows_gdbarch_data
214 = get_windows_gdbarch_data (gdbarch);
215 if (windows_gdbarch_data->tib_ptr_type != nullptr)
216 return windows_gdbarch_data->tib_ptr_type;
217
711e434b
PM
218 dword_ptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
219 1, "DWORD_PTR");
220 dword32_type = arch_integer_type (gdbarch, 32,
221 1, "DWORD32");
e0cdfe3c
HD
222 word_type = arch_integer_type (gdbarch, 16,
223 1, "WORD");
224 wchar_type = arch_integer_type (gdbarch, 16,
225 1, "wchar_t");
711e434b 226 void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
e0cdfe3c
HD
227 wchar_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
228 NULL, wchar_type);
711e434b
PM
229
230 /* list entry */
231
232 list_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
233 TYPE_NAME (list_type) = xstrdup ("list");
234
711e434b
PM
235 module_list_ptr_type = void_ptr_type;
236
581e13c1
MS
237 append_composite_type_field (list_type, "forward_list",
238 module_list_ptr_type);
711e434b
PM
239 append_composite_type_field (list_type, "backward_list",
240 module_list_ptr_type);
241
242 /* Structured Exception Handler */
243
244 seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
245 TYPE_NAME (seh_type) = xstrdup ("seh");
246
247 seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
77b7c781
UW
248 TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
249 NULL);
711e434b
PM
250 TYPE_TARGET_TYPE (seh_ptr_type) = seh_type;
251
252 append_composite_type_field (seh_type, "next_seh", seh_ptr_type);
e8e6c82e
PM
253 append_composite_type_field (seh_type, "handler",
254 builtin_type (gdbarch)->builtin_func_ptr);
711e434b
PM
255
256 /* struct _PEB_LDR_DATA */
257 peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
258 TYPE_NAME (peb_ldr_type) = xstrdup ("peb_ldr_data");
259
260 append_composite_type_field (peb_ldr_type, "length", dword32_type);
261 append_composite_type_field (peb_ldr_type, "initialized", dword32_type);
262 append_composite_type_field (peb_ldr_type, "ss_handle", void_ptr_type);
263 append_composite_type_field (peb_ldr_type, "in_load_order", list_type);
264 append_composite_type_field (peb_ldr_type, "in_memory_order", list_type);
265 append_composite_type_field (peb_ldr_type, "in_init_order", list_type);
266 append_composite_type_field (peb_ldr_type, "entry_in_progress",
267 void_ptr_type);
268 peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
77b7c781
UW
269 TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
270 NULL);
711e434b
PM
271 TYPE_TARGET_TYPE (peb_ldr_ptr_type) = peb_ldr_type;
272
e0cdfe3c
HD
273 /* struct UNICODE_STRING */
274 uni_str_type = arch_composite_type (gdbarch, "unicode_string",
275 TYPE_CODE_STRUCT);
276
277 append_composite_type_field (uni_str_type, "length", word_type);
278 append_composite_type_field (uni_str_type, "maximum_length", word_type);
279 append_composite_type_field_aligned (uni_str_type, "buffer",
280 wchar_ptr_type,
281 TYPE_LENGTH (wchar_ptr_type));
282
283 /* struct _RTL_USER_PROCESS_PARAMETERS */
284 rupp_type = arch_composite_type (gdbarch, "rtl_user_process_parameters",
285 TYPE_CODE_STRUCT);
286
287 append_composite_type_field (rupp_type, "maximum_length", dword32_type);
288 append_composite_type_field (rupp_type, "length", dword32_type);
289 append_composite_type_field (rupp_type, "flags", dword32_type);
290 append_composite_type_field (rupp_type, "debug_flags", dword32_type);
291 append_composite_type_field (rupp_type, "console_handle", void_ptr_type);
292 append_composite_type_field (rupp_type, "console_flags", dword32_type);
293 append_composite_type_field_aligned (rupp_type, "standard_input",
294 void_ptr_type,
295 TYPE_LENGTH (void_ptr_type));
296 append_composite_type_field (rupp_type, "standard_output", void_ptr_type);
297 append_composite_type_field (rupp_type, "standard_error", void_ptr_type);
298 append_composite_type_field (rupp_type, "current_directory", uni_str_type);
299 append_composite_type_field (rupp_type, "current_directory_handle",
300 void_ptr_type);
301 append_composite_type_field (rupp_type, "dll_path", uni_str_type);
302 append_composite_type_field (rupp_type, "image_path_name", uni_str_type);
303 append_composite_type_field (rupp_type, "command_line", uni_str_type);
304 append_composite_type_field (rupp_type, "environment", void_ptr_type);
305 append_composite_type_field (rupp_type, "starting_x", dword32_type);
306 append_composite_type_field (rupp_type, "starting_y", dword32_type);
307 append_composite_type_field (rupp_type, "count_x", dword32_type);
308 append_composite_type_field (rupp_type, "count_y", dword32_type);
309 append_composite_type_field (rupp_type, "count_chars_x", dword32_type);
310 append_composite_type_field (rupp_type, "count_chars_y", dword32_type);
311 append_composite_type_field (rupp_type, "fill_attribute", dword32_type);
312 append_composite_type_field (rupp_type, "window_flags", dword32_type);
313 append_composite_type_field (rupp_type, "show_window_flags", dword32_type);
314 append_composite_type_field_aligned (rupp_type, "window_title",
315 uni_str_type,
316 TYPE_LENGTH (void_ptr_type));
317 append_composite_type_field (rupp_type, "desktop_info", uni_str_type);
318 append_composite_type_field (rupp_type, "shell_info", uni_str_type);
319 append_composite_type_field (rupp_type, "runtime_data", uni_str_type);
320
321 rupp_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
322 NULL, rupp_type);
323
711e434b
PM
324
325 /* struct process environment block */
326 peb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
327 TYPE_NAME (peb_type) = xstrdup ("peb");
328
329 /* First bytes contain several flags. */
330 append_composite_type_field (peb_type, "flags", dword_ptr_type);
331 append_composite_type_field (peb_type, "mutant", void_ptr_type);
332 append_composite_type_field (peb_type, "image_base_address", void_ptr_type);
333 append_composite_type_field (peb_type, "ldr", peb_ldr_ptr_type);
e0cdfe3c 334 append_composite_type_field (peb_type, "process_parameters", rupp_ptr_type);
711e434b
PM
335 append_composite_type_field (peb_type, "sub_system_data", void_ptr_type);
336 append_composite_type_field (peb_type, "process_heap", void_ptr_type);
337 append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type);
338 peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
77b7c781
UW
339 TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
340 NULL);
711e434b
PM
341 TYPE_TARGET_TYPE (peb_ptr_type) = peb_type;
342
343
344 /* struct thread information block */
345 tib_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
346 TYPE_NAME (tib_type) = xstrdup ("tib");
347
348 /* uint32_t current_seh; %fs:0x0000 */
349 append_composite_type_field (tib_type, "current_seh", seh_ptr_type);
350 /* uint32_t current_top_of_stack; %fs:0x0004 */
581e13c1
MS
351 append_composite_type_field (tib_type, "current_top_of_stack",
352 void_ptr_type);
711e434b
PM
353 /* uint32_t current_bottom_of_stack; %fs:0x0008 */
354 append_composite_type_field (tib_type, "current_bottom_of_stack",
355 void_ptr_type);
356 /* uint32_t sub_system_tib; %fs:0x000c */
357 append_composite_type_field (tib_type, "sub_system_tib", void_ptr_type);
358
359 /* uint32_t fiber_data; %fs:0x0010 */
360 append_composite_type_field (tib_type, "fiber_data", void_ptr_type);
361 /* uint32_t arbitrary_data_slot; %fs:0x0014 */
362 append_composite_type_field (tib_type, "arbitrary_data_slot", void_ptr_type);
363 /* uint32_t linear_address_tib; %fs:0x0018 */
364 append_composite_type_field (tib_type, "linear_address_tib", void_ptr_type);
365 /* uint32_t environment_pointer; %fs:0x001c */
366 append_composite_type_field (tib_type, "environment_pointer", void_ptr_type);
367 /* uint32_t process_id; %fs:0x0020 */
368 append_composite_type_field (tib_type, "process_id", dword_ptr_type);
369 /* uint32_t current_thread_id; %fs:0x0024 */
370 append_composite_type_field (tib_type, "thread_id", dword_ptr_type);
371 /* uint32_t active_rpc_handle; %fs:0x0028 */
372 append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type);
373 /* uint32_t thread_local_storage; %fs:0x002c */
581e13c1
MS
374 append_composite_type_field (tib_type, "thread_local_storage",
375 void_ptr_type);
711e434b
PM
376 /* uint32_t process_environment_block; %fs:0x0030 */
377 append_composite_type_field (tib_type, "process_environment_block",
378 peb_ptr_type);
379 /* uint32_t last_error_number; %fs:0x0034 */
380 append_composite_type_field (tib_type, "last_error_number", dword_ptr_type);
381
382 tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
77b7c781
UW
383 TYPE_LENGTH (void_ptr_type) * TARGET_CHAR_BIT,
384 NULL);
711e434b
PM
385 TYPE_TARGET_TYPE (tib_ptr_type) = tib_type;
386
cd5900f3 387 windows_gdbarch_data->tib_ptr_type = tib_ptr_type;
ea1fae46 388
711e434b
PM
389 return tib_ptr_type;
390}
391
392/* The $_tlb convenience variable is a bit special. We don't know
393 for sure the type of the value until we actually have a chance to
394 fetch the data. The type can change depending on gdbarch, so it is
395 also dependent on which thread you have selected. */
396
397/* This function implements the lval_computed support for reading a
398 $_tlb value. */
399
400static void
401tlb_value_read (struct value *val)
402{
403 CORE_ADDR tlb;
404 struct type *type = check_typedef (value_type (val));
405
406 if (!target_get_tib_address (inferior_ptid, &tlb))
407 error (_("Unable to read tlb"));
408 store_typed_address (value_contents_raw (val), type, tlb);
409}
410
411/* This function implements the lval_computed support for writing a
412 $_tlb value. */
413
414static void
415tlb_value_write (struct value *v, struct value *fromval)
416{
417 error (_("Impossible to change the Thread Local Base"));
418}
419
c8f2448a 420static const struct lval_funcs tlb_value_funcs =
711e434b
PM
421 {
422 tlb_value_read,
423 tlb_value_write
424 };
425
426
427/* Return a new value with the correct type for the tlb object of
428 the current thread using architecture GDBARCH. Return a void value
429 if there's no object available. */
430
431static struct value *
22d2b532 432tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
711e434b 433{
d7e15655 434 if (target_has_stack && inferior_ptid != null_ptid)
711e434b
PM
435 {
436 struct type *type = windows_get_tlb_type (gdbarch);
437 return allocate_computed_value (type, &tlb_value_funcs, NULL);
438 }
439
440 return allocate_value (builtin_type (gdbarch)->builtin_void);
441}
442
443
444/* Display thread information block of a given thread. */
445
446static int
447display_one_tib (ptid_t ptid)
448{
449 gdb_byte *tib = NULL;
450 gdb_byte *index;
451 CORE_ADDR thread_local_base;
452 ULONGEST i, val, max, max_name, size, tib_size;
f5656ead
TT
453 ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch ());
454 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
711e434b
PM
455
456 if (sizeof_ptr == 64)
457 {
458 size = sizeof (uint64_t);
459 tib_size = sizeof (thread_information_64);
460 max = MAX_TIB64;
461 }
462 else
463 {
464 size = sizeof (uint32_t);
465 tib_size = sizeof (thread_information_32);
466 max = MAX_TIB32;
467 }
468
469 max_name = max;
470
471 if (maint_display_all_tib)
472 {
473 tib_size = FULL_TIB_SIZE;
474 max = tib_size / size;
475 }
476
224c3ddb 477 tib = (gdb_byte *) alloca (tib_size);
711e434b
PM
478
479 if (target_get_tib_address (ptid, &thread_local_base) == 0)
480 {
481 printf_filtered (_("Unable to get thread local base for %s\n"),
a068643d 482 target_pid_to_str (ptid).c_str ());
711e434b
PM
483 return -1;
484 }
485
8b88a78e 486 if (target_read (current_top_target (), TARGET_OBJECT_MEMORY,
711e434b
PM
487 NULL, tib, thread_local_base, tib_size) != tib_size)
488 {
581e13c1
MS
489 printf_filtered (_("Unable to read thread information "
490 "block for %s at address %s\n"),
a068643d
TT
491 target_pid_to_str (ptid).c_str (),
492 paddress (target_gdbarch (), thread_local_base));
711e434b
PM
493 return -1;
494 }
495
496 printf_filtered (_("Thread Information Block %s at %s\n"),
a068643d 497 target_pid_to_str (ptid).c_str (),
f5656ead 498 paddress (target_gdbarch (), thread_local_base));
711e434b
PM
499
500 index = (gdb_byte *) tib;
501
502 /* All fields have the size of a pointer, this allows to iterate
503 using the same for loop for both layouts. */
504 for (i = 0; i < max; i++)
505 {
506 val = extract_unsigned_integer (index, size, byte_order);
507 if (i < max_name)
508 printf_filtered (_("%s is 0x%s\n"), TIB_NAME[i], phex (val, size));
509 else if (val != 0)
510 printf_filtered (_("TIB[0x%s] is 0x%s\n"), phex (i * size, 2),
511 phex (val, size));
512 index += size;
513 }
514 return 1;
515}
516
5d5658a1 517/* Display thread information block of the current thread. */
711e434b
PM
518
519static void
c281872e 520display_tib (const char * args, int from_tty)
711e434b 521{
d7e15655 522 if (inferior_ptid != null_ptid)
711e434b
PM
523 display_one_tib (inferior_ptid);
524}
bfb87e33
JB
525
526void
dc05df57 527windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
c162ed3e 528 CORE_ADDR *text_offset_cached,
5af949e3 529 struct gdbarch *gdbarch, struct obstack *obstack)
bfb87e33 530{
c162ed3e 531 CORE_ADDR text_offset = text_offset_cached ? *text_offset_cached : 0;
3999122f 532
bfb87e33 533 obstack_grow_str (obstack, "<library name=\"");
5e187554
SM
534 std::string p = xml_escape_text (so_name);
535 obstack_grow_str (obstack, p.c_str ());
5af949e3 536 obstack_grow_str (obstack, "\"><segment address=\"");
c162ed3e
HD
537
538 if (!text_offset)
539 {
540 gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget, -1));
541 /* The following calls are OK even if dll is NULL.
542 The default value 0x1000 is returned by pe_text_section_offset
543 in that case. */
544 text_offset = pe_text_section_offset (dll.get ());
545 if (text_offset_cached)
546 *text_offset_cached = text_offset;
547 }
548
3999122f 549 obstack_grow_str (obstack, paddress (gdbarch, load_addr + text_offset));
bfb87e33
JB
550 obstack_grow_str (obstack, "\"/></library>");
551}
711e434b 552
a8e1bb34
JB
553/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
554 method. It searches all objfiles, starting with CURRENT_OBJFILE
555 first (if not NULL).
556
557 On Windows, the system behaves a little differently when two
558 objfiles each define a global symbol using the same name, compared
559 to other platforms such as GNU/Linux for instance. On GNU/Linux,
560 all instances of the symbol effectively get merged into a single
561 one, but on Windows, they remain distinct.
562
563 As a result, it usually makes sense to start global symbol searches
564 with the current objfile before expanding it to all other objfiles.
565 This helps for instance when a user debugs some code in a DLL that
566 refers to a global variable defined inside that DLL. When trying
567 to print the value of that global variable, it would be unhelpful
568 to print the value of another global variable defined with the same
569 name, but in a different DLL. */
570
64870a42 571static void
a8e1bb34
JB
572windows_iterate_over_objfiles_in_search_order
573 (struct gdbarch *gdbarch,
574 iterate_over_objfiles_in_search_order_cb_ftype *cb,
575 void *cb_data, struct objfile *current_objfile)
576{
577 int stop;
a8e1bb34
JB
578
579 if (current_objfile)
580 {
581 stop = cb (current_objfile, cb_data);
582 if (stop)
583 return;
584 }
585
2030c079 586 for (objfile *objfile : current_program_space->objfiles ())
a8e1bb34
JB
587 {
588 if (objfile != current_objfile)
589 {
590 stop = cb (objfile, cb_data);
591 if (stop)
592 return;
593 }
594 }
595}
596
711e434b
PM
597static void
598show_maint_show_all_tib (struct ui_file *file, int from_tty,
599 struct cmd_list_element *c, const char *value)
600{
581e13c1
MS
601 fprintf_filtered (file, _("Show all non-zero elements of "
602 "Thread Information Block is %s.\n"), value);
711e434b
PM
603}
604
605static void
981a3fb3 606info_w32_command (const char *args, int from_tty)
711e434b
PM
607{
608 help_list (info_w32_cmdlist, "info w32 ", class_info, gdb_stdout);
609}
610
611static int w32_prefix_command_valid = 0;
612void
613init_w32_command_list (void)
614{
615 if (!w32_prefix_command_valid)
616 {
617 add_prefix_cmd ("w32", class_info, info_w32_command,
618 _("Print information specific to Win32 debugging."),
619 &info_w32_cmdlist, "info w32 ", 0, &infolist);
620 w32_prefix_command_valid = 1;
621 }
622}
623
0f2265e2 624/* Implementation of `gdbarch_gdb_signal_to_target' for Windows. */
559e7e50
EZ
625
626static int
627windows_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
628{
629 switch (signal)
630 {
631 case GDB_SIGNAL_0:
632 return 0;
633 case GDB_SIGNAL_HUP:
634 return WINDOWS_SIGHUP;
635 case GDB_SIGNAL_INT:
636 return WINDOWS_SIGINT;
637 case GDB_SIGNAL_QUIT:
638 return WINDOWS_SIGQUIT;
639 case GDB_SIGNAL_ILL:
640 return WINDOWS_SIGILL;
641 case GDB_SIGNAL_TRAP:
642 return WINDOWS_SIGTRAP;
643 case GDB_SIGNAL_ABRT:
644 return WINDOWS_SIGABRT;
645 case GDB_SIGNAL_EMT:
646 return WINDOWS_SIGEMT;
647 case GDB_SIGNAL_FPE:
648 return WINDOWS_SIGFPE;
649 case GDB_SIGNAL_KILL:
650 return WINDOWS_SIGKILL;
651 case GDB_SIGNAL_BUS:
652 return WINDOWS_SIGBUS;
653 case GDB_SIGNAL_SEGV:
654 return WINDOWS_SIGSEGV;
655 case GDB_SIGNAL_SYS:
656 return WINDOWS_SIGSYS;
657 case GDB_SIGNAL_PIPE:
658 return WINDOWS_SIGPIPE;
659 case GDB_SIGNAL_ALRM:
660 return WINDOWS_SIGALRM;
661 case GDB_SIGNAL_TERM:
662 return WINDOWS_SIGTERM;
0f2265e2
SM
663 }
664 return -1;
665}
666
667/* Implementation of `gdbarch_gdb_signal_to_target' for Cygwin. */
668
669static int
670cygwin_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
671{
672 switch (signal)
673 {
674 case GDB_SIGNAL_0:
675 return 0;
676 case GDB_SIGNAL_HUP:
677 return CYGWIN_SIGHUP;
678 case GDB_SIGNAL_INT:
679 return CYGWIN_SIGINT;
680 case GDB_SIGNAL_QUIT:
681 return CYGWIN_SIGQUIT;
682 case GDB_SIGNAL_ILL:
683 return CYGWIN_SIGILL;
684 case GDB_SIGNAL_TRAP:
685 return CYGWIN_SIGTRAP;
686 case GDB_SIGNAL_ABRT:
687 return CYGWIN_SIGABRT;
688 case GDB_SIGNAL_EMT:
689 return CYGWIN_SIGEMT;
690 case GDB_SIGNAL_FPE:
691 return CYGWIN_SIGFPE;
692 case GDB_SIGNAL_KILL:
693 return CYGWIN_SIGKILL;
694 case GDB_SIGNAL_BUS:
695 return CYGWIN_SIGBUS;
696 case GDB_SIGNAL_SEGV:
697 return CYGWIN_SIGSEGV;
698 case GDB_SIGNAL_SYS:
699 return CYGWIN_SIGSYS;
700 case GDB_SIGNAL_PIPE:
701 return CYGWIN_SIGPIPE;
702 case GDB_SIGNAL_ALRM:
703 return CYGWIN_SIGALRM;
704 case GDB_SIGNAL_TERM:
705 return CYGWIN_SIGTERM;
559e7e50 706 case GDB_SIGNAL_URG:
0f2265e2 707 return CYGWIN_SIGURG;
559e7e50 708 case GDB_SIGNAL_STOP:
0f2265e2 709 return CYGWIN_SIGSTOP;
559e7e50 710 case GDB_SIGNAL_TSTP:
0f2265e2 711 return CYGWIN_SIGTSTP;
559e7e50 712 case GDB_SIGNAL_CONT:
0f2265e2 713 return CYGWIN_SIGCONT;
559e7e50 714 case GDB_SIGNAL_CHLD:
0f2265e2 715 return CYGWIN_SIGCHLD;
559e7e50 716 case GDB_SIGNAL_TTIN:
0f2265e2 717 return CYGWIN_SIGTTIN;
559e7e50 718 case GDB_SIGNAL_TTOU:
0f2265e2 719 return CYGWIN_SIGTTOU;
559e7e50 720 case GDB_SIGNAL_IO:
0f2265e2 721 return CYGWIN_SIGIO;
559e7e50 722 case GDB_SIGNAL_XCPU:
0f2265e2 723 return CYGWIN_SIGXCPU;
559e7e50 724 case GDB_SIGNAL_XFSZ:
0f2265e2 725 return CYGWIN_SIGXFSZ;
559e7e50 726 case GDB_SIGNAL_VTALRM:
0f2265e2 727 return CYGWIN_SIGVTALRM;
559e7e50 728 case GDB_SIGNAL_PROF:
0f2265e2 729 return CYGWIN_SIGPROF;
559e7e50 730 case GDB_SIGNAL_WINCH:
0f2265e2 731 return CYGWIN_SIGWINCH;
559e7e50 732 case GDB_SIGNAL_PWR:
0f2265e2 733 return CYGWIN_SIGLOST;
559e7e50 734 case GDB_SIGNAL_USR1:
0f2265e2 735 return CYGWIN_SIGUSR1;
559e7e50 736 case GDB_SIGNAL_USR2:
0f2265e2 737 return CYGWIN_SIGUSR2;
559e7e50
EZ
738 }
739 return -1;
740}
741
6bafc845
HD
742struct enum_value_name
743{
744 uint32_t value;
745 const char *name;
746};
747
748/* Allocate a TYPE_CODE_ENUM type structure with its named values. */
749
750static struct type *
751create_enum (struct gdbarch *gdbarch, int bit, const char *name,
752 const struct enum_value_name *values, int count)
753{
754 struct type *type;
755 int i;
756
757 type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name);
758 TYPE_NFIELDS (type) = count;
759 TYPE_FIELDS (type) = (struct field *)
760 TYPE_ZALLOC (type, sizeof (struct field) * count);
761 TYPE_UNSIGNED (type) = 1;
762
763 for (i = 0; i < count; i++)
764 {
765 TYPE_FIELD_NAME (type, i) = values[i].name;
766 SET_FIELD_ENUMVAL (TYPE_FIELD (type, i), values[i].value);
767 }
768
769 return type;
770}
771
772static const struct enum_value_name exception_values[] =
773{
774 { 0x40000015, "FATAL_APP_EXIT" },
775 { 0x40010005, "DBG_CONTROL_C" },
776 { 0x40010008, "DBG_CONTROL_BREAK" },
777 { 0x80000002, "DATATYPE_MISALIGNMENT" },
778 { 0x80000003, "BREAKPOINT" },
779 { 0x80000004, "SINGLE_STEP" },
780 { 0xC0000005, "ACCESS_VIOLATION" },
781 { 0xC0000006, "IN_PAGE_ERROR" },
782 { 0xC000001D, "ILLEGAL_INSTRUCTION" },
783 { 0xC0000025, "NONCONTINUABLE_EXCEPTION" },
784 { 0xC0000026, "INVALID_DISPOSITION" },
785 { 0xC000008C, "ARRAY_BOUNDS_EXCEEDED" },
786 { 0xC000008D, "FLOAT_DENORMAL_OPERAND" },
787 { 0xC000008E, "FLOAT_DIVIDE_BY_ZERO" },
788 { 0xC000008F, "FLOAT_INEXACT_RESULT" },
789 { 0xC0000090, "FLOAT_INVALID_OPERATION" },
790 { 0xC0000091, "FLOAT_OVERFLOW" },
791 { 0xC0000092, "FLOAT_STACK_CHECK" },
792 { 0xC0000093, "FLOAT_UNDERFLOW" },
793 { 0xC0000094, "INTEGER_DIVIDE_BY_ZERO" },
794 { 0xC0000095, "INTEGER_OVERFLOW" },
795 { 0xC0000096, "PRIV_INSTRUCTION" },
796 { 0xC00000FD, "STACK_OVERFLOW" },
797 { 0xC0000409, "FAST_FAIL" },
798};
799
800static const struct enum_value_name violation_values[] =
801{
802 { 0, "READ_ACCESS_VIOLATION" },
803 { 1, "WRITE_ACCESS_VIOLATION" },
804 { 8, "DATA_EXECUTION_PREVENTION_VIOLATION" },
805};
806
7928d571
HD
807/* Implement the "get_siginfo_type" gdbarch method. */
808
809static struct type *
810windows_get_siginfo_type (struct gdbarch *gdbarch)
811{
812 struct windows_gdbarch_data *windows_gdbarch_data;
813 struct type *dword_type, *pvoid_type, *ulongptr_type;
6bafc845
HD
814 struct type *code_enum, *violation_enum;
815 struct type *violation_type, *para_type, *siginfo_ptr_type, *siginfo_type;
7928d571
HD
816
817 windows_gdbarch_data = get_windows_gdbarch_data (gdbarch);
818 if (windows_gdbarch_data->siginfo_type != NULL)
819 return windows_gdbarch_data->siginfo_type;
820
821 dword_type = arch_integer_type (gdbarch, gdbarch_int_bit (gdbarch),
822 1, "DWORD");
823 pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID",
824 builtin_type (gdbarch)->builtin_void);
825 ulongptr_type = arch_integer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
826 1, "ULONG_PTR");
827
6bafc845
HD
828 /* ExceptionCode value names */
829 code_enum = create_enum (gdbarch, gdbarch_int_bit (gdbarch),
830 "ExceptionCode", exception_values,
831 ARRAY_SIZE (exception_values));
832
833 /* ACCESS_VIOLATION type names */
834 violation_enum = create_enum (gdbarch, gdbarch_ptr_bit (gdbarch),
835 "ViolationType", violation_values,
836 ARRAY_SIZE (violation_values));
837
838 /* ACCESS_VIOLATION information */
839 violation_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
840 append_composite_type_field (violation_type, "Type", violation_enum);
841 append_composite_type_field (violation_type, "Address", pvoid_type);
842
843 /* Unnamed union of the documented field ExceptionInformation,
844 and the alternative AccessViolationInformation (which displays
845 human-readable values for ExceptionCode ACCESS_VIOLATION). */
846 para_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
847 append_composite_type_field (para_type, "ExceptionInformation",
848 lookup_array_range_type (ulongptr_type, 0, 14));
849 append_composite_type_field (para_type, "AccessViolationInformation",
850 violation_type);
851
7928d571
HD
852 siginfo_type = arch_composite_type (gdbarch, "EXCEPTION_RECORD",
853 TYPE_CODE_STRUCT);
854 siginfo_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
855 NULL, siginfo_type);
856
6bafc845
HD
857 /* ExceptionCode is documented as type DWORD, but here a helper
858 enum type is used instead to display a human-readable value. */
859 append_composite_type_field (siginfo_type, "ExceptionCode", code_enum);
7928d571
HD
860 append_composite_type_field (siginfo_type, "ExceptionFlags", dword_type);
861 append_composite_type_field (siginfo_type, "ExceptionRecord",
862 siginfo_ptr_type);
863 append_composite_type_field (siginfo_type, "ExceptionAddress",
864 pvoid_type);
865 append_composite_type_field (siginfo_type, "NumberParameters", dword_type);
866 /* The 64-bit variant needs some padding. */
6bafc845
HD
867 append_composite_type_field_aligned (siginfo_type, "",
868 para_type, TYPE_LENGTH (ulongptr_type));
7928d571
HD
869
870 windows_gdbarch_data->siginfo_type = siginfo_type;
871
872 return siginfo_type;
873}
874
584cf46d
HD
875/* Implement the "solib_create_inferior_hook" target_so_ops method. */
876
877static void
878windows_solib_create_inferior_hook (int from_tty)
879{
880 CORE_ADDR exec_base = 0;
881
882 /* Find base address of main executable in
883 TIB->process_environment_block->image_base_address. */
884 struct gdbarch *gdbarch = target_gdbarch ();
885 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
886 int ptr_bytes;
887 int peb_offset; /* Offset of process_environment_block in TIB. */
888 int base_offset; /* Offset of image_base_address in PEB. */
889 if (gdbarch_ptr_bit (gdbarch) == 32)
890 {
891 ptr_bytes = 4;
892 peb_offset = 48;
893 base_offset = 8;
894 }
895 else
896 {
897 ptr_bytes = 8;
898 peb_offset = 96;
899 base_offset = 16;
900 }
901 CORE_ADDR tlb;
902 gdb_byte buf[8];
b7d64b29
HD
903 if (target_has_execution
904 && target_get_tib_address (inferior_ptid, &tlb)
584cf46d
HD
905 && !target_read_memory (tlb + peb_offset, buf, ptr_bytes))
906 {
907 CORE_ADDR peb = extract_unsigned_integer (buf, ptr_bytes, byte_order);
908 if (!target_read_memory (peb + base_offset, buf, ptr_bytes))
909 exec_base = extract_unsigned_integer (buf, ptr_bytes, byte_order);
910 }
911
912 /* Rebase executable if the base address changed because of ASLR. */
913 if (symfile_objfile != nullptr && exec_base != 0)
914 {
915 CORE_ADDR vmaddr = pe_data (exec_bfd)->pe_opthdr.ImageBase;
916 if (vmaddr != exec_base)
917 objfile_rebase (symfile_objfile, exec_base - vmaddr);
918 }
919}
920
921static struct target_so_ops windows_so_ops;
922
0f2265e2
SM
923/* Common parts for gdbarch initialization for the Windows and Cygwin OS
924 ABIs. */
64870a42 925
0f2265e2
SM
926static void
927windows_init_abi_common (struct gdbarch_info info, struct gdbarch *gdbarch)
64870a42 928{
53375380
PA
929 set_gdbarch_wchar_bit (gdbarch, 16);
930 set_gdbarch_wchar_signed (gdbarch, 0);
931
64870a42
YQ
932 /* Canonical paths on this target look like
933 `c:\Program Files\Foo App\mydll.dll', for example. */
934 set_gdbarch_has_dos_based_file_system (gdbarch, 1);
935
936 set_gdbarch_iterate_over_objfiles_in_search_order
937 (gdbarch, windows_iterate_over_objfiles_in_search_order);
938
584cf46d
HD
939 windows_so_ops = solib_target_so_ops;
940 windows_so_ops.solib_create_inferior_hook
941 = windows_solib_create_inferior_hook;
942 set_solib_ops (gdbarch, &windows_so_ops);
7928d571
HD
943
944 set_gdbarch_get_siginfo_type (gdbarch, windows_get_siginfo_type);
64870a42
YQ
945}
946
0f2265e2
SM
947/* See windows-tdep.h. */
948void
949windows_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
950{
951 windows_init_abi_common (info, gdbarch);
952 set_gdbarch_gdb_signal_to_target (gdbarch, windows_gdb_signal_to_target);
953}
954
955/* See windows-tdep.h. */
956
957void
958cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
959{
960 windows_init_abi_common (info, gdbarch);
961 set_gdbarch_gdb_signal_to_target (gdbarch, cygwin_gdb_signal_to_target);
962}
963
22d2b532
SDJ
964/* Implementation of `tlb' variable. */
965
966static const struct internalvar_funcs tlb_funcs =
967{
968 tlb_make_value,
969 NULL,
970 NULL
971};
972
8db52437
SM
973/* Layout of an element of a PE's Import Directory Table. Based on:
974
975 https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-directory-table
976 */
977
978struct pe_import_directory_entry
979{
980 uint32_t import_lookup_table_rva;
981 uint32_t timestamp;
982 uint32_t forwarder_chain;
983 uint32_t name_rva;
984 uint32_t import_address_table_rva;
985};
986
987gdb_static_assert (sizeof (pe_import_directory_entry) == 20);
988
989/* See windows-tdep.h. */
990
991bool
992is_linked_with_cygwin_dll (bfd *abfd)
993{
994 /* The list of DLLs a PE is linked to is in the .idata section. See:
995
996 https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section
997 */
998 asection *idata_section = bfd_get_section_by_name (abfd, ".idata");
999 if (idata_section == nullptr)
1000 return false;
1001
1002 /* Find the virtual address of the .idata section. We must subtract this
1003 from the RVAs (relative virtual addresses) to obtain an offset in the
1004 section. */
2836752f
SM
1005 bfd_vma idata_addr
1006 = pe_data (abfd)->pe_opthdr.DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
8db52437 1007
e0fc5c3f
SM
1008 /* Get the section's data. */
1009 gdb::byte_vector idata_contents;
1010 if (!gdb_bfd_get_full_section_contents (abfd, idata_section, &idata_contents))
8db52437
SM
1011 {
1012 warning (_("Failed to get content of .idata section."));
1013 return false;
1014 }
1015
e0fc5c3f
SM
1016 size_t idata_size = idata_contents.size ();
1017 const gdb_byte *iter = idata_contents.data ();
1018 const gdb_byte *end = idata_contents.data () + idata_size;
8db52437
SM
1019 const pe_import_directory_entry null_dir_entry = { 0 };
1020
1021 /* Iterate through all directory entries. */
1022 while (true)
1023 {
1024 /* Is there enough space left in the section for another entry? */
1025 if (iter + sizeof (pe_import_directory_entry) > end)
1026 {
1027 warning (_("Failed to parse .idata section: unexpected end of "
1028 ".idata section."));
1029 break;
1030 }
1031
1032 pe_import_directory_entry *dir_entry = (pe_import_directory_entry *) iter;
1033
1034 /* Is it the end of list marker? */
1035 if (memcmp (dir_entry, &null_dir_entry,
1036 sizeof (pe_import_directory_entry)) == 0)
1037 break;
1038
1039 bfd_vma name_addr = dir_entry->name_rva;
1040
1041 /* If the name's virtual address is smaller than the section's virtual
1042 address, there's a problem. */
1043 if (name_addr < idata_addr
1044 || name_addr >= (idata_addr + idata_size))
1045 {
1046 warning (_("\
1047Failed to parse .idata section: name's virtual address (0x%" BFD_VMA_FMT "x) \
1048is outside .idata section's range [0x%" BFD_VMA_FMT "x, 0x%" BFD_VMA_FMT "x[."),
1049 name_addr, idata_addr, idata_addr + idata_size);
1050 break;
1051 }
1052
1053 const gdb_byte *name = &idata_contents[name_addr - idata_addr];
1054
1055 /* Make sure we don't overshoot the end of the section with the streq. */
2836752f 1056 if (name + sizeof (CYGWIN_DLL_NAME) > end)
8db52437
SM
1057 continue;
1058
1059 /* Finally, check if this is the dll name we are looking for. */
1060 if (streq ((const char *) name, CYGWIN_DLL_NAME))
1061 return true;
1062
2836752f 1063 iter += sizeof (pe_import_directory_entry);
8db52437
SM
1064 }
1065
1066 return false;
1067}
1068
6c265988 1069void _initialize_windows_tdep ();
711e434b 1070void
6c265988 1071_initialize_windows_tdep ()
711e434b 1072{
7928d571
HD
1073 windows_gdbarch_data_handle
1074 = gdbarch_data_register_post_init (init_windows_gdbarch_data);
1075
711e434b
PM
1076 init_w32_command_list ();
1077 add_cmd ("thread-information-block", class_info, display_tib,
1078 _("Display thread information block."),
1079 &info_w32_cmdlist);
1080 add_alias_cmd ("tib", "thread-information-block", class_info, 1,
1081 &info_w32_cmdlist);
1082
1083 add_setshow_boolean_cmd ("show-all-tib", class_maintenance,
1084 &maint_display_all_tib, _("\
1085Set whether to display all non-zero fields of thread information block."), _("\
1086Show whether to display all non-zero fields of thread information block."), _("\
1087Use \"on\" to enable, \"off\" to disable.\n\
1088If enabled, all non-zero fields of thread information block are displayed,\n\
1089even if their meaning is unknown."),
1090 NULL,
1091 show_maint_show_all_tib,
1092 &maintenance_set_cmdlist,
1093 &maintenance_show_cmdlist);
1094
1095 /* Explicitly create without lookup, since that tries to create a
1096 value with a void typed value, and when we get here, gdbarch
1097 isn't initialized yet. At this point, we're quite sure there
1098 isn't another convenience variable of the same name. */
22d2b532 1099 create_internalvar_type_lazy ("_tlb", &tlb_funcs, NULL);
711e434b 1100}
This page took 2.244774 seconds and 4 git commands to generate.