This is the mail archive of the gdb-patches@sourceware.cygnus.com 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]

Severe regression in corefile.exp with Solaris 2.7 sparc + hack


This change:

2000-02-25  Alexandre Oliva  <oliva@lsd.ic.unicamp.br>

        * config.bfd: Enable 64 bit support for GNU/Linux/sparc.

        * config.bfd: Enable 64 bit support for Solaris7+/sparc.

causes a severe regression in corefile.exp on Solaris 2.7 sparc, which
should definitely be fixed before the 5.0 release.

Due to the BFD change, a CORE_ADDR is now an unsigned long long with 64 Bits.
When casting 32 bit pointers to a CORE_ADDR in solib.c, the sign bit of the
pointer gets extended, resulting in a very large adress. This is not a
problem when accessing the inferior via procfs (because the address gets
truncated back to 32 bits in the procfs interface), but it causes failures
when trying to retrieve the shared library info from corefile BFDs.

I have no idea how to solve this cleanly, and offer a crude hack only.
Perhaps `someone' will have a cleaner solution for this problem.


2000-03-07  Peter Schauer  <pes@regent.e-technik.tu-muenchen.de>

	* solib.c (solib_addr_bits_remove)  New function to mask off unwanted
	address bits.
	(find_solib):  Use it.

*** gdb/solib.c.orig	Wed Nov 17 03:30:28 1999
--- gdb/solib.c	Tue Mar 07 16:38:39 2000
***************
*** 974,979 ****
--- 974,991 ----
     in <link.h>.
   */
  
+ /* FIXME:  When GDB is configured for some 32-bit targets (e.g. Solaris 2.7
+    sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is
+    64 bits.  We may have to mask off sign extension bits from addresses to
+    get the right address when accessing the core file BFD via read_memory.  */
+ static CORE_ADDR
+ solib_addr_bits_remove (CORE_ADDR addr)
+ {
+   if (TARGET_PTR_BIT <= 32)
+     addr &= 0xffffffff;
+   return addr;
+ }
+ 
  static struct so_list *
  find_solib (so_list_ptr)
       struct so_list *so_list_ptr;	/* Last lm or NULL for first one */
***************
*** 1045,1051 ****
  
  	}
        so_list_next = new;
!       read_memory ((CORE_ADDR) lm, (char *) &(new->lm),
  		   sizeof (struct link_map));
        /* For SVR4 versions, the first entry in the link map is for the
           inferior executable, so we must ignore it.  For some versions of
--- 1057,1063 ----
  
  	}
        so_list_next = new;
!       read_memory (solib_addr_bits_remove ((CORE_ADDR) lm), (char *) &(new->lm),
  		   sizeof (struct link_map));
        /* For SVR4 versions, the first entry in the link map is for the
           inferior executable, so we must ignore it.  For some versions of
***************
*** 1056,1063 ****
  	{
  	  int errcode;
  	  char *buffer;
! 	  target_read_string ((CORE_ADDR) LM_NAME (new), &buffer,
! 			      MAX_PATH_SIZE - 1, &errcode);
  	  if (errcode != 0)
  	    {
  	      warning ("find_solib: Can't read pathname for load map: %s\n",
--- 1068,1075 ----
  	{
  	  int errcode;
  	  char *buffer;
! 	  target_read_string (solib_addr_bits_remove ((CORE_ADDR) LM_NAME (new)),
! 			      &buffer, MAX_PATH_SIZE - 1, &errcode);
  	  if (errcode != 0)
  	    {
  	      warning ("find_solib: Can't read pathname for load map: %s\n",

-- 
Peter Schauer			pes@regent.e-technik.tu-muenchen.de

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