GDB (xrefs)
Loading...
Searching...
No Matches
/tmp/gdb-13.1/gdb/windows-tdep.c
Go to the documentation of this file.
1/* Copyright (C) 2008-2023 Free Software Foundation, Inc.
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"
19#include "windows-tdep.h"
20#include "gdbsupport/gdb_obstack.h"
21#include "xml-support.h"
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"
29#include "objfiles.h"
30#include "symfile.h"
31#include "coff-pe-read.h"
32#include "gdb_bfd.h"
33#include "solib.h"
34#include "solib-target.h"
35#include "gdbcore.h"
36#include "coff/internal.h"
37#include "libcoff.h"
38#include "solist.h"
39
40#define CYGWIN_DLL_NAME "cygwin1.dll"
41
42/* Windows signal numbers differ between MinGW flavors and between
43 those and Cygwin. The below enumerations were gleaned from the
44 respective headers. */
45
46/* Signal numbers for the various MinGW flavors. The ones marked with
47 MinGW-w64 are defined by MinGW-w64, not by mingw.org's MinGW. */
48
49enum
50{
51 WINDOWS_SIGHUP = 1, /* MinGW-w64 */
53 WINDOWS_SIGQUIT = 3, /* MinGW-w64 */
55 WINDOWS_SIGTRAP = 5, /* MinGW-w64 */
56 WINDOWS_SIGIOT = 6, /* MinGW-w64 */
57 WINDOWS_SIGEMT = 7, /* MinGW-w64 */
59 WINDOWS_SIGKILL = 9, /* MinGW-w64 */
60 WINDOWS_SIGBUS = 10, /* MinGW-w64 */
62 WINDOWS_SIGSYS = 12, /* MinGW-w64 */
63 WINDOWS_SIGPIPE = 13, /* MinGW-w64 */
64 WINDOWS_SIGALRM = 14, /* MinGW-w64 */
68};
69
70/* Signal numbers for Cygwin. */
71
72enum
73{
105};
106
107/* These constants are defined by Cygwin's core_dump.h */
108static constexpr unsigned int NOTE_INFO_MODULE = 3;
109static constexpr unsigned int NOTE_INFO_MODULE64 = 4;
110
112
114 {
115 uint32_t current_seh; /* %fs:0x0000 */
116 uint32_t current_top_of_stack; /* %fs:0x0004 */
117 uint32_t current_bottom_of_stack; /* %fs:0x0008 */
118 uint32_t sub_system_tib; /* %fs:0x000c */
119 uint32_t fiber_data; /* %fs:0x0010 */
120 uint32_t arbitrary_data_slot; /* %fs:0x0014 */
121 uint32_t linear_address_tib; /* %fs:0x0018 */
122 uint32_t environment_pointer; /* %fs:0x001c */
123 uint32_t process_id; /* %fs:0x0020 */
124 uint32_t current_thread_id; /* %fs:0x0024 */
125 uint32_t active_rpc_handle; /* %fs:0x0028 */
126 uint32_t thread_local_storage; /* %fs:0x002c */
127 uint32_t process_environment_block; /* %fs:0x0030 */
128 uint32_t last_error_number; /* %fs:0x0034 */
129 }
131
133 {
134 uint64_t current_seh; /* %gs:0x0000 */
135 uint64_t current_top_of_stack; /* %gs:0x0008 */
136 uint64_t current_bottom_of_stack; /* %gs:0x0010 */
137 uint64_t sub_system_tib; /* %gs:0x0018 */
138 uint64_t fiber_data; /* %gs:0x0020 */
139 uint64_t arbitrary_data_slot; /* %gs:0x0028 */
140 uint64_t linear_address_tib; /* %gs:0x0030 */
141 uint64_t environment_pointer; /* %gs:0x0038 */
142 uint64_t process_id; /* %gs:0x0040 */
143 uint64_t current_thread_id; /* %gs:0x0048 */
144 uint64_t active_rpc_handle; /* %gs:0x0050 */
145 uint64_t thread_local_storage; /* %gs:0x0058 */
146 uint64_t process_environment_block; /* %gs:0x0060 */
147 uint64_t last_error_number; /* %gs:0x0068 */
148 }
150
151
152static const char* TIB_NAME[] =
153 {
154 " current_seh ", /* %fs:0x0000 */
155 " current_top_of_stack ", /* %fs:0x0004 */
156 " current_bottom_of_stack ", /* %fs:0x0008 */
157 " sub_system_tib ", /* %fs:0x000c */
158 " fiber_data ", /* %fs:0x0010 */
159 " arbitrary_data_slot ", /* %fs:0x0014 */
160 " linear_address_tib ", /* %fs:0x0018 */
161 " environment_pointer ", /* %fs:0x001c */
162 " process_id ", /* %fs:0x0020 */
163 " current_thread_id ", /* %fs:0x0024 */
164 " active_rpc_handle ", /* %fs:0x0028 */
165 " thread_local_storage ", /* %fs:0x002c */
166 " process_environment_block ", /* %fs:0x0030 */
167 " last_error_number " /* %fs:0x0034 */
168 };
169
170static const int MAX_TIB32 =
171 sizeof (thread_information_32) / sizeof (uint32_t);
172static const int MAX_TIB64 =
173 sizeof (thread_information_64) / sizeof (uint64_t);
174static const int FULL_TIB_SIZE = 0x1000;
175
176static bool maint_display_all_tib = false;
177
179{
180 struct type *siginfo_type = nullptr;
181 /* Type of thread information block. */
182 struct type *tib_ptr_type = nullptr;
183};
184
187
188/* Get windows_gdbarch_data of an arch. */
189
190static struct windows_gdbarch_data *
192{
194 if (result == nullptr)
195 result = windows_gdbarch_data_handle.emplace (gdbarch);
196 return result;
197}
198
199/* Define Thread Local Base pointer type. */
200
201static struct type *
203{
204 struct type *dword_ptr_type, *dword32_type, *void_ptr_type;
205 struct type *peb_ldr_type, *peb_ldr_ptr_type;
206 struct type *peb_type, *peb_ptr_type, *list_type;
207 struct type *module_list_ptr_type;
208 struct type *tib_type, *seh_type, *tib_ptr_type, *seh_ptr_type;
209 struct type *word_type, *wchar_type, *wchar_ptr_type;
210 struct type *uni_str_type, *rupp_type, *rupp_ptr_type;
211
214 if (windows_gdbarch_data->tib_ptr_type != nullptr)
216
218 1, "DWORD_PTR");
219 dword32_type = arch_integer_type (gdbarch, 32,
220 1, "DWORD32");
221 word_type = arch_integer_type (gdbarch, 16,
222 1, "WORD");
223 wchar_type = arch_integer_type (gdbarch, 16,
224 1, "wchar_t");
225 void_ptr_type = lookup_pointer_type (builtin_type (gdbarch)->builtin_void);
227 NULL, wchar_type);
228
229 /* list entry */
230
231 list_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
232 list_type->set_name (xstrdup ("list"));
233
234 module_list_ptr_type = void_ptr_type;
235
236 append_composite_type_field (list_type, "forward_list",
237 module_list_ptr_type);
238 append_composite_type_field (list_type, "backward_list",
239 module_list_ptr_type);
240
241 /* Structured Exception Handler */
242
243 seh_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
244 seh_type->set_name (xstrdup ("seh"));
245
246 seh_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
247 void_ptr_type->length () * TARGET_CHAR_BIT,
248 NULL);
249 seh_ptr_type->set_target_type (seh_type);
250
251 append_composite_type_field (seh_type, "next_seh", seh_ptr_type);
252 append_composite_type_field (seh_type, "handler",
253 builtin_type (gdbarch)->builtin_func_ptr);
254
255 /* struct _PEB_LDR_DATA */
256 peb_ldr_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
257 peb_ldr_type->set_name (xstrdup ("peb_ldr_data"));
258
259 append_composite_type_field (peb_ldr_type, "length", dword32_type);
260 append_composite_type_field (peb_ldr_type, "initialized", dword32_type);
261 append_composite_type_field (peb_ldr_type, "ss_handle", void_ptr_type);
262 append_composite_type_field (peb_ldr_type, "in_load_order", list_type);
263 append_composite_type_field (peb_ldr_type, "in_memory_order", list_type);
264 append_composite_type_field (peb_ldr_type, "in_init_order", list_type);
265 append_composite_type_field (peb_ldr_type, "entry_in_progress",
266 void_ptr_type);
267 peb_ldr_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
268 void_ptr_type->length () * TARGET_CHAR_BIT,
269 NULL);
270 peb_ldr_ptr_type->set_target_type (peb_ldr_type);
271
272 /* struct UNICODE_STRING */
273 uni_str_type = arch_composite_type (gdbarch, "unicode_string",
274 TYPE_CODE_STRUCT);
275
276 append_composite_type_field (uni_str_type, "length", word_type);
277 append_composite_type_field (uni_str_type, "maximum_length", word_type);
278 append_composite_type_field_aligned (uni_str_type, "buffer",
279 wchar_ptr_type,
280 wchar_ptr_type->length ());
281
282 /* struct _RTL_USER_PROCESS_PARAMETERS */
283 rupp_type = arch_composite_type (gdbarch, "rtl_user_process_parameters",
284 TYPE_CODE_STRUCT);
285
286 append_composite_type_field (rupp_type, "maximum_length", dword32_type);
287 append_composite_type_field (rupp_type, "length", dword32_type);
288 append_composite_type_field (rupp_type, "flags", dword32_type);
289 append_composite_type_field (rupp_type, "debug_flags", dword32_type);
290 append_composite_type_field (rupp_type, "console_handle", void_ptr_type);
291 append_composite_type_field (rupp_type, "console_flags", dword32_type);
292 append_composite_type_field_aligned (rupp_type, "standard_input",
293 void_ptr_type,
294 void_ptr_type->length ());
295 append_composite_type_field (rupp_type, "standard_output", void_ptr_type);
296 append_composite_type_field (rupp_type, "standard_error", void_ptr_type);
297 append_composite_type_field (rupp_type, "current_directory", uni_str_type);
298 append_composite_type_field (rupp_type, "current_directory_handle",
299 void_ptr_type);
300 append_composite_type_field (rupp_type, "dll_path", uni_str_type);
301 append_composite_type_field (rupp_type, "image_path_name", uni_str_type);
302 append_composite_type_field (rupp_type, "command_line", uni_str_type);
303 append_composite_type_field (rupp_type, "environment", void_ptr_type);
304 append_composite_type_field (rupp_type, "starting_x", dword32_type);
305 append_composite_type_field (rupp_type, "starting_y", dword32_type);
306 append_composite_type_field (rupp_type, "count_x", dword32_type);
307 append_composite_type_field (rupp_type, "count_y", dword32_type);
308 append_composite_type_field (rupp_type, "count_chars_x", dword32_type);
309 append_composite_type_field (rupp_type, "count_chars_y", dword32_type);
310 append_composite_type_field (rupp_type, "fill_attribute", dword32_type);
311 append_composite_type_field (rupp_type, "window_flags", dword32_type);
312 append_composite_type_field (rupp_type, "show_window_flags", dword32_type);
313 append_composite_type_field_aligned (rupp_type, "window_title",
314 uni_str_type,
315 void_ptr_type->length ());
316 append_composite_type_field (rupp_type, "desktop_info", uni_str_type);
317 append_composite_type_field (rupp_type, "shell_info", uni_str_type);
318 append_composite_type_field (rupp_type, "runtime_data", uni_str_type);
319
321 NULL, rupp_type);
322
323
324 /* struct process environment block */
325 peb_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
326 peb_type->set_name (xstrdup ("peb"));
327
328 /* First bytes contain several flags. */
329 append_composite_type_field (peb_type, "flags", dword_ptr_type);
330 append_composite_type_field (peb_type, "mutant", void_ptr_type);
331 append_composite_type_field (peb_type, "image_base_address", void_ptr_type);
332 append_composite_type_field (peb_type, "ldr", peb_ldr_ptr_type);
333 append_composite_type_field (peb_type, "process_parameters", rupp_ptr_type);
334 append_composite_type_field (peb_type, "sub_system_data", void_ptr_type);
335 append_composite_type_field (peb_type, "process_heap", void_ptr_type);
336 append_composite_type_field (peb_type, "fast_peb_lock", void_ptr_type);
337 peb_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
338 void_ptr_type->length () * TARGET_CHAR_BIT,
339 NULL);
340 peb_ptr_type->set_target_type (peb_type);
341
342
343 /* struct thread information block */
344 tib_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
345 tib_type->set_name (xstrdup ("tib"));
346
347 /* uint32_t current_seh; %fs:0x0000 */
348 append_composite_type_field (tib_type, "current_seh", seh_ptr_type);
349 /* uint32_t current_top_of_stack; %fs:0x0004 */
350 append_composite_type_field (tib_type, "current_top_of_stack",
351 void_ptr_type);
352 /* uint32_t current_bottom_of_stack; %fs:0x0008 */
353 append_composite_type_field (tib_type, "current_bottom_of_stack",
354 void_ptr_type);
355 /* uint32_t sub_system_tib; %fs:0x000c */
356 append_composite_type_field (tib_type, "sub_system_tib", void_ptr_type);
357
358 /* uint32_t fiber_data; %fs:0x0010 */
359 append_composite_type_field (tib_type, "fiber_data", void_ptr_type);
360 /* uint32_t arbitrary_data_slot; %fs:0x0014 */
361 append_composite_type_field (tib_type, "arbitrary_data_slot", void_ptr_type);
362 /* uint32_t linear_address_tib; %fs:0x0018 */
363 append_composite_type_field (tib_type, "linear_address_tib", void_ptr_type);
364 /* uint32_t environment_pointer; %fs:0x001c */
365 append_composite_type_field (tib_type, "environment_pointer", void_ptr_type);
366 /* uint32_t process_id; %fs:0x0020 */
367 append_composite_type_field (tib_type, "process_id", dword_ptr_type);
368 /* uint32_t current_thread_id; %fs:0x0024 */
369 append_composite_type_field (tib_type, "thread_id", dword_ptr_type);
370 /* uint32_t active_rpc_handle; %fs:0x0028 */
371 append_composite_type_field (tib_type, "active_rpc_handle", dword_ptr_type);
372 /* uint32_t thread_local_storage; %fs:0x002c */
373 append_composite_type_field (tib_type, "thread_local_storage",
374 void_ptr_type);
375 /* uint32_t process_environment_block; %fs:0x0030 */
376 append_composite_type_field (tib_type, "process_environment_block",
377 peb_ptr_type);
378 /* uint32_t last_error_number; %fs:0x0034 */
379 append_composite_type_field (tib_type, "last_error_number", dword_ptr_type);
380
381 tib_ptr_type = arch_type (gdbarch, TYPE_CODE_PTR,
382 void_ptr_type->length () * TARGET_CHAR_BIT,
383 NULL);
384 tib_ptr_type->set_target_type (tib_type);
385
386 windows_gdbarch_data->tib_ptr_type = tib_ptr_type;
387
388 return tib_ptr_type;
389}
390
391/* The $_tlb convenience variable is a bit special. We don't know
392 for sure the type of the value until we actually have a chance to
393 fetch the data. The type can change depending on gdbarch, so it is
394 also dependent on which thread you have selected. */
395
396/* This function implements the lval_computed support for reading a
397 $_tlb value. */
398
399static void
401{
402 CORE_ADDR tlb;
403 struct type *type = check_typedef (value_type (val));
404
406 error (_("Unable to read tlb"));
407 store_typed_address (value_contents_raw (val).data (), type, tlb);
408}
409
410/* This function implements the lval_computed support for writing a
411 $_tlb value. */
412
413static void
414tlb_value_write (struct value *v, struct value *fromval)
415{
416 error (_("Impossible to change the Thread Local Base"));
417}
418
419static const struct lval_funcs tlb_value_funcs =
420 {
423 };
424
425
426/* Return a new value with the correct type for the tlb object of
427 the current thread using architecture GDBARCH. Return a void value
428 if there's no object available. */
429
430static struct value *
431tlb_make_value (struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
432{
433 if (target_has_stack () && inferior_ptid != null_ptid)
434 {
437 }
438
439 return allocate_value (builtin_type (gdbarch)->builtin_void);
440}
441
442
443/* Display thread information block of a given thread. */
444
445static int
446display_one_tib (ptid_t ptid)
447{
448 gdb_byte *tib = NULL;
449 gdb_byte *index;
450 CORE_ADDR thread_local_base;
451 ULONGEST i, val, max, max_name, size, tib_size;
452 ULONGEST sizeof_ptr = gdbarch_ptr_bit (target_gdbarch ());
453 enum bfd_endian byte_order = gdbarch_byte_order (target_gdbarch ());
454
455 if (sizeof_ptr == 64)
456 {
457 size = sizeof (uint64_t);
458 tib_size = sizeof (thread_information_64);
459 max = MAX_TIB64;
460 }
461 else
462 {
463 size = sizeof (uint32_t);
464 tib_size = sizeof (thread_information_32);
465 max = MAX_TIB32;
466 }
467
468 max_name = max;
469
471 {
472 tib_size = FULL_TIB_SIZE;
473 max = tib_size / size;
474 }
475
476 tib = (gdb_byte *) alloca (tib_size);
477
478 if (target_get_tib_address (ptid, &thread_local_base) == 0)
479 {
480 gdb_printf (_("Unable to get thread local base for %s\n"),
481 target_pid_to_str (ptid).c_str ());
482 return -1;
483 }
484
485 if (target_read (current_inferior ()->top_target (), TARGET_OBJECT_MEMORY,
486 NULL, tib, thread_local_base, tib_size) != tib_size)
487 {
488 gdb_printf (_("Unable to read thread information "
489 "block for %s at address %s\n"),
490 target_pid_to_str (ptid).c_str (),
491 paddress (target_gdbarch (), thread_local_base));
492 return -1;
493 }
494
495 gdb_printf (_("Thread Information Block %s at %s\n"),
496 target_pid_to_str (ptid).c_str (),
497 paddress (target_gdbarch (), thread_local_base));
498
499 index = (gdb_byte *) tib;
500
501 /* All fields have the size of a pointer, this allows to iterate
502 using the same for loop for both layouts. */
503 for (i = 0; i < max; i++)
504 {
505 val = extract_unsigned_integer (index, size, byte_order);
506 if (i < max_name)
507 gdb_printf (_("%s is 0x%s\n"), TIB_NAME[i], phex (val, size));
508 else if (val != 0)
509 gdb_printf (_("TIB[0x%s] is 0x%s\n"), phex (i * size, 2),
510 phex (val, size));
511 index += size;
512 }
513 return 1;
514}
515
516/* Display thread information block of the current thread. */
517
518static void
519display_tib (const char * args, int from_tty)
520{
521 if (inferior_ptid != null_ptid)
523}
524
525void
526windows_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
527 CORE_ADDR *text_offset_cached,
528 struct gdbarch *gdbarch, struct obstack *obstack)
529{
530 CORE_ADDR text_offset = text_offset_cached ? *text_offset_cached : 0;
531
532 obstack_grow_str (obstack, "<library name=\"");
533 std::string p = xml_escape_text (so_name);
534 obstack_grow_str (obstack, p.c_str ());
535 obstack_grow_str (obstack, "\"><segment address=\"");
536
537 if (!text_offset)
538 {
539 gdb_bfd_ref_ptr dll (gdb_bfd_open (so_name, gnutarget));
540 /* The following calls are OK even if dll is NULL.
541 The default value 0x1000 is returned by pe_text_section_offset
542 in that case. */
543 text_offset = pe_text_section_offset (dll.get ());
544 if (text_offset_cached)
545 *text_offset_cached = text_offset;
546 }
547
548 obstack_grow_str (obstack, paddress (gdbarch, load_addr + text_offset));
549 obstack_grow_str (obstack, "\"/></library>");
550}
551
552/* Implement the "iterate_over_objfiles_in_search_order" gdbarch
553 method. It searches all objfiles, starting with CURRENT_OBJFILE
554 first (if not NULL).
555
556 On Windows, the system behaves a little differently when two
557 objfiles each define a global symbol using the same name, compared
558 to other platforms such as GNU/Linux for instance. On GNU/Linux,
559 all instances of the symbol effectively get merged into a single
560 one, but on Windows, they remain distinct.
561
562 As a result, it usually makes sense to start global symbol searches
563 with the current objfile before expanding it to all other objfiles.
564 This helps for instance when a user debugs some code in a DLL that
565 refers to a global variable defined inside that DLL. When trying
566 to print the value of that global variable, it would be unhelpful
567 to print the value of another global variable defined with the same
568 name, but in a different DLL. */
569
570static void
573 objfile *current_objfile)
574{
575 if (current_objfile)
576 {
577 if (cb (current_objfile))
578 return;
579 }
580
582 if (objfile != current_objfile)
583 {
584 if (cb (objfile))
585 return;
586 }
587}
588
589static void
590show_maint_show_all_tib (struct ui_file *file, int from_tty,
591 struct cmd_list_element *c, const char *value)
592{
593 gdb_printf (file, _("Show all non-zero elements of "
594 "Thread Information Block is %s.\n"), value);
595}
596
597
599void
601{
603 {
605 ("w32", class_info,
606 _("Print information specific to Win32 debugging."),
609 }
610}
611
612/* Implementation of `gdbarch_gdb_signal_to_target' for Windows. */
613
614static int
615windows_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
616{
617 switch (signal)
618 {
619 case GDB_SIGNAL_0:
620 return 0;
621 case GDB_SIGNAL_HUP:
622 return WINDOWS_SIGHUP;
623 case GDB_SIGNAL_INT:
624 return WINDOWS_SIGINT;
625 case GDB_SIGNAL_QUIT:
626 return WINDOWS_SIGQUIT;
627 case GDB_SIGNAL_ILL:
628 return WINDOWS_SIGILL;
629 case GDB_SIGNAL_TRAP:
630 return WINDOWS_SIGTRAP;
631 case GDB_SIGNAL_ABRT:
632 return WINDOWS_SIGABRT;
633 case GDB_SIGNAL_EMT:
634 return WINDOWS_SIGEMT;
635 case GDB_SIGNAL_FPE:
636 return WINDOWS_SIGFPE;
637 case GDB_SIGNAL_KILL:
638 return WINDOWS_SIGKILL;
639 case GDB_SIGNAL_BUS:
640 return WINDOWS_SIGBUS;
641 case GDB_SIGNAL_SEGV:
642 return WINDOWS_SIGSEGV;
643 case GDB_SIGNAL_SYS:
644 return WINDOWS_SIGSYS;
645 case GDB_SIGNAL_PIPE:
646 return WINDOWS_SIGPIPE;
647 case GDB_SIGNAL_ALRM:
648 return WINDOWS_SIGALRM;
649 case GDB_SIGNAL_TERM:
650 return WINDOWS_SIGTERM;
651 }
652 return -1;
653}
654
655/* Implementation of `gdbarch_gdb_signal_to_target' for Cygwin. */
656
657static int
658cygwin_gdb_signal_to_target (struct gdbarch *gdbarch, enum gdb_signal signal)
659{
660 switch (signal)
661 {
662 case GDB_SIGNAL_0:
663 return 0;
664 case GDB_SIGNAL_HUP:
665 return CYGWIN_SIGHUP;
666 case GDB_SIGNAL_INT:
667 return CYGWIN_SIGINT;
668 case GDB_SIGNAL_QUIT:
669 return CYGWIN_SIGQUIT;
670 case GDB_SIGNAL_ILL:
671 return CYGWIN_SIGILL;
672 case GDB_SIGNAL_TRAP:
673 return CYGWIN_SIGTRAP;
674 case GDB_SIGNAL_ABRT:
675 return CYGWIN_SIGABRT;
676 case GDB_SIGNAL_EMT:
677 return CYGWIN_SIGEMT;
678 case GDB_SIGNAL_FPE:
679 return CYGWIN_SIGFPE;
680 case GDB_SIGNAL_KILL:
681 return CYGWIN_SIGKILL;
682 case GDB_SIGNAL_BUS:
683 return CYGWIN_SIGBUS;
684 case GDB_SIGNAL_SEGV:
685 return CYGWIN_SIGSEGV;
686 case GDB_SIGNAL_SYS:
687 return CYGWIN_SIGSYS;
688 case GDB_SIGNAL_PIPE:
689 return CYGWIN_SIGPIPE;
690 case GDB_SIGNAL_ALRM:
691 return CYGWIN_SIGALRM;
692 case GDB_SIGNAL_TERM:
693 return CYGWIN_SIGTERM;
694 case GDB_SIGNAL_URG:
695 return CYGWIN_SIGURG;
696 case GDB_SIGNAL_STOP:
697 return CYGWIN_SIGSTOP;
698 case GDB_SIGNAL_TSTP:
699 return CYGWIN_SIGTSTP;
700 case GDB_SIGNAL_CONT:
701 return CYGWIN_SIGCONT;
702 case GDB_SIGNAL_CHLD:
703 return CYGWIN_SIGCHLD;
704 case GDB_SIGNAL_TTIN:
705 return CYGWIN_SIGTTIN;
706 case GDB_SIGNAL_TTOU:
707 return CYGWIN_SIGTTOU;
708 case GDB_SIGNAL_IO:
709 return CYGWIN_SIGIO;
710 case GDB_SIGNAL_XCPU:
711 return CYGWIN_SIGXCPU;
712 case GDB_SIGNAL_XFSZ:
713 return CYGWIN_SIGXFSZ;
714 case GDB_SIGNAL_VTALRM:
715 return CYGWIN_SIGVTALRM;
716 case GDB_SIGNAL_PROF:
717 return CYGWIN_SIGPROF;
718 case GDB_SIGNAL_WINCH:
719 return CYGWIN_SIGWINCH;
720 case GDB_SIGNAL_PWR:
721 return CYGWIN_SIGLOST;
722 case GDB_SIGNAL_USR1:
723 return CYGWIN_SIGUSR1;
724 case GDB_SIGNAL_USR2:
725 return CYGWIN_SIGUSR2;
726 }
727 return -1;
728}
729
731{
732 uint32_t value;
733 const char *name;
734};
735
736/* Allocate a TYPE_CODE_ENUM type structure with its named values. */
737
738static struct type *
739create_enum (struct gdbarch *gdbarch, int bit, const char *name,
740 const struct enum_value_name *values, int count)
741{
742 struct type *type;
743 int i;
744
745 type = arch_type (gdbarch, TYPE_CODE_ENUM, bit, name);
746 type->set_num_fields (count);
748 ((struct field *) TYPE_ZALLOC (type, sizeof (struct field) * count));
749 type->set_is_unsigned (true);
750
751 for (i = 0; i < count; i++)
752 {
753 type->field (i).set_name (values[i].name);
754 type->field (i).set_loc_enumval (values[i].value);
755 }
756
757 return type;
758}
759
760static const struct enum_value_name exception_values[] =
761{
762 { 0x40000015, "FATAL_APP_EXIT" },
763 { 0x4000001E, "WX86_SINGLE_STEP" },
764 { 0x4000001F, "WX86_BREAKPOINT" },
765 { 0x40010005, "DBG_CONTROL_C" },
766 { 0x40010008, "DBG_CONTROL_BREAK" },
767 { 0x80000002, "DATATYPE_MISALIGNMENT" },
768 { 0x80000003, "BREAKPOINT" },
769 { 0x80000004, "SINGLE_STEP" },
770 { 0xC0000005, "ACCESS_VIOLATION" },
771 { 0xC0000006, "IN_PAGE_ERROR" },
772 { 0xC000001D, "ILLEGAL_INSTRUCTION" },
773 { 0xC0000025, "NONCONTINUABLE_EXCEPTION" },
774 { 0xC0000026, "INVALID_DISPOSITION" },
775 { 0xC000008C, "ARRAY_BOUNDS_EXCEEDED" },
776 { 0xC000008D, "FLOAT_DENORMAL_OPERAND" },
777 { 0xC000008E, "FLOAT_DIVIDE_BY_ZERO" },
778 { 0xC000008F, "FLOAT_INEXACT_RESULT" },
779 { 0xC0000090, "FLOAT_INVALID_OPERATION" },
780 { 0xC0000091, "FLOAT_OVERFLOW" },
781 { 0xC0000092, "FLOAT_STACK_CHECK" },
782 { 0xC0000093, "FLOAT_UNDERFLOW" },
783 { 0xC0000094, "INTEGER_DIVIDE_BY_ZERO" },
784 { 0xC0000095, "INTEGER_OVERFLOW" },
785 { 0xC0000096, "PRIV_INSTRUCTION" },
786 { 0xC00000FD, "STACK_OVERFLOW" },
787 { 0xC0000409, "FAST_FAIL" },
788};
789
790static const struct enum_value_name violation_values[] =
791{
792 { 0, "READ_ACCESS_VIOLATION" },
793 { 1, "WRITE_ACCESS_VIOLATION" },
794 { 8, "DATA_EXECUTION_PREVENTION_VIOLATION" },
795};
796
797/* Implement the "get_siginfo_type" gdbarch method. */
798
799static struct type *
801{
803 struct type *dword_type, *pvoid_type, *ulongptr_type;
804 struct type *code_enum, *violation_enum;
805 struct type *violation_type, *para_type, *siginfo_ptr_type, *siginfo_type;
806
810
812 1, "DWORD");
813 pvoid_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch), "PVOID",
814 builtin_type (gdbarch)->builtin_void);
816 1, "ULONG_PTR");
817
818 /* ExceptionCode value names */
820 "ExceptionCode", exception_values,
821 ARRAY_SIZE (exception_values));
822
823 /* ACCESS_VIOLATION type names */
824 violation_enum = create_enum (gdbarch, gdbarch_ptr_bit (gdbarch),
825 "ViolationType", violation_values,
826 ARRAY_SIZE (violation_values));
827
828 /* ACCESS_VIOLATION information */
829 violation_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_STRUCT);
830 append_composite_type_field (violation_type, "Type", violation_enum);
831 append_composite_type_field (violation_type, "Address", pvoid_type);
832
833 /* Unnamed union of the documented field ExceptionInformation,
834 and the alternative AccessViolationInformation (which displays
835 human-readable values for ExceptionCode ACCESS_VIOLATION). */
836 para_type = arch_composite_type (gdbarch, NULL, TYPE_CODE_UNION);
837 append_composite_type_field (para_type, "ExceptionInformation",
838 lookup_array_range_type (ulongptr_type, 0, 14));
839 append_composite_type_field (para_type, "AccessViolationInformation",
840 violation_type);
841
842 siginfo_type = arch_composite_type (gdbarch, "EXCEPTION_RECORD",
843 TYPE_CODE_STRUCT);
844 siginfo_ptr_type = arch_pointer_type (gdbarch, gdbarch_ptr_bit (gdbarch),
845 NULL, siginfo_type);
846
847 /* ExceptionCode is documented as type DWORD, but here a helper
848 enum type is used instead to display a human-readable value. */
849 append_composite_type_field (siginfo_type, "ExceptionCode", code_enum);
850 append_composite_type_field (siginfo_type, "ExceptionFlags", dword_type);
851 append_composite_type_field (siginfo_type, "ExceptionRecord",
852 siginfo_ptr_type);
853 append_composite_type_field (siginfo_type, "ExceptionAddress",
854 pvoid_type);
855 append_composite_type_field (siginfo_type, "NumberParameters", dword_type);
856 /* The 64-bit variant needs some padding. */
857 append_composite_type_field_aligned (siginfo_type, "",
858 para_type, ulongptr_type->length ());
859
860 windows_gdbarch_data->siginfo_type = siginfo_type;
861
862 return siginfo_type;
863}
864
865/* Implement the "solib_create_inferior_hook" target_so_ops method. */
866
867static void
869{
870 CORE_ADDR exec_base = 0;
871
872 /* Find base address of main executable in
873 TIB->process_environment_block->image_base_address. */
874 struct gdbarch *gdbarch = target_gdbarch ();
875 enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
876 int ptr_bytes;
877 int peb_offset; /* Offset of process_environment_block in TIB. */
878 int base_offset; /* Offset of image_base_address in PEB. */
879 if (gdbarch_ptr_bit (gdbarch) == 32)
880 {
881 ptr_bytes = 4;
882 peb_offset = 48;
883 base_offset = 8;
884 }
885 else
886 {
887 ptr_bytes = 8;
888 peb_offset = 96;
889 base_offset = 16;
890 }
891 CORE_ADDR tlb;
892 gdb_byte buf[8];
895 && !target_read_memory (tlb + peb_offset, buf, ptr_bytes))
896 {
897 CORE_ADDR peb = extract_unsigned_integer (buf, ptr_bytes, byte_order);
898 if (!target_read_memory (peb + base_offset, buf, ptr_bytes))
899 exec_base = extract_unsigned_integer (buf, ptr_bytes, byte_order);
900 }
901
902 /* Rebase executable if the base address changed because of ASLR. */
903 if (current_program_space->symfile_object_file != nullptr && exec_base != 0)
904 {
905 CORE_ADDR vmaddr
906 = pe_data (current_program_space->exec_bfd ())->pe_opthdr.ImageBase;
907 if (vmaddr != exec_base)
909 exec_base - vmaddr);
910 }
911}
912
914
915/* Common parts for gdbarch initialization for the Windows and Cygwin OS
916 ABIs. */
917
918static void
920{
923
924 /* Canonical paths on this target look like
925 `c:\Program Files\Foo App\mydll.dll', for example. */
927
930
935
937}
938
939/* See windows-tdep.h. */
940void
942{
945}
946
947/* See windows-tdep.h. */
948
949void
951{
954}
955
956/* Implementation of `tlb' variable. */
957
958static const struct internalvar_funcs tlb_funcs =
959{
961 NULL,
962};
963
964/* Layout of an element of a PE's Import Directory Table. Based on:
965
966 https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#import-directory-table
967 */
968
970{
972 uint32_t timestamp;
974 uint32_t name_rva;
976};
977
979
980/* See windows-tdep.h. */
981
982bool
984{
985 /* The list of DLLs a PE is linked to is in the .idata section. See:
986
987 https://docs.microsoft.com/en-us/windows/win32/debug/pe-format#the-idata-section
988 */
989 asection *idata_section = bfd_get_section_by_name (abfd, ".idata");
990 if (idata_section == nullptr)
991 return false;
992
993 bfd_size_type idata_section_size = bfd_section_size (idata_section);
994 internal_extra_pe_aouthdr *pe_extra = &pe_data (abfd)->pe_opthdr;
995 bfd_vma import_table_va = pe_extra->DataDirectory[PE_IMPORT_TABLE].VirtualAddress;
996 bfd_vma idata_section_va = bfd_section_vma (idata_section);
997
998 /* The section's virtual address as reported by BFD has the image base applied,
999 remove it. */
1000 gdb_assert (idata_section_va >= pe_extra->ImageBase);
1001 idata_section_va -= pe_extra->ImageBase;
1002
1003 bfd_vma idata_section_end_va = idata_section_va + idata_section_size;
1004
1005 /* Make sure that the import table is indeed within the .idata section's range. */
1006 if (import_table_va < idata_section_va
1007 || import_table_va >= idata_section_end_va)
1008 {
1009 warning (_("\
1010%s: import table's virtual address (%s) is outside .idata \
1011section's range [%s, %s]."),
1012 bfd_get_filename (abfd), hex_string (import_table_va),
1013 hex_string (idata_section_va),
1014 hex_string (idata_section_end_va));
1015 return false;
1016 }
1017
1018 /* The import table starts at this offset into the .idata section. */
1019 bfd_vma import_table_offset_in_sect = import_table_va - idata_section_va;
1020
1021 /* Get the section's data. */
1022 gdb::byte_vector idata_contents;
1023 if (!gdb_bfd_get_full_section_contents (abfd, idata_section, &idata_contents))
1024 {
1025 warning (_("%s: failed to get contents of .idata section."),
1026 bfd_get_filename (abfd));
1027 return false;
1028 }
1029
1030 gdb_assert (idata_contents.size () == idata_section_size);
1031
1032 const gdb_byte *iter = idata_contents.data () + import_table_offset_in_sect;
1033 const gdb_byte *end = idata_contents.data () + idata_section_size;
1034 const pe_import_directory_entry null_dir_entry = { 0 };
1035
1036 /* Iterate through all directory entries. */
1037 while (true)
1038 {
1039 /* Is there enough space left in the section for another entry? */
1040 if (iter + sizeof (pe_import_directory_entry) > end)
1041 {
1042 warning (_("%s: unexpected end of .idata section."),
1043 bfd_get_filename (abfd));
1044 break;
1045 }
1046
1048
1049 /* Is it the end of list marker? */
1050 if (memcmp (dir_entry, &null_dir_entry,
1051 sizeof (pe_import_directory_entry)) == 0)
1052 break;
1053
1054 bfd_vma name_va = dir_entry->name_rva;
1055
1056 /* If the name's virtual address is smaller than the section's virtual
1057 address, there's a problem. */
1058 if (name_va < idata_section_va || name_va >= idata_section_end_va)
1059 {
1060 warning (_("\
1061%s: name's virtual address (%s) is outside .idata section's \
1062range [%s, %s]."),
1063 bfd_get_filename (abfd), hex_string (name_va),
1064 hex_string (idata_section_va),
1065 hex_string (idata_section_end_va));
1066 break;
1067 }
1068
1069 const gdb_byte *name = &idata_contents[name_va - idata_section_va];
1070
1071 /* Make sure we don't overshoot the end of the section with the
1072 streq. */
1073 if (name + sizeof (CYGWIN_DLL_NAME) <= end)
1074 {
1075 /* Finally, check if this is the dll name we are looking for. */
1076 if (streq ((const char *) name, CYGWIN_DLL_NAME))
1077 return true;
1078 }
1079
1080 iter += sizeof (pe_import_directory_entry);
1081 }
1082
1083 return false;
1084}
1085
1087{
1091};
1092
1093static void
1094core_process_module_section (bfd *abfd, asection *sect, void *obj)
1095{
1096 struct cpms_data *data = (struct cpms_data *) obj;
1097 enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch);
1098
1099 unsigned int data_type;
1100 char *module_name;
1101 size_t module_name_size;
1102 size_t module_name_offset;
1103 CORE_ADDR base_addr;
1104
1105 if (!startswith (sect->name, ".module"))
1106 return;
1107
1108 gdb::byte_vector buf (bfd_section_size (sect) + 1);
1109 if (!bfd_get_section_contents (abfd, sect,
1110 buf.data (), 0, bfd_section_size (sect)))
1111 return;
1112 /* We're going to treat part of the buffer as a string, so make sure
1113 it is NUL-terminated. */
1114 buf.back () = 0;
1115
1116 /* A DWORD (data_type) followed by struct windows_core_module_info. */
1117 if (bfd_section_size (sect) < 4)
1118 return;
1119 data_type = extract_unsigned_integer (buf.data (), 4, byte_order);
1120
1121 if (data_type == NOTE_INFO_MODULE)
1122 {
1123 module_name_offset = 12;
1124 if (bfd_section_size (sect) < module_name_offset)
1125 return;
1126 base_addr = extract_unsigned_integer (&buf[4], 4, byte_order);
1127 module_name_size = extract_unsigned_integer (&buf[8], 4, byte_order);
1128 }
1129 else if (data_type == NOTE_INFO_MODULE64)
1130 {
1131 module_name_offset = 16;
1132 if (bfd_section_size (sect) < module_name_offset)
1133 return;
1134 base_addr = extract_unsigned_integer (&buf[4], 8, byte_order);
1135 module_name_size = extract_unsigned_integer (&buf[12], 4, byte_order);
1136 }
1137 else
1138 return;
1139
1140 if (module_name_offset + module_name_size > bfd_section_size (sect))
1141 return;
1142 module_name = (char *) buf.data () + module_name_offset;
1143
1144 /* The first module is the .exe itself. */
1145 if (data->module_count != 0)
1146 windows_xfer_shared_library (module_name, base_addr,
1147 NULL, data->gdbarch, data->obstack);
1148 data->module_count++;
1149}
1150
1151ULONGEST
1153 gdb_byte *readbuf,
1154 ULONGEST offset, ULONGEST len)
1155{
1156 struct obstack obstack;
1157 const char *buf;
1158 ULONGEST len_avail;
1159 struct cpms_data data = { gdbarch, &obstack, 0 };
1160
1161 obstack_init (&obstack);
1162 obstack_grow_str (&obstack, "<library-list>\n");
1163 bfd_map_over_sections (core_bfd,
1165 &data);
1166 obstack_grow_str0 (&obstack, "</library-list>\n");
1167
1168 buf = (const char *) obstack_finish (&obstack);
1169 len_avail = strlen (buf);
1170 if (offset >= len_avail)
1171 return 0;
1172
1173 if (len > len_avail - offset)
1174 len = len_avail - offset;
1175 memcpy (readbuf, buf + offset, len);
1176
1177 obstack_free (&obstack, NULL);
1178 return len;
1179}
1180
1181/* This is how we want PTIDs from core files to be printed. */
1182
1183std::string
1185{
1186 if (ptid.lwp () != 0)
1187 return string_printf ("Thread 0x%lx", ptid.lwp ());
1188
1189 return normal_pid_to_str (ptid);
1190}
1191
1193void
1195{
1197 cmd_list_element *info_w32_thread_information_block_cmd
1198 = add_cmd ("thread-information-block", class_info, display_tib,
1199 _("Display thread information block."),
1201 add_alias_cmd ("tib", info_w32_thread_information_block_cmd, class_info, 1,
1203
1206Set whether to display all non-zero fields of thread information block."), _("\
1207Show whether to display all non-zero fields of thread information block."), _("\
1208Use \"on\" to enable, \"off\" to disable.\n\
1209If enabled, all non-zero fields of thread information block are displayed,\n\
1210even if their meaning is unknown."),
1211 NULL,
1215
1216 /* Explicitly create without lookup, since that tries to create a
1217 value with a void typed value, and when we get here, gdbarch
1218 isn't initialized yet. At this point, we're quite sure there
1219 isn't another convenience variable of the same name. */
1220 create_internalvar_type_lazy ("_tlb", &tlb_funcs, NULL);
1221}
#define bit(obj, st)
Definition: aarch64-insn.h:38
const char *const name
Definition: aarch64-tdep.c:67
struct gdbarch * target_gdbarch(void)
Definition: arch-utils.c:1453
void * get(unsigned key)
Definition: registry.h:211
struct cmd_list_element * infolist
Definition: cli-cmds.c:89
struct cmd_list_element * maintenance_show_cmdlist
Definition: maint.c:752
struct cmd_list_element * maintenance_set_cmdlist
Definition: maint.c:751
struct cmd_list_element * add_alias_cmd(const char *name, cmd_list_element *target, enum command_class theclass, int abbrev_flag, struct cmd_list_element **list)
Definition: cli-decode.c:294
struct cmd_list_element * add_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **list)
Definition: cli-decode.c:233
set_show_commands add_setshow_boolean_cmd(const char *name, enum command_class theclass, bool *var, const char *set_doc, const char *show_doc, const char *help_doc, cmd_func_ftype *set_func, show_value_ftype *show_func, struct cmd_list_element **set_list, struct cmd_list_element **show_list)
Definition: cli-decode.c:739
struct cmd_list_element * add_basic_prefix_cmd(const char *name, enum command_class theclass, const char *doc, struct cmd_list_element **subcommands, int allow_unknown, struct cmd_list_element **list)
Definition: cli-decode.c:391
CORE_ADDR pe_text_section_offset(struct bfd *abfd)
Definition: coff-pe-read.c:600
@ class_maintenance
Definition: command.h:65
@ class_info
Definition: command.h:59
const char * gnutarget
Definition: corefile.c:394
void store_typed_address(gdb_byte *buf, struct type *type, CORE_ADDR addr)
Definition: findvar.c:202
static ULONGEST extract_unsigned_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
Definition: defs.h:526
gdb_bfd_ref_ptr gdb_bfd_open(const char *name, const char *target, int fd, bool warn_if_slow)
Definition: gdb_bfd.c:491
bool gdb_bfd_get_full_section_contents(bfd *abfd, asection *section, gdb::byte_vector *contents)
Definition: gdb_bfd.c:1030
gdb::ref_ptr< struct bfd, gdb_bfd_ref_policy > gdb_bfd_ref_ptr
Definition: gdb_bfd.h:78
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition: gdbarch.c:1370
void set_gdbarch_wchar_bit(struct gdbarch *gdbarch, int wchar_bit)
Definition: gdbarch.c:1649
void set_gdbarch_has_dos_based_file_system(struct gdbarch *gdbarch, int has_dos_based_file_system)
Definition: gdbarch.c:4900
void set_gdbarch_wchar_signed(struct gdbarch *gdbarch, int wchar_signed)
Definition: gdbarch.c:1667
void set_gdbarch_get_siginfo_type(struct gdbarch *gdbarch, gdbarch_get_siginfo_type_ftype *get_siginfo_type)
int gdbarch_int_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1423
void set_gdbarch_iterate_over_objfiles_in_search_order(struct gdbarch *gdbarch, gdbarch_iterate_over_objfiles_in_search_order_ftype *iterate_over_objfiles_in_search_order)
void set_gdbarch_gdb_signal_to_target(struct gdbarch *gdbarch, gdbarch_gdb_signal_to_target_ftype *gdb_signal_to_target)
int gdbarch_ptr_bit(struct gdbarch *gdbarch)
Definition: gdbarch.c:1691
void set_gdbarch_so_ops(struct gdbarch *gdbarch, const struct target_so_ops *so_ops)
Definition: gdbarch.c:3314
gdb::function_view< bool(objfile *)> iterate_over_objfiles_in_search_order_cb_ftype
Definition: gdbarch.h:91
#define core_bfd
Definition: gdbcore.h:130
struct type * arch_pointer_type(struct gdbarch *gdbarch, int bit, const char *name, struct type *target_type)
Definition: gdbtypes.c:5920
struct type * lookup_pointer_type(struct type *type)
Definition: gdbtypes.c:402
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
Definition: gdbtypes.c:5989
struct type * lookup_array_range_type(struct type *element_type, LONGEST low_bound, LONGEST high_bound)
Definition: gdbtypes.c:1431
struct type * arch_type(struct gdbarch *gdbarch, enum type_code code, int bit, const char *name)
Definition: gdbtypes.c:5815
void append_composite_type_field_aligned(struct type *t, const char *name, struct type *field, int alignment)
Definition: gdbtypes.c:6025
void append_composite_type_field(struct type *t, const char *name, struct type *field)
Definition: gdbtypes.c:6065
struct type * arch_integer_type(struct gdbarch *gdbarch, int bit, int unsigned_p, const char *name)
Definition: gdbtypes.c:5836
struct type * check_typedef(struct type *type)
Definition: gdbtypes.c:3010
#define TYPE_ZALLOC(t, size)
Definition: gdbtypes.h:2415
size_t size
Definition: go32-nat.c:241
ptid_t inferior_ptid
Definition: infcmd.c:91
struct inferior * current_inferior(void)
Definition: inferior.c:54
void objfile_rebase(struct objfile *objfile, CORE_ADDR slide)
Definition: objfiles.c:765
struct program_space * current_program_space
Definition: progspace.c:39
const struct target_so_ops solib_target_so_ops
Definition: solib-target.c:438
struct obstack * obstack
int module_count
struct gdbarch * gdbarch
const char * name
Definition: windows-tdep.c:733
void set_loc_enumval(LONGEST enumval)
Definition: gdbtypes.h:604
void set_name(const char *name)
Definition: gdbtypes.h:574
Definition: windows-tdep.c:970
uint32_t timestamp
Definition: windows-tdep.c:972
uint32_t forwarder_chain
Definition: windows-tdep.c:973
uint32_t import_address_table_rva
Definition: windows-tdep.c:975
uint32_t import_lookup_table_rva
Definition: windows-tdep.c:971
uint32_t name_rva
Definition: windows-tdep.c:974
objfiles_range objfiles()
Definition: progspace.h:209
bfd * exec_bfd() const
Definition: progspace.h:264
struct objfile * symfile_object_file
Definition: progspace.h:353
void(* solib_create_inferior_hook)(int from_tty)
Definition: solist.h:107
Definition: gdbtypes.h:922
ULONGEST length() const
Definition: gdbtypes.h:954
struct field & field(int idx) const
Definition: gdbtypes.h:983
void set_target_type(struct type *target_type)
Definition: gdbtypes.h:1005
void set_is_unsigned(bool is_unsigned)
Definition: gdbtypes.h:1068
void set_num_fields(int num_fields)
Definition: gdbtypes.h:971
void set_name(const char *name)
Definition: gdbtypes.h:945
void set_fields(struct field *fields)
Definition: gdbtypes.h:990
Definition: value.c:181
struct type * siginfo_type
Definition: windows-tdep.c:180
struct type * tib_ptr_type
Definition: windows-tdep.c:182
int target_has_stack()
Definition: target.c:178
bool target_has_execution(inferior *inf)
Definition: target.c:202
LONGEST target_read(struct target_ops *ops, enum target_object object, const char *annex, gdb_byte *buf, ULONGEST offset, LONGEST len)
Definition: target.c:1956
std::string target_pid_to_str(ptid_t ptid)
Definition: target.c:2602
std::string normal_pid_to_str(ptid_t ptid)
Definition: target.c:3672
bool target_get_tib_address(ptid_t ptid, CORE_ADDR *addr)
Definition: target.c:763
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition: target.c:1771
@ TARGET_OBJECT_MEMORY
Definition: target.h:142
const char * paddress(struct gdbarch *gdbarch, CORE_ADDR addr)
Definition: utils.c:3114
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition: utils.c:1865
struct type * value_type(const struct value *value)
Definition: value.c:1109
struct value * allocate_value(struct type *type)
Definition: value.c:1053
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)
Definition: value.c:2200
gdb::array_view< gdb_byte > value_contents_raw(struct value *value)
Definition: value.c:1167
struct value * allocate_computed_value(struct type *type, const struct lval_funcs *funcs, void *closure)
Definition: value.c:1081
#define CYGWIN_DLL_NAME
Definition: windows-tdep.c:40
void windows_xfer_shared_library(const char *so_name, CORE_ADDR load_addr, CORE_ADDR *text_offset_cached, struct gdbarch *gdbarch, struct obstack *obstack)
Definition: windows-tdep.c:526
static struct target_so_ops windows_so_ops
Definition: windows-tdep.c:913
std::string windows_core_pid_to_str(struct gdbarch *gdbarch, ptid_t ptid)
static const struct enum_value_name violation_values[]
Definition: windows-tdep.c:790
static void display_tib(const char *args, int from_tty)
Definition: windows-tdep.c:519
bool is_linked_with_cygwin_dll(bfd *abfd)
Definition: windows-tdep.c:983
static const char * TIB_NAME[]
Definition: windows-tdep.c:152
void init_w32_command_list(void)
Definition: windows-tdep.c:600
static void windows_iterate_over_objfiles_in_search_order(gdbarch *gdbarch, iterate_over_objfiles_in_search_order_cb_ftype cb, objfile *current_objfile)
Definition: windows-tdep.c:572
static const int FULL_TIB_SIZE
Definition: windows-tdep.c:174
void _initialize_windows_tdep()
static void tlb_value_read(struct value *val)
Definition: windows-tdep.c:400
static const registry< gdbarch >::key< windows_gdbarch_data > windows_gdbarch_data_handle
Definition: windows-tdep.c:186
ULONGEST windows_core_xfer_shared_libraries(struct gdbarch *gdbarch, gdb_byte *readbuf, ULONGEST offset, ULONGEST len)
static int windows_gdb_signal_to_target(struct gdbarch *gdbarch, enum gdb_signal signal)
Definition: windows-tdep.c:615
static struct type * windows_get_tlb_type(struct gdbarch *gdbarch)
Definition: windows-tdep.c:202
static void tlb_value_write(struct value *v, struct value *fromval)
Definition: windows-tdep.c:414
@ CYGWIN_SIGCONT
Definition: windows-tdep.c:92
@ CYGWIN_SIGVTALRM
Definition: windows-tdep.c:99
@ CYGWIN_SIGPROF
Definition: windows-tdep.c:100
@ CYGWIN_SIGLOST
Definition: windows-tdep.c:102
@ CYGWIN_SIGALRM
Definition: windows-tdep.c:87
@ CYGWIN_SIGEMT
Definition: windows-tdep.c:80
@ CYGWIN_SIGCHLD
Definition: windows-tdep.c:93
@ CYGWIN_SIGTTIN
Definition: windows-tdep.c:94
@ CYGWIN_SIGFPE
Definition: windows-tdep.c:81
@ CYGWIN_SIGUSR1
Definition: windows-tdep.c:103
@ CYGWIN_SIGWINCH
Definition: windows-tdep.c:101
@ CYGWIN_SIGTERM
Definition: windows-tdep.c:88
@ CYGWIN_SIGXCPU
Definition: windows-tdep.c:97
@ CYGWIN_SIGQUIT
Definition: windows-tdep.c:76
@ CYGWIN_SIGTSTP
Definition: windows-tdep.c:91
@ CYGWIN_SIGPIPE
Definition: windows-tdep.c:86
@ CYGWIN_SIGSYS
Definition: windows-tdep.c:85
@ CYGWIN_SIGTTOU
Definition: windows-tdep.c:95
@ CYGWIN_SIGABRT
Definition: windows-tdep.c:79
@ CYGWIN_SIGTRAP
Definition: windows-tdep.c:78
@ CYGWIN_SIGUSR2
Definition: windows-tdep.c:104
@ CYGWIN_SIGILL
Definition: windows-tdep.c:77
@ CYGWIN_SIGHUP
Definition: windows-tdep.c:74
@ CYGWIN_SIGXFSZ
Definition: windows-tdep.c:98
@ CYGWIN_SIGBUS
Definition: windows-tdep.c:83
@ CYGWIN_SIGKILL
Definition: windows-tdep.c:82
@ CYGWIN_SIGIO
Definition: windows-tdep.c:96
@ CYGWIN_SIGSEGV
Definition: windows-tdep.c:84
@ CYGWIN_SIGURG
Definition: windows-tdep.c:89
@ CYGWIN_SIGINT
Definition: windows-tdep.c:75
@ CYGWIN_SIGSTOP
Definition: windows-tdep.c:90
static int w32_prefix_command_valid
Definition: windows-tdep.c:598
@ WINDOWS_SIGKILL
Definition: windows-tdep.c:59
@ WINDOWS_SIGTERM
Definition: windows-tdep.c:65
@ WINDOWS_SIGPIPE
Definition: windows-tdep.c:63
@ WINDOWS_SIGILL
Definition: windows-tdep.c:54
@ WINDOWS_SIGALRM
Definition: windows-tdep.c:64
@ WINDOWS_SIGQUIT
Definition: windows-tdep.c:53
@ WINDOWS_SIGBUS
Definition: windows-tdep.c:60
@ WINDOWS_SIGBREAK
Definition: windows-tdep.c:66
@ WINDOWS_SIGFPE
Definition: windows-tdep.c:58
@ WINDOWS_SIGIOT
Definition: windows-tdep.c:56
@ WINDOWS_SIGTRAP
Definition: windows-tdep.c:55
@ WINDOWS_SIGABRT
Definition: windows-tdep.c:67
@ WINDOWS_SIGINT
Definition: windows-tdep.c:52
@ WINDOWS_SIGHUP
Definition: windows-tdep.c:51
@ WINDOWS_SIGSEGV
Definition: windows-tdep.c:61
@ WINDOWS_SIGSYS
Definition: windows-tdep.c:62
@ WINDOWS_SIGEMT
Definition: windows-tdep.c:57
static void core_process_module_section(bfd *abfd, asection *sect, void *obj)
static struct windows_gdbarch_data * get_windows_gdbarch_data(struct gdbarch *gdbarch)
Definition: windows-tdep.c:191
static const struct lval_funcs tlb_value_funcs
Definition: windows-tdep.c:419
void cygwin_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: windows-tdep.c:950
static const int MAX_TIB64
Definition: windows-tdep.c:172
static struct value * tlb_make_value(struct gdbarch *gdbarch, struct internalvar *var, void *ignore)
Definition: windows-tdep.c:431
static struct type * create_enum(struct gdbarch *gdbarch, int bit, const char *name, const struct enum_value_name *values, int count)
Definition: windows-tdep.c:739
static const struct enum_value_name exception_values[]
Definition: windows-tdep.c:760
static int display_one_tib(ptid_t ptid)
Definition: windows-tdep.c:446
struct thread_information_block_64 thread_information_64
gdb_static_assert(sizeof(pe_import_directory_entry)==20)
static constexpr unsigned int NOTE_INFO_MODULE
Definition: windows-tdep.c:108
void windows_init_abi(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: windows-tdep.c:941
static struct type * windows_get_siginfo_type(struct gdbarch *gdbarch)
Definition: windows-tdep.c:800
static constexpr unsigned int NOTE_INFO_MODULE64
Definition: windows-tdep.c:109
static const int MAX_TIB32
Definition: windows-tdep.c:170
struct cmd_list_element * info_w32_cmdlist
Definition: windows-tdep.c:111
static int cygwin_gdb_signal_to_target(struct gdbarch *gdbarch, enum gdb_signal signal)
Definition: windows-tdep.c:658
static bool maint_display_all_tib
Definition: windows-tdep.c:176
static void windows_init_abi_common(struct gdbarch_info info, struct gdbarch *gdbarch)
Definition: windows-tdep.c:919
struct thread_information_block_32 thread_information_32
static const struct internalvar_funcs tlb_funcs
Definition: windows-tdep.c:958
static void windows_solib_create_inferior_hook(int from_tty)
Definition: windows-tdep.c:868
static void show_maint_show_all_tib(struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
Definition: windows-tdep.c:590