This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH] Remove support for "set osabi SVR4"?


(Moving to a separate thread.)

Anyone know whether "set osabi SVR4" serves any use nowadays?

It seems to me that the only way to activate the SVR4-specific code in
i386-tdep.c, is to manually do "set osabi SVR4".  At least according
to a grep by GDB_OSABI_SVR4:

 defs.h:  GDB_OSABI_SVR4,
 i386-tdep.c:  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SVR4,

I.e., unlike most other ports, there's no osabi sniffer to auto-detect
SVR4.

Grepping for i386_svr4_init_abi, we see that Solaris is the only other
SVR4-like port that reuses the function:

 i386-tdep.c:4474:i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 i386-tdep.c:9093:                         i386_svr4_init_abi);
 i386-tdep.h:433:extern void i386_svr4_init_abi (struct gdbarch_info, struct gdbarch *);
 i386-sol2-tdep.c:109:  i386_svr4_init_abi (info, gdbarch);

So maybe we should drop GDB_OSABI_SVR4, and inline/move the i386_svr4_init_abi
function to i386-sol2-tdep.c?

Judging from gdb/configure.host, I think that any host that might have
needed this in the past has been obsoleted/removed.  E.g.:

 ...
 i[34567]86-*-sysv4.2* | \
 i[34567]86-*-sysv4* | \
 i[34567]86-*-sysv5* | \
 ...
 i[34567]86-*-sysv* | \
 i[34567]86-*-isc* | \
 ...
    echo "*** Configuration $host is obsolete." >&2
    echo "*** Support has been REMOVED." >&2


Removing this in turn results in a small cascade of clean ups.
i386_sol2_init_abi actually overrides most of what i386_svr4_init_abi
was doing.  Also, SVR4 is the only user of
tdep->sc_pc_offset/tdep->sc_sp_offset in i386-tdep.c, so that could go
away too.  (i386_sol2_init_abi sets tdep->sc_reg_offset.)
---
 gdb/defs.h           |  1 -
 gdb/i386-sol2-tdep.c |  7 +++--
 gdb/i386-tdep.c      | 84 +++-------------------------------------------------
 gdb/i386-tdep.h      |  5 ----
 gdb/osabi.c          |  1 -
 5 files changed, 9 insertions(+), 89 deletions(-)

diff --git a/gdb/defs.h b/gdb/defs.h
index f689ec5..567232f 100644
--- a/gdb/defs.h
+++ b/gdb/defs.h
@@ -571,7 +571,6 @@ enum gdb_osabi
 
   GDB_OSABI_UNKNOWN = 0,	/* keep this zero */
 
-  GDB_OSABI_SVR4,
   GDB_OSABI_HURD,
   GDB_OSABI_SOLARIS,
   GDB_OSABI_LINUX,
diff --git a/gdb/i386-sol2-tdep.c b/gdb/i386-sol2-tdep.c
index 356d56e..72130a5 100644
--- a/gdb/i386-sol2-tdep.c
+++ b/gdb/i386-sol2-tdep.c
@@ -105,8 +105,10 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 {
   struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
 
-  /* Solaris is SVR4-based.  */
-  i386_svr4_init_abi (info, gdbarch);
+  /* Solaris uses ELF.  */
+  i386_elf_init_abi (info, gdbarch);
+
+  tdep->jb_pc_offset = 20;
 
   /* The SunPRO compiler puts out 0 instead of the address in N_SO symbols,
      and for SunPRO 3.0, N_FUN symbols too.  */
@@ -130,6 +132,7 @@ i386_sol2_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
   tdep->sc_num_regs = tdep->gregset_num_regs;
 
   /* Solaris has SVR4-style shared libraries.  */
+  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
   set_gdbarch_skip_solib_resolver (gdbarch, sol2_skip_solib_resolver);
   set_solib_svr4_fetch_link_map_offsets
     (gdbarch, svr4_ilp32_fetch_link_map_offsets);
diff --git a/gdb/i386-tdep.c b/gdb/i386-tdep.c
index fe68486..bdbea77 100644
--- a/gdb/i386-tdep.c
+++ b/gdb/i386-tdep.c
@@ -2448,21 +2448,12 @@ i386_sigtramp_frame_cache (struct frame_info *this_frame, void **this_cache)
       cache->base = extract_unsigned_integer (buf, 4, byte_order) - 4;
 
       addr = tdep->sigcontext_addr (this_frame);
-      if (tdep->sc_reg_offset)
-	{
-	  int i;
 
-	  gdb_assert (tdep->sc_num_regs <= I386_NUM_SAVED_REGS);
+      gdb_assert (tdep->sc_num_regs <= I386_NUM_SAVED_REGS);
 
-	  for (i = 0; i < tdep->sc_num_regs; i++)
-	    if (tdep->sc_reg_offset[i] != -1)
-	      cache->saved_regs[i] = addr + tdep->sc_reg_offset[i];
-	}
-      else
-	{
-	  cache->saved_regs[I386_EIP_REGNUM] = addr + tdep->sc_pc_offset;
-	  cache->saved_regs[I386_ESP_REGNUM] = addr + tdep->sc_sp_offset;
-	}
+      for (int i = 0; i < tdep->sc_num_regs; i++)
+	if (tdep->sc_reg_offset[i] != -1)
+	  cache->saved_regs[i] = addr + tdep->sc_reg_offset[i];
 
       cache->base_p = 1;
     }
