Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* RFA: ia64 patch required after recent osabi changes
@ 2003-11-05  0:04 J. Johnston
  2003-11-05  2:20 ` Kevin Buettner
  0 siblings, 1 reply; 5+ messages in thread
From: J. Johnston @ 2003-11-05  0:04 UTC (permalink / raw)
  To: gdb-patches, kevinb; +Cc: marcel

[-- Attachment #1: Type: text/plain, Size: 1476 bytes --]

The latest changes by Mark K. have caused regressions in the ia64 signal handler 
back-tracing.  What happens is that the ia64_gdbarch_init function is called 
without a bfd to calculate the os_ident field.  The os_ident field is later used 
to set up the gdbarch_tdep structure which contains the sigcontext register 
address function address.  We end up with an os_ident of -1 and don't set up the 
sigcontext register address function pointing to the ia64-linux-tdep.c function. 
  This kills backtracing across signal handlers because we can't figure out the 
previous ip value without fishing it out of the sigcontext area.

After discussing this with Andrew, it appears the ia64 code is a bit old.  The 
info.osabi field is set properly so we don't have to calculate the os_ident. 
This patch removes the gdbarch_tdep os_ident field and uses instead the 
info.osabi field in ia64_gdbarch_init.  It also copies code from i386 which 
looks for a gdbarch candidate.  This code is much more efficient than the old code.

With this patch, the ia64 signal backtracing works again and there are no 
regressions in the testsuite.

Ok to commit?

-- Jeff J.

2003-11-04  Jeff Johnston  <jjohnstn@redhat.com>

	* ia64-tdep.c (struct gdbarch_tdep): Remove os_ident field.
	(ia64_gdbarch_init): Don't bother calculating the os.  Instead use the 
gdbarch_info struct and look at the osabi field.  Also use           		 
gdbarch_list_lookup_by_info() to look for a candidate gdbarch.

[-- Attachment #2: ia64-tdep.osabi.patch --]
[-- Type: text/plain, Size: 3064 bytes --]

Index: ia64-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/ia64-tdep.c,v
retrieving revision 1.101
diff -u -p -r1.101 ia64-tdep.c
--- ia64-tdep.c	23 Oct 2003 22:06:37 -0000	1.101
+++ ia64-tdep.c	4 Nov 2003 23:53:06 -0000
@@ -256,9 +256,6 @@ struct ia64_frame_cache
 
 struct gdbarch_tdep
   {
-    int os_ident;	/* From the ELF header, one of the ELFOSABI_
-                           constants: ELFOSABI_LINUX, ELFOSABI_AIX,
-			   etc. */
     CORE_ADDR (*sigcontext_register_address) (CORE_ADDR, int);
     			/* OS specific function which, given a frame address
 			   and register number, returns the offset to the
@@ -2710,47 +2707,21 @@ ia64_gdbarch_init (struct gdbarch_info i
 {
   struct gdbarch *gdbarch;
   struct gdbarch_tdep *tdep;
-  int os_ident;
 
-  if (info.abfd != NULL
-      && bfd_get_flavour (info.abfd) == bfd_target_elf_flavour)
-    {
-      os_ident = elf_elfheader (info.abfd)->e_ident[EI_OSABI];
-
-      /* If os_ident is 0, it is not necessarily the case that we're
-         on a SYSV system.  (ELFOSABI_NONE is defined to be 0.)
-         GNU/Linux uses a note section to record OS/ABI info, but
-         leaves e_ident[EI_OSABI] zero.  So we have to check for note
-         sections too.  */
-      if (os_ident == 0)
-	{
-	  bfd_map_over_sections (info.abfd,
-	                         process_note_abi_tag_sections,
-				 &os_ident);
-	}
-    }
-  else
-    os_ident = -1;
-
-  for (arches = gdbarch_list_lookup_by_info (arches, &info);
-       arches != NULL;
-       arches = gdbarch_list_lookup_by_info (arches->next, &info))
-    {
-      tdep = gdbarch_tdep (arches->gdbarch);
-      if (tdep &&tdep->os_ident == os_ident)
-	return arches->gdbarch;
-    }
+  /* If there is already a candidate, use it.  */
+  arches = gdbarch_list_lookup_by_info (arches, &info);
+  if (arches != NULL)
+    return arches->gdbarch;
 
   tdep = xmalloc (sizeof (struct gdbarch_tdep));
   gdbarch = gdbarch_alloc (&info, tdep);
-  tdep->os_ident = os_ident;
 
   /* Set the method of obtaining the sigcontext addresses at which
      registers are saved.  The method of checking to see if
      native_find_global_pointer is nonzero to indicate that we're
      on AIX is kind of hokey, but I can't think of a better way
      to do it.  */
-  if (os_ident == ELFOSABI_LINUX)
+  if (info.osabi == GDB_OSABI_LINUX)
     tdep->sigcontext_register_address = ia64_linux_sigcontext_register_address;
   else if (native_find_global_pointer != 0)
     tdep->sigcontext_register_address = ia64_aix_sigcontext_register_address;
@@ -2764,7 +2735,7 @@ ia64_gdbarch_init (struct gdbarch_info i
      generic_elf_find_global_pointer.  This arrangement should (in
      theory) allow us to cross debug GNU/Linux binaries from an AIX
      machine.  */
-  if (os_ident == ELFOSABI_LINUX)
+  if (info.osabi == GDB_OSABI_LINUX)
     tdep->find_global_pointer = generic_elf_find_global_pointer;
   else if (native_find_global_pointer != 0)
     tdep->find_global_pointer = native_find_global_pointer;

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2003-11-05 21:43 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-11-05  0:04 RFA: ia64 patch required after recent osabi changes J. Johnston
2003-11-05  2:20 ` Kevin Buettner
2003-11-05 20:34   ` J. Johnston
2003-11-05 20:46     ` Andrew Cagney
2003-11-05 21:43       ` Mark Kettenis

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox