X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fi386-cygwin-tdep.c;h=25c3cfcbb9882ea37100eccb9e74ef96e91509e5;hb=228c8f4be0c428369ec6b68e25696863d1e62ed7;hp=47c7bde65a0d019bb8ac87b1ceb37c47cea0c57e;hpb=6d3d12ebef6fa7dd6bc8c34fbc5e440ac8d0a8c6;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/i386-cygwin-tdep.c b/gdb/i386-cygwin-tdep.c index 47c7bde65a..25c3cfcbb9 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-2014 Free Software Foundation, Inc. + Copyright (C) 2003-2019 Free Software Foundation, Inc. This file is part of GDB. @@ -88,20 +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) -{ - if (strcmp (sect_name, ".reg") == 0 - && sect_size == I386_WINDOWS_SIZEOF_GREGSET) - return &i386_gregset; - - return NULL; -} - struct cpms_data { struct gdbarch *gdbarch; @@ -112,7 +98,7 @@ struct cpms_data static void core_process_module_section (bfd *abfd, asection *sect, void *obj) { - struct cpms_data *data = obj; + struct cpms_data *data = (struct cpms_data *) obj; enum bfd_endian byte_order = gdbarch_byte_order (data->gdbarch); char *module_name; @@ -121,17 +107,17 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) 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); + buf = (gdb_byte *) xmalloc (bfd_section_size (sect) + 1); if (!buf) { printf_unfiltered ("memory allocation failed for %s\n", sect->name); goto out; } if (!bfd_get_section_contents (abfd, sect, - buf, 0, bfd_get_section_size (sect))) + buf, 0, bfd_section_size (sect))) goto out; @@ -144,7 +130,7 @@ core_process_module_section (bfd *abfd, asection *sect, void *obj) module_name_size = extract_unsigned_integer (buf + 8, 4, byte_order); - if (12 + module_name_size > bfd_get_section_size (sect)) + if (12 + module_name_size > bfd_section_size (sect)) goto out; module_name = (char *) buf + 12; @@ -177,7 +163,7 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, &data); obstack_grow_str0 (&obstack, "\n"); - buf = obstack_finish (&obstack); + buf = (const char *) obstack_finish (&obstack); len_avail = strlen (buf); if (offset >= len_avail) return 0; @@ -192,16 +178,11 @@ windows_core_xfer_shared_libraries (struct gdbarch *gdbarch, /* This is how we want PTIDs from core files to be printed. */ -static char * +static std::string 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; - } + if (ptid.lwp () != 0) + return string_printf ("Thread 0x%lx", ptid.lwp ()); return normal_pid_to_str (ptid); } @@ -235,9 +216,9 @@ 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; + 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); @@ -248,7 +229,7 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch) static enum gdb_osabi i386_cygwin_osabi_sniffer (bfd *abfd) { - char *target_name = bfd_get_target (abfd); + const char *target_name = bfd_get_target (abfd); if (strcmp (target_name, "pei-i386") == 0) return GDB_OSABI_CYGWIN; @@ -259,16 +240,13 @@ i386_cygwin_osabi_sniffer (bfd *abfd) { asection *section = bfd_get_section_by_name (abfd, ".reg"); if (section - && bfd_section_size (abfd, section) == I386_WINDOWS_SIZEOF_GREGSET) + && bfd_section_size (section) == I386_WINDOWS_SIZEOF_GREGSET) return GDB_OSABI_CYGWIN; } return GDB_OSABI_UNKNOWN; } -/* Provide a prototype to silence -Wmissing-prototypes. */ -void _initialize_i386_cygwin_tdep (void); - void _initialize_i386_cygwin_tdep (void) {