@@ -4015,47 +4006,6 @@ i386_print_insn (bfd_vma pc, struct disassemble_info *info)
 }
 
 
-/* There are a few i386 architecture variants that differ only
-   slightly from the generic i386 target.  For now, we don't give them
-   their own source file, but include them here.  As a consequence,
-   they'll always be included.  */
-
-/* System V Release 4 (SVR4).  */
-
-/* Return whether THIS_FRAME corresponds to a SVR4 sigtramp
-   routine.  */
-
-static int
-i386_svr4_sigtramp_p (struct frame_info *this_frame)
-{
-  CORE_ADDR pc = get_frame_pc (this_frame);
-  const char *name;
-
-  /* The origin of these symbols is currently unknown.  */
-  find_pc_partial_function (pc, &name, NULL, NULL);
-  return (name && (strcmp ("_sigreturn", name) == 0
-		   || strcmp ("sigvechandler", name) == 0));
-}
-
-/* Assuming THIS_FRAME is for a SVR4 sigtramp routine, return the
-   address of the associated sigcontext (ucontext) structure.  */
-
-static CORE_ADDR
-i386_svr4_sigcontext_addr (struct frame_info *this_frame)
-{
-  struct gdbarch *gdbarch = get_frame_arch (this_frame);
-  enum bfd_endian byte_order = gdbarch_byte_order (gdbarch);
-  gdb_byte buf[4];
-  CORE_ADDR sp;
-
-  get_frame_register (this_frame, I386_ESP_REGNUM, buf);
-  sp = extract_unsigned_integer (buf, 4, byte_order);
-
-  return read_memory_unsigned_integer (sp + 8, 4, byte_order);
-}
-
-
-
 /* Implementation of `gdbarch_stap_is_single_operand', as defined in
    gdbarch.h.  */
 
@@ -4466,27 +4416,6 @@ i386_elf_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
 					i386_stap_parse_special_token);
 }
 
-/* System V Release 4 (SVR4).  */
-
-void
-i386_svr4_init_abi (struct gdbarch_info info, struct gdbarch *gdbarch)
-{
-  struct gdbarch_tdep *tdep = gdbarch_tdep (gdbarch);
-
-  /* System V Release 4 uses ELF.  */
-  i386_elf_init_abi (info, gdbarch);
-
-  /* System V Release 4 has shared libraries.  */
-  set_gdbarch_skip_trampoline_code (gdbarch, find_solib_trampoline_target);
-
-  tdep->sigtramp_p = i386_svr4_sigtramp_p;
-  tdep->sigcontext_addr = i386_svr4_sigcontext_addr;
-  tdep->sc_pc_offset = 36 + 14 * 4;
-  tdep->sc_sp_offset = 36 + 17 * 4;
-
-  tdep->jb_pc_offset = 20;
-}
-
 
 
 /* i386 register groups.  In addition to the normal groups, add "mmx"
@@ -8401,8 +8330,6 @@ i386_gdbarch_init (struct gdbarch_info info, struct gdbarch_list *arches)
   tdep->sigtramp_p = i386_sigtramp_p;
   tdep->sigcontext_addr = NULL;
   tdep->sc_reg_offset = NULL;
-  tdep->sc_pc_offset = -1;
-  tdep->sc_sp_offset = -1;
 
   tdep->xsave_xcr0_offset = -1;
 
@@ -9048,9 +8975,6 @@ Show Intel Memory Protection Extensions specific variables."),
  in the bound table.",
 	   &mpx_set_cmdlist);
 
-  gdbarch_register_osabi (bfd_arch_i386, 0, GDB_OSABI_SVR4,
-			  i386_svr4_init_abi);
-
   /* Initialize the i386-specific register groups.  */
   i386_init_reggroups ();
 
diff --git a/gdb/i386-tdep.h b/gdb/i386-tdep.h
index 1ce89fc..9d116de 100644
--- a/gdb/i386-tdep.h
+++ b/gdb/i386-tdep.h
@@ -224,11 +224,6 @@ struct gdbarch_tdep
   int *sc_reg_offset;
   int sc_num_regs;
 
-  /* Offset of saved PC and SP in `struct sigcontext'.  Usage of these
-     is deprecated, please use `sc_reg_offset' instead.  */
-  int sc_pc_offset;
-  int sc_sp_offset;
-
   /* ISA-specific data types.  */
   struct type *i386_mmx_type;
   struct type *i386_ymm_type;
diff --git a/gdb/osabi.c b/gdb/osabi.c
index 84fa9c0..4a3ca1d 100644
--- a/gdb/osabi.c
+++ b/gdb/osabi.c
@@ -60,7 +60,6 @@ static const struct osabi_names gdb_osabi_names[] =
 {
   { "none", NULL },
 
-  { "SVR4", NULL },
   { "GNU/Hurd", NULL },
   { "Solaris", NULL },
   { "GNU/Linux", "linux(-gnu)?" },
-- 
2.5.5


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]