2003-05-23 Andrew Cagney <cagney@redhat.com>
[deliverable/binutils-gdb.git] / gdb / i386-sol2-tdep.c
index 714f5db9b36646b6fe3e0acdf00bc66a966d1a5a..a52b18850fba87e235e138ae33c000ec64b15142 100644 (file)
@@ -1,5 +1,5 @@
 /* Target-dependent code for Solaris x86.
-   Copyright 2002 Free Software Foundation, Inc.
+   Copyright 2002, 2003 Free Software Foundation, Inc.
 
    This file is part of GDB.
 
@@ -19,6 +19,8 @@
    Boston, MA 02111-1307, USA.  */
 
 #include "defs.h"
+#include "value.h"
+#include "osabi.h"
 
 #include "i386-tdep.h"
 
@@ -43,17 +45,33 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   /* Signal trampolines are different from SVR4, in fact they're
      rather similar to BSD.  */
   set_gdbarch_pc_in_sigtramp (gdbarch, i386_sol2_pc_in_sigtramp);
-  tdep->sigtramp_saved_pc = i386bsd_sigtramp_saved_pc;
+  tdep->sigcontext_addr = i386bsd_sigcontext_addr;
   tdep->sc_pc_offset = 36 + 14 * 4;
+  tdep->sc_sp_offset = 36 + 17 * 4;
 }
 \f
 
+static enum gdb_osabi
+i386_sol2_osabi_sniffer (bfd *abfd)
+{
+  /* If we have a section named .SUNW_version, then it is almost
+     certainly Solaris 2.  */
+  if (bfd_get_section_by_name (abfd, ".SUNW_version"))
+    return GDB_OSABI_SOLARIS;
+
+  return GDB_OSABI_UNKNOWN;
+}
+
 /* Provide a prototype to silence -Wmissing-prototypes.  */
 void _initialize_i386_sol2_tdep (void);
 
 void
 _initialize_i386_sol2_tdep (void)
 {
-  gdbarch_register_osabi (bfd_arch_i386, GDB_OSABI_SOLARIS,
+  /* Register an ELF OS ABI sniffer for Solaris 2 binaries.  */
+  gdbarch_register_osabi_sniffer (bfd_arch_i386, bfd_target_elf_flavour,
+                                 i386_sol2_osabi_sniffer);
+
+  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SOLARIS,
                          i386_sol2_init_abi);
 }
This page took 0.028542 seconds and 4 git commands to generate.