1 /* Copyright (C) 2008-2020 Free Software Foundation, Inc.
3 This file is part of GDB.
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.
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.
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/>. */
19 #include "windows-tdep.h"
20 #include "gdb_obstack.h"
21 #include "xml-support.h"
28 #include "gdbthread.h"
31 #include "coff-pe-read.h"
33 #include "complaints.h"
35 #include "solib-target.h"
38 /* Windows signal numbers differ between MinGW flavors and between
39 those and Cygwin. The below enumeration was gleaned from the
40 respective headers; the ones marked with MinGW64/Cygwin are defined
41 only by MinGW64 and Cygwin, not by mingw.org's MinGW. FIXME: We
42 should really have distinct MinGW vs Cygwin OSABIs, and two
43 separate enums, selected at runtime. */
47 WINDOWS_SIGHUP
= 1, /* MinGW64/Cygwin */
49 WINDOWS_SIGQUIT
= 3, /* MinGW64/Cygwin */
51 WINDOWS_SIGTRAP
= 5, /* MinGW64/Cygwin */
55 WINDOWS_SIGIOT
= 6, /* MinGW64 */
57 WINDOWS_SIGEMT
= 7, /* MinGW64/Cygwin */
59 WINDOWS_SIGKILL
= 9, /* MinGW64/Cygwin */
60 WINDOWS_SIGBUS
= 10, /* MinGW64/Cygwin */
62 WINDOWS_SIGSYS
= 12, /* MinGW64/Cygwin */
63 WINDOWS_SIGPIPE
= 13,/* MinGW64/Cygwin */
64 WINDOWS_SIGALRM
= 14,/* MinGW64/Cygwin */
77 WINDOWS_SIGVTALRM
= 26,
79 WINDOWS_SIGWINCH
= 28,
84 WINDOWS_SIGBREAK
= 21,
89 struct cmd_list_element
*info_w32_cmdlist
;
91 typedef struct thread_information_block_32
93 uint32_t current_seh
; /* %fs:0x0000 */
94 uint32_t current_top_of_stack
; /* %fs:0x0004 */
95 uint32_t current_bottom_of_stack
; /* %fs:0x0008 */
96 uint32_t sub_system_tib
; /* %fs:0x000c */
97 uint32_t fiber_data
; /* %fs:0x0010 */
98 uint32_t arbitrary_data_slot
; /* %fs:0x0014 */
99 uint32_t linear_address_tib
; /* %fs:0x0018 */
100 uint32_t environment_pointer
; /* %fs:0x001c */
101 uint32_t process_id
; /* %fs:0x0020 */
102 uint32_t current_thread_id
; /* %fs:0x0024 */
103 uint32_t active_rpc_handle
; /* %fs:0x0028 */
104 uint32_t thread_local_storage
; /* %fs:0x002c */
105 uint32_t process_environment_block
; /* %fs:0x0030 */
106 uint32_t last_error_number
; /* %fs:0x0034 */
108 thread_information_32
;
110 typedef struct thread_information_block_64
112 uint64_t current_seh
; /* %gs:0x0000 */
113 uint64_t current_top_of_stack
; /* %gs:0x0008 */
114 uint64_t current_bottom_of_stack
; /* %gs:0x0010 */
115 uint64_t sub_system_tib
; /* %gs:0x0018 */
116 uint64_t fiber_data
; /* %gs:0x0020 */
117 uint64_t arbitrary_data_slot
; /* %gs:0x0028 */
118 uint64_t linear_address_tib
; /* %gs:0x0030 */
119 uint64_t environment_pointer
; /* %gs:0x0038 */
120 uint64_t process_id
; /* %gs:0x0040 */
121 uint64_t current_thread_id
; /* %gs:0x0048 */
122 uint64_t active_rpc_handle
; /* %gs:0x0050 */
123 uint64_t thread_local_storage
; /* %gs:0x0058 */
124 uint64_t process_environment_block
; /* %gs:0x0060 */
125 uint64_t last_error_number
; /* %gs:0x0068 */
127 thread_information_64
;
130 static const char* TIB_NAME
[] =
132 " current_seh ", /* %fs:0x0000 */
133 " current_top_of_stack ", /* %fs:0x0004 */
134 " current_bottom_of_stack ", /* %fs:0x0008 */
135 " sub_system_tib ", /* %fs:0x000c */
136 " fiber_data ", /* %fs:0x0010 */
137 " arbitrary_data_slot ", /* %fs:0x0014 */
138 " linear_address_tib ", /* %fs:0x0018 */
139 " environment_pointer ", /* %fs:0x001c */
140 " process_id ", /* %fs:0x0020 */
141 " current_thread_id ", /* %fs:0x0024 */
142 " active_rpc_handle ", /* %fs:0x0028 */
143 " thread_local_storage ", /* %fs:0x002c */
144 " process_environment_block ", /* %fs:0x0030 */
145 " last_error_number " /* %fs:0x0034 */
148 static const int MAX_TIB32
=
149 sizeof (thread_information_32
) / sizeof (uint32_t);
150 static const int MAX_TIB64
=
151 sizeof (thread_information_64
) / sizeof (uint64_t);
152 static const int FULL_TIB_SIZE
= 0x1000;
154 static bool maint_display_all_tib
= false;
156 /* Define Thread Local Base pointer type. */
159 windows_get_tlb_type (struct gdbarch
*gdbarch
)
161 static struct gdbarch
*last_gdbarch
= NULL
;
162 static struct type
*last_tlb_type
= NULL
;
163 struct type
*dword_ptr_type
, *dword32_type
, *void_ptr_type
;
164 struct type
*peb_ldr_type
, *peb_ldr_ptr_type
;
165 struct type
*peb_type
, *peb_ptr_type
, *list_type
;
166 struct type
*module_list_ptr_type
;
167 struct type
*tib_type
, *seh_type
, *tib_ptr_type
, *seh_ptr_type
;
168 struct type
*word_type
, *wchar_type
, *wchar_ptr_type
;
169 struct type
*uni_str_type
, *rupp_type
, *rupp_ptr_type
;
171 /* Do not rebuild type if same gdbarch as last time. */
172 if (last_tlb_type
&& last_gdbarch
== gdbarch
)
173 return last_tlb_type
;
175 dword_ptr_type
= arch_integer_type (gdbarch
, gdbarch_ptr_bit (gdbarch
),
177 dword32_type
= arch_integer_type (gdbarch
, 32,
179 word_type
= arch_integer_type (gdbarch
, 16,
181 wchar_type
= arch_integer_type (gdbarch
, 16,
183 void_ptr_type
= lookup_pointer_type (builtin_type (gdbarch
)->builtin_void
);
184 wchar_ptr_type
= arch_pointer_type (gdbarch
, gdbarch_ptr_bit (gdbarch
),
189 list_type
= arch_composite_type (gdbarch
, NULL
, TYPE_CODE_STRUCT
);
190 TYPE_NAME (list_type
) = xstrdup ("list");
192 module_list_ptr_type
= void_ptr_type
;
194 append_composite_type_field (list_type
, "forward_list",
195 module_list_ptr_type
);
196 append_composite_type_field (list_type
, "backward_list",
197 module_list_ptr_type
);
199 /* Structured Exception Handler */
201 seh_type
= arch_composite_type (gdbarch
, NULL
, TYPE_CODE_STRUCT
);
202 TYPE_NAME (seh_type
) = xstrdup ("seh");
204 seh_ptr_type
= arch_type (gdbarch
, TYPE_CODE_PTR
,
205 TYPE_LENGTH (void_ptr_type
) * TARGET_CHAR_BIT
,
207 TYPE_TARGET_TYPE (seh_ptr_type
) = seh_type
;
209 append_composite_type_field (seh_type
, "next_seh", seh_ptr_type
);
210 append_composite_type_field (seh_type
, "handler",
211 builtin_type (gdbarch
)->builtin_func_ptr
);
213 /* struct _PEB_LDR_DATA */
214 peb_ldr_type
= arch_composite_type (gdbarch
, NULL
, TYPE_CODE_STRUCT
);
215 TYPE_NAME (peb_ldr_type
) = xstrdup ("peb_ldr_data");
217 append_composite_type_field (peb_ldr_type
, "length", dword32_type
);
218 append_composite_type_field (peb_ldr_type
, "initialized", dword32_type
);
219 append_composite_type_field (peb_ldr_type
, "ss_handle", void_ptr_type
);
220 append_composite_type_field (peb_ldr_type
, "in_load_order", list_type
);
221 append_composite_type_field (peb_ldr_type
, "in_memory_order", list_type
);
222 append_composite_type_field (peb_ldr_type
, "in_init_order", list_type
);
223 append_composite_type_field (peb_ldr_type
, "entry_in_progress",
225 peb_ldr_ptr_type
= arch_type (gdbarch
, TYPE_CODE_PTR
,
226 TYPE_LENGTH (void_ptr_type
) * TARGET_CHAR_BIT
,
228 TYPE_TARGET_TYPE (peb_ldr_ptr_type
) = peb_ldr_type
;
230 /* struct UNICODE_STRING */
231 uni_str_type
= arch_composite_type (gdbarch
, "unicode_string",
234 append_composite_type_field (uni_str_type
, "length", word_type
);
235 append_composite_type_field (uni_str_type
, "maximum_length", word_type
);
236 append_composite_type_field_aligned (uni_str_type
, "buffer",
238 TYPE_LENGTH (wchar_ptr_type
));
240 /* struct _RTL_USER_PROCESS_PARAMETERS */
241 rupp_type
= arch_composite_type (gdbarch
, "rtl_user_process_parameters",
244 append_composite_type_field (rupp_type
, "maximum_length", dword32_type
);
245 append_composite_type_field (rupp_type
, "length", dword32_type
);
246 append_composite_type_field (rupp_type
, "flags", dword32_type
);
247 append_composite_type_field (rupp_type
, "debug_flags", dword32_type
);
248 append_composite_type_field (rupp_type
, "console_handle", void_ptr_type
);
249 append_composite_type_field (rupp_type
, "console_flags", dword32_type
);
250 append_composite_type_field_aligned (rupp_type
, "standard_input",
252 TYPE_LENGTH (void_ptr_type
));
253 append_composite_type_field (rupp_type
, "standard_output", void_ptr_type
);
254 append_composite_type_field (rupp_type
, "standard_error", void_ptr_type
);
255 append_composite_type_field (rupp_type
, "current_directory", uni_str_type
);
256 append_composite_type_field (rupp_type
, "current_directory_handle",
258 append_composite_type_field (rupp_type
, "dll_path", uni_str_type
);
259 append_composite_type_field (rupp_type
, "image_path_name", uni_str_type
);
260 append_composite_type_field (rupp_type
, "command_line", uni_str_type
);
261 append_composite_type_field (rupp_type
, "environment", void_ptr_type
);
262 append_composite_type_field (rupp_type
, "starting_x", dword32_type
);
263 append_composite_type_field (rupp_type
, "starting_y", dword32_type
);
264 append_composite_type_field (rupp_type
, "count_x", dword32_type
);
265 append_composite_type_field (rupp_type
, "count_y", dword32_type
);
266 append_composite_type_field (rupp_type
, "count_chars_x", dword32_type
);
267 append_composite_type_field (rupp_type
, "count_chars_y", dword32_type
);
268 append_composite_type_field (rupp_type
, "fill_attribute", dword32_type
);
269 append_composite_type_field (rupp_type
, "window_flags", dword32_type
);
270 append_composite_type_field (rupp_type
, "show_window_flags", dword32_type
);
271 append_composite_type_field_aligned (rupp_type
, "window_title",
273 TYPE_LENGTH (void_ptr_type
));
274 append_composite_type_field (rupp_type
, "desktop_info", uni_str_type
);
275 append_composite_type_field (rupp_type
, "shell_info", uni_str_type
);
276 append_composite_type_field (rupp_type
, "runtime_data", uni_str_type
);
278 rupp_ptr_type
= arch_pointer_type (gdbarch
, gdbarch_ptr_bit (gdbarch
),
282 /* struct process environment block */
283 peb_type
= arch_composite_type (gdbarch
, NULL
, TYPE_CODE_STRUCT
);
284 TYPE_NAME (peb_type
) = xstrdup ("peb");
286 /* First bytes contain several flags. */
287 append_composite_type_field (peb_type
, "flags", dword_ptr_type
);
288 append_composite_type_field (peb_type
, "mutant", void_ptr_type
);
289 append_composite_type_field (peb_type
, "image_base_address", void_ptr_type
);
290 append_composite_type_field (peb_type
, "ldr", peb_ldr_ptr_type
);
291 append_composite_type_field (peb_type
, "process_parameters", rupp_ptr_type
);
292 append_composite_type_field (peb_type
, "sub_system_data", void_ptr_type
);
293 append_composite_type_field (peb_type
, "process_heap", void_ptr_type
);
294 append_composite_type_field (peb_type
, "fast_peb_lock", void_ptr_type
);
295 peb_ptr_type
= arch_type (gdbarch
, TYPE_CODE_PTR
,
296 TYPE_LENGTH (void_ptr_type
) * TARGET_CHAR_BIT
,
298 TYPE_TARGET_TYPE (peb_ptr_type
) = peb_type
;
301 /* struct thread information block */
302 tib_type
= arch_composite_type (gdbarch
, NULL
, TYPE_CODE_STRUCT
);
303 TYPE_NAME (tib_type
) = xstrdup ("tib");
305 /* uint32_t current_seh; %fs:0x0000 */
306 append_composite_type_field (tib_type
, "current_seh", seh_ptr_type
);
307 /* uint32_t current_top_of_stack; %fs:0x0004 */
308 append_composite_type_field (tib_type
, "current_top_of_stack",
310 /* uint32_t current_bottom_of_stack; %fs:0x0008 */
311 append_composite_type_field (tib_type
, "current_bottom_of_stack",
313 /* uint32_t sub_system_tib; %fs:0x000c */
314 append_composite_type_field (tib_type
, "sub_system_tib", void_ptr_type
);
316 /* uint32_t fiber_data; %fs:0x0010 */
317 append_composite_type_field (tib_type
, "fiber_data", void_ptr_type
);
318 /* uint32_t arbitrary_data_slot; %fs:0x0014 */
319 append_composite_type_field (tib_type
, "arbitrary_data_slot", void_ptr_type
);
320 /* uint32_t linear_address_tib; %fs:0x0018 */
321 append_composite_type_field (tib_type
, "linear_address_tib", void_ptr_type
);
322 /* uint32_t environment_pointer; %fs:0x001c */
323 append_composite_type_field (tib_type
, "environment_pointer", void_ptr_type
);
324 /* uint32_t process_id; %fs:0x0020 */
325 append_composite_type_field (tib_type
, "process_id", dword_ptr_type
);
326 /* uint32_t current_thread_id; %fs:0x0024 */
327 append_composite_type_field (tib_type
, "thread_id", dword_ptr_type
);
328 /* uint32_t active_rpc_handle; %fs:0x0028 */
329 append_composite_type_field (tib_type
, "active_rpc_handle", dword_ptr_type
);
330 /* uint32_t thread_local_storage; %fs:0x002c */
331 append_composite_type_field (tib_type
, "thread_local_storage",
333 /* uint32_t process_environment_block; %fs:0x0030 */
334 append_composite_type_field (tib_type
, "process_environment_block",
336 /* uint32_t last_error_number; %fs:0x0034 */
337 append_composite_type_field (tib_type
, "last_error_number", dword_ptr_type
);
339 tib_ptr_type
= arch_type (gdbarch
, TYPE_CODE_PTR
,
340 TYPE_LENGTH (void_ptr_type
) * TARGET_CHAR_BIT
,
342 TYPE_TARGET_TYPE (tib_ptr_type
) = tib_type
;
344 last_tlb_type
= tib_ptr_type
;
345 last_gdbarch
= gdbarch
;
350 /* The $_tlb convenience variable is a bit special. We don't know
351 for sure the type of the value until we actually have a chance to
352 fetch the data. The type can change depending on gdbarch, so it is
353 also dependent on which thread you have selected. */
355 /* This function implements the lval_computed support for reading a
359 tlb_value_read (struct value
*val
)
362 struct type
*type
= check_typedef (value_type (val
));
364 if (!target_get_tib_address (inferior_ptid
, &tlb
))
365 error (_("Unable to read tlb"));
366 store_typed_address (value_contents_raw (val
), type
, tlb
);
369 /* This function implements the lval_computed support for writing a
373 tlb_value_write (struct value
*v
, struct value
*fromval
)
375 error (_("Impossible to change the Thread Local Base"));
378 static const struct lval_funcs tlb_value_funcs
=
385 /* Return a new value with the correct type for the tlb object of
386 the current thread using architecture GDBARCH. Return a void value
387 if there's no object available. */
389 static struct value
*
390 tlb_make_value (struct gdbarch
*gdbarch
, struct internalvar
*var
, void *ignore
)
392 if (target_has_stack
&& inferior_ptid
!= null_ptid
)
394 struct type
*type
= windows_get_tlb_type (gdbarch
);
395 return allocate_computed_value (type
, &tlb_value_funcs
, NULL
);
398 return allocate_value (builtin_type (gdbarch
)->builtin_void
);
402 /* Display thread information block of a given thread. */
405 display_one_tib (ptid_t ptid
)
407 gdb_byte
*tib
= NULL
;
409 CORE_ADDR thread_local_base
;
410 ULONGEST i
, val
, max
, max_name
, size
, tib_size
;
411 ULONGEST sizeof_ptr
= gdbarch_ptr_bit (target_gdbarch ());
412 enum bfd_endian byte_order
= gdbarch_byte_order (target_gdbarch ());
414 if (sizeof_ptr
== 64)
416 size
= sizeof (uint64_t);
417 tib_size
= sizeof (thread_information_64
);
422 size
= sizeof (uint32_t);
423 tib_size
= sizeof (thread_information_32
);
429 if (maint_display_all_tib
)
431 tib_size
= FULL_TIB_SIZE
;
432 max
= tib_size
/ size
;
435 tib
= (gdb_byte
*) alloca (tib_size
);
437 if (target_get_tib_address (ptid
, &thread_local_base
) == 0)
439 printf_filtered (_("Unable to get thread local base for %s\n"),
440 target_pid_to_str (ptid
).c_str ());
444 if (target_read (current_top_target (), TARGET_OBJECT_MEMORY
,
445 NULL
, tib
, thread_local_base
, tib_size
) != tib_size
)
447 printf_filtered (_("Unable to read thread information "
448 "block for %s at address %s\n"),
449 target_pid_to_str (ptid
).c_str (),
450 paddress (target_gdbarch (), thread_local_base
));
454 printf_filtered (_("Thread Information Block %s at %s\n"),
455 target_pid_to_str (ptid
).c_str (),
456 paddress (target_gdbarch (), thread_local_base
));
458 index
= (gdb_byte
*) tib
;
460 /* All fields have the size of a pointer, this allows to iterate
461 using the same for loop for both layouts. */
462 for (i
= 0; i
< max
; i
++)
464 val
= extract_unsigned_integer (index
, size
, byte_order
);
466 printf_filtered (_("%s is 0x%s\n"), TIB_NAME
[i
], phex (val
, size
));
468 printf_filtered (_("TIB[0x%s] is 0x%s\n"), phex (i
* size
, 2),
475 /* Display thread information block of the current thread. */
478 display_tib (const char * args
, int from_tty
)
480 if (inferior_ptid
!= null_ptid
)
481 display_one_tib (inferior_ptid
);
485 windows_xfer_shared_library (const char* so_name
, CORE_ADDR load_addr
,
486 CORE_ADDR
*text_offset_cached
,
487 struct gdbarch
*gdbarch
, struct obstack
*obstack
)
489 CORE_ADDR text_offset
= text_offset_cached
? *text_offset_cached
: 0;
491 obstack_grow_str (obstack
, "<library name=\"");
492 std::string p
= xml_escape_text (so_name
);
493 obstack_grow_str (obstack
, p
.c_str ());
494 obstack_grow_str (obstack
, "\"><segment address=\"");
498 gdb_bfd_ref_ptr
dll (gdb_bfd_open (so_name
, gnutarget
, -1));
499 /* The following calls are OK even if dll is NULL.
500 The default value 0x1000 is returned by pe_text_section_offset
502 text_offset
= pe_text_section_offset (dll
.get ());
503 if (text_offset_cached
)
504 *text_offset_cached
= text_offset
;
507 obstack_grow_str (obstack
, paddress (gdbarch
, load_addr
+ text_offset
));
508 obstack_grow_str (obstack
, "\"/></library>");
511 /* Implement the "iterate_over_objfiles_in_search_order" gdbarch
512 method. It searches all objfiles, starting with CURRENT_OBJFILE
515 On Windows, the system behaves a little differently when two
516 objfiles each define a global symbol using the same name, compared
517 to other platforms such as GNU/Linux for instance. On GNU/Linux,
518 all instances of the symbol effectively get merged into a single
519 one, but on Windows, they remain distinct.
521 As a result, it usually makes sense to start global symbol searches
522 with the current objfile before expanding it to all other objfiles.
523 This helps for instance when a user debugs some code in a DLL that
524 refers to a global variable defined inside that DLL. When trying
525 to print the value of that global variable, it would be unhelpful
526 to print the value of another global variable defined with the same
527 name, but in a different DLL. */
530 windows_iterate_over_objfiles_in_search_order
531 (struct gdbarch
*gdbarch
,
532 iterate_over_objfiles_in_search_order_cb_ftype
*cb
,
533 void *cb_data
, struct objfile
*current_objfile
)
539 stop
= cb (current_objfile
, cb_data
);
544 for (objfile
*objfile
: current_program_space
->objfiles ())
546 if (objfile
!= current_objfile
)
548 stop
= cb (objfile
, cb_data
);
556 show_maint_show_all_tib (struct ui_file
*file
, int from_tty
,
557 struct cmd_list_element
*c
, const char *value
)
559 fprintf_filtered (file
, _("Show all non-zero elements of "
560 "Thread Information Block is %s.\n"), value
);
564 info_w32_command (const char *args
, int from_tty
)
566 help_list (info_w32_cmdlist
, "info w32 ", class_info
, gdb_stdout
);
569 static int w32_prefix_command_valid
= 0;
571 init_w32_command_list (void)
573 if (!w32_prefix_command_valid
)
575 add_prefix_cmd ("w32", class_info
, info_w32_command
,
576 _("Print information specific to Win32 debugging."),
577 &info_w32_cmdlist
, "info w32 ", 0, &infolist
);
578 w32_prefix_command_valid
= 1;
582 /* Implementation of `gdbarch_gdb_signal_to_target'. */
585 windows_gdb_signal_to_target (struct gdbarch
*gdbarch
, enum gdb_signal signal
)
592 return WINDOWS_SIGHUP
;
594 return WINDOWS_SIGINT
;
595 case GDB_SIGNAL_QUIT
:
596 return WINDOWS_SIGQUIT
;
598 return WINDOWS_SIGILL
;
599 case GDB_SIGNAL_TRAP
:
600 return WINDOWS_SIGTRAP
;
601 case GDB_SIGNAL_ABRT
:
602 return WINDOWS_SIGABRT
;
604 return WINDOWS_SIGEMT
;
606 return WINDOWS_SIGFPE
;
607 case GDB_SIGNAL_KILL
:
608 return WINDOWS_SIGKILL
;
610 return WINDOWS_SIGBUS
;
611 case GDB_SIGNAL_SEGV
:
612 return WINDOWS_SIGSEGV
;
614 return WINDOWS_SIGSYS
;
615 case GDB_SIGNAL_PIPE
:
616 return WINDOWS_SIGPIPE
;
617 case GDB_SIGNAL_ALRM
:
618 return WINDOWS_SIGALRM
;
619 case GDB_SIGNAL_TERM
:
620 return WINDOWS_SIGTERM
;
623 return WINDOWS_SIGURG
;
624 case GDB_SIGNAL_STOP
:
625 return WINDOWS_SIGSTOP
;
626 case GDB_SIGNAL_TSTP
:
627 return WINDOWS_SIGTSTP
;
628 case GDB_SIGNAL_CONT
:
629 return WINDOWS_SIGCONT
;
630 case GDB_SIGNAL_CHLD
:
631 return WINDOWS_SIGCHLD
;
632 case GDB_SIGNAL_TTIN
:
633 return WINDOWS_SIGTTIN
;
634 case GDB_SIGNAL_TTOU
:
635 return WINDOWS_SIGTTOU
;
637 return WINDOWS_SIGIO
;
638 case GDB_SIGNAL_XCPU
:
639 return WINDOWS_SIGXCPU
;
640 case GDB_SIGNAL_XFSZ
:
641 return WINDOWS_SIGXFSZ
;
642 case GDB_SIGNAL_VTALRM
:
643 return WINDOWS_SIGVTALRM
;
644 case GDB_SIGNAL_PROF
:
645 return WINDOWS_SIGPROF
;
646 case GDB_SIGNAL_WINCH
:
647 return WINDOWS_SIGWINCH
;
649 return WINDOWS_SIGLOST
;
650 case GDB_SIGNAL_USR1
:
651 return WINDOWS_SIGUSR1
;
652 case GDB_SIGNAL_USR2
:
653 return WINDOWS_SIGUSR2
;
654 #endif /* __CYGWIN__ */
659 /* To be called from the various GDB_OSABI_CYGWIN handlers for the
660 various Windows architectures and machine types. */
663 windows_init_abi (struct gdbarch_info info
, struct gdbarch
*gdbarch
)
665 set_gdbarch_wchar_bit (gdbarch
, 16);
666 set_gdbarch_wchar_signed (gdbarch
, 0);
668 /* Canonical paths on this target look like
669 `c:\Program Files\Foo App\mydll.dll', for example. */
670 set_gdbarch_has_dos_based_file_system (gdbarch
, 1);
672 set_gdbarch_iterate_over_objfiles_in_search_order
673 (gdbarch
, windows_iterate_over_objfiles_in_search_order
);
675 set_gdbarch_gdb_signal_to_target (gdbarch
, windows_gdb_signal_to_target
);
677 set_solib_ops (gdbarch
, &solib_target_so_ops
);
680 /* Implementation of `tlb' variable. */
682 static const struct internalvar_funcs tlb_funcs
=
689 void _initialize_windows_tdep ();
691 _initialize_windows_tdep ()
693 init_w32_command_list ();
694 add_cmd ("thread-information-block", class_info
, display_tib
,
695 _("Display thread information block."),
697 add_alias_cmd ("tib", "thread-information-block", class_info
, 1,
700 add_setshow_boolean_cmd ("show-all-tib", class_maintenance
,
701 &maint_display_all_tib
, _("\
702 Set whether to display all non-zero fields of thread information block."), _("\
703 Show whether to display all non-zero fields of thread information block."), _("\
704 Use \"on\" to enable, \"off\" to disable.\n\
705 If enabled, all non-zero fields of thread information block are displayed,\n\
706 even if their meaning is unknown."),
708 show_maint_show_all_tib
,
709 &maintenance_set_cmdlist
,
710 &maintenance_show_cmdlist
);
712 /* Explicitly create without lookup, since that tries to create a
713 value with a void typed value, and when we get here, gdbarch
714 isn't initialized yet. At this point, we're quite sure there
715 isn't another convenience variable of the same name. */
716 create_internalvar_type_lazy ("_tlb", &tlb_funcs
, NULL
);