2008-03-25 Pedro Alves <pedro@codesourcery.com>
[deliverable/binutils-gdb.git] / gdb / i386-cygwin-tdep.c
index 0185a0a36b3899b9b05352badd7dd4fa8a285718..3a8d6eeac36490ef504e0c83d0c7dae328a0830a 100644 (file)
@@ -1,6 +1,6 @@
 /* Target-dependent code for Cygwin running on i386's, for GDB.
 
-   Copyright (C) 2003, 2007 Free Software Foundation, Inc.
+   Copyright (C) 2003, 2007, 2008 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
 #include "osabi.h"
 #include "gdb_string.h"
 #include "i386-tdep.h"
+#include "i386-cygwin-tdep.h"
 #include "regset.h"
 #include "gdb_obstack.h"
 #include "xml-support.h"
 #include "gdbcore.h"
+#include "solib.h"
+#include "solib-target.h"
 
 /* Core file support.  */
 
@@ -108,7 +111,7 @@ i386_win32_regset_from_core_section (struct gdbarch *gdbarch,
   return NULL;
 }
 
-static void
+void
 win32_xfer_shared_library (const char* so_name, CORE_ADDR load_addr,
                           struct obstack *obstack)
 {
@@ -230,6 +233,8 @@ i386_cygwin_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   tdep->gregset_num_regs = ARRAY_SIZE (i386_win32_gregset_reg_offset);
   tdep->sizeof_gregset = I386_WIN32_SIZEOF_GREGSET;
 
+  set_solib_ops (gdbarch, &solib_target_so_ops);
+
   /* Core file support.  */
   set_gdbarch_regset_from_core_section
     (gdbarch, i386_win32_regset_from_core_section);
@@ -247,9 +252,15 @@ i386_cygwin_osabi_sniffer (bfd *abfd)
   if (strcmp (target_name, "pei-i386") == 0)
     return GDB_OSABI_CYGWIN;
 
-  /* Cygwin uses elf core dumps.  */
+  /* Cygwin uses elf core dumps.  Do not claim all ELF executables,
+     check whether there is a .reg section of proper size.  */
   if (strcmp (target_name, "elf32-i386") == 0)
-    return GDB_OSABI_CYGWIN;
+    {
+      asection *section = bfd_get_section_by_name (abfd, ".reg");
+      if (section
+         && bfd_section_size (abfd, section) == I386_WIN32_SIZEOF_GREGSET)
+       return GDB_OSABI_CYGWIN;
+    }
 
   return GDB_OSABI_UNKNOWN;
 }
This page took 0.026016 seconds and 4 git commands to generate.