X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fi386-cygwin-tdep.c;h=79ff478fa9532bba8419398b88d7f478fd90e1ee;hb=791bb1f4a6310cd7f894e370607dfc05c9cb0727;hp=f0d8d4b904c718ff7e9cb1b54cf1bf0be0e1cc1e;hpb=4c38e0a4fcb69f8586d8db0b9cdb8dbab5980811;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index f0d8d4b904..79ff478fa9 100644 --- a/gdb/i386-cygwin-tdep.c +++ b/gdb/i386-cygwin-tdep.c @@ -1,6 +1,6 @@ /* Target-dependent code for Cygwin running on i386's, for GDB. - Copyright (C) 2003, 2007, 2008, 2009, 2010 Free Software Foundation, Inc. + Copyright (C) 2003-2015 Free Software Foundation, Inc. This file is part of GDB. @@ -19,15 +19,13 @@ #include "defs.h" #include "osabi.h" -#include "gdb_string.h" #include "i386-tdep.h" #include "windows-tdep.h" #include "regset.h" #include "gdb_obstack.h" #include "xml-support.h" #include "gdbcore.h" -#include "solib.h" -#include "solib-target.h" +#include "inferior.h" /* Core file support. */ @@ -90,27 +88,6 @@ static int i386_windows_gregset_reg_offset[] = #define I386_WINDOWS_SIZEOF_GREGSET 716 -/* Return the appropriate register set for the core section identified - by SECT_NAME and SECT_SIZE. */ - -static const struct regset * -i386_windows_regset_from_core_section (struct gdbarch *gdbarch, - const char *sect_name, size_t sect_size) -{ - struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); - - if (strcmp (sect_name, ".reg") == 0 - && sect_size == I386_WINDOWS_SIZEOF_GREGSET) - { - if (tdep->gregset == NULL) - tdep->gregset = regset_alloc (gdbarch, i386_supply_gregset, - i386_collect_gregset); - return tdep->gregset; - } - - return NULL; -} - struct cpms_data { struct gdbarch *gdbarch; @@ -128,9 +105,9 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) size_t module_name_size; CORE_ADDR base_addr; - char *buf = NULL; + gdb_byte *buf = NULL; - if (strncmp (sect->name, ".module", 7) != 0) + if (!startswith (sect->name, ".module")) return; buf = xmalloc (bfd_get_section_size (sect) + 1); @@ -153,9 +130,9 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) module_name_size = extract_unsigned_integer (buf + 8, 4, byte_order); - module_name = buf + 12; - if (module_name - buf + module_name_size > bfd_get_section_size (sect)) + if (12 + module_name_size > bfd_get_section_size (sect)) goto out; + module_name = (char *) buf + 12; /* The first module is the .exe itself. */ if (data->module_count != 0) @@ -169,14 +146,14 @@ out: return; } -static LONGEST +static ULONGEST windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, gdb_byte *readbuf, - ULONGEST offset, LONGEST len) + ULONGEST offset, ULONGEST len) { struct obstack obstack; const char *buf; - LONGEST len_avail; + ULONGEST len_avail; struct cpms_data data = { gdbarch, &obstack, 0 }; obstack_init (&obstack); @@ -199,17 +176,41 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, return len; } +/* This is how we want PTIDs from core files to be printed. */ + +static char * +i386_windows_core_pid_to_str (struct gdbarch *gdbarch, ptid_t ptid) +{ + static char buf[80]; + + if (ptid_get_lwp (ptid) != 0) + { + snprintf (buf, sizeof (buf), "Thread 0x%lx", ptid_get_lwp (ptid)); + return buf; + } + + return normal_pid_to_str (ptid); +} + static CORE_ADDR i386_cygwin_skip_trampoline_code (struct frame_info *frame, CORE_ADDR pc) { return i386_pe_skip_trampoline_code (frame, pc, NULL); } +static const char * +i386_cygwin_auto_wide_charset (void) +{ + return "UTF-16"; +} + static void i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) { struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch); + windows_init_abi (info, gdbarch); + set_gdbarch_skip_trampoline_code (gdbarch, i386_cygwin_skip_trampoline_code); set_gdbarch_skip_main_prologue (gdbarch, i386_skip_main_prologue); @@ -220,13 +221,14 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) tdep->gregset_num_regs = ARRAY_SIZE (i386_windows_gregset_reg_offset); tdep->sizeof_gregset = I386_WINDOWS_SIZEOF_GREGSET; - set_solib_ops (gdbarch, &solib_target_so_ops); + tdep->sizeof_fpregset = 0; /* Core file support. */ - set_gdbarch_regset_from_core_section - (gdbarch, i386_windows_regset_from_core_section); set_gdbarch_core_xfer_shared_libraries (gdbarch, windows_core_xfer_shared_libraries); + set_gdbarch_core_pid_to_str (gdbarch, i386_windows_core_pid_to_str); + + set_gdbarch_auto_wide_charset (gdbarch, i386_cygwin_auto_wide_charset); } static enum gdb_osabi @@ -234,8 +236,6 @@ i386_cygwin_osabi_sniffer (bfd *abfd) { char *target_name = bfd_get_target (abfd); - /* Interix also uses pei-i386. - We need a way to distinguish between the two. */ if (strcmp (target_name, "pei-i386") == 0) return GDB_OSABI_CYGWIN;