Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* Signed vs. unsigned adresses in solib-svr4
@ 2007-03-27 19:16 Andreas Schwab
  2007-03-27 19:21 ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2007-03-27 19:16 UTC (permalink / raw)
  To: gdb-patches

All but two places in solib-svr4.c assume unsigned target addresses.  This
patch fixes these two occurences of extract_signed_integer to make things
consistent.

Andreas.

2007-03-27  Andreas Schwab  <schwab@suse.de>

	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use
	extract_unsigned_integer instead of extract_signed_integer.
	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.

Index: solib-svr4.c
===================================================================
RCS file: /cvs/src/src/gdb/solib-svr4.c,v
retrieving revision 1.61
diff -u -a -p -u -p -a -r1.61 solib-svr4.c
--- solib-svr4.c	9 Jan 2007 17:58:58 -0000	1.61
+++ solib-svr4.c	27 Mar 2007 19:12:52 -0000
@@ -138,9 +138,9 @@ LM_ADDR_FROM_LINK_MAP (struct so_list *s
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
-					     + lmo->l_addr_offset,
-					     lmo->l_addr_size);
+  return (CORE_ADDR) extract_unsigned_integer (so->lm_info->lm
+					       + lmo->l_addr_offset,
+					       lmo->l_addr_size);
 }
 
 static int
@@ -158,9 +158,9 @@ LM_DYNAMIC_FROM_LINK_MAP (struct so_list
 
   gdb_assert (lmo->l_ld_size != 0);
 
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
-					     + lmo->l_ld_offset,
-					     lmo->l_ld_size);
+  return (CORE_ADDR) extract_unsigned_integer (so->lm_info->lm
+					       + lmo->l_ld_offset,
+					       lmo->l_ld_size);
 }
 
 static CORE_ADDR

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-27 19:16 Signed vs. unsigned adresses in solib-svr4 Andreas Schwab
@ 2007-03-27 19:21 ` Daniel Jacobowitz
  2007-03-27 20:20   ` Andreas Schwab
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2007-03-27 19:21 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

On Tue, Mar 27, 2007 at 09:16:28PM +0200, Andreas Schwab wrote:
> All but two places in solib-svr4.c assume unsigned target addresses.  This
> patch fixes these two occurences of extract_signed_integer to make things
> consistent.
> 
> Andreas.
> 
> 2007-03-27  Andreas Schwab  <schwab@suse.de>
> 
> 	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use
> 	extract_unsigned_integer instead of extract_signed_integer.
> 	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.

I'd rather not unless this fixes a real problem - since I know that
the assumption is wrong for MIPS.  Isn't there an extract_address or
something like that which would be suitable?

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-27 19:21 ` Daniel Jacobowitz
@ 2007-03-27 20:20   ` Andreas Schwab
  2007-03-27 20:36     ` Daniel Jacobowitz
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2007-03-27 20:20 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz <drow@false.org> writes:

> On Tue, Mar 27, 2007 at 09:16:28PM +0200, Andreas Schwab wrote:
>> All but two places in solib-svr4.c assume unsigned target addresses.  This
>> patch fixes these two occurences of extract_signed_integer to make things
>> consistent.
>> 
>> Andreas.
>> 
>> 2007-03-27  Andreas Schwab  <schwab@suse.de>
>> 
>> 	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use
>> 	extract_unsigned_integer instead of extract_signed_integer.
>> 	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.
>
> I'd rather not unless this fixes a real problem

If your CORE_ADDR is 64bit, but the target is 32bit you get an address
that does not exist on the target.

> - since I know that the assumption is wrong for MIPS.  Isn't there an
> extract_address or something like that which would be suitable?

There is extract_typed_address, but I don't know how to construct the
struct type that it needs.

Andreas.

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-27 20:20   ` Andreas Schwab
@ 2007-03-27 20:36     ` Daniel Jacobowitz
  2007-03-29 11:38       ` Andreas Schwab
  0 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2007-03-27 20:36 UTC (permalink / raw)
  To: gdb-patches

On Tue, Mar 27, 2007 at 10:20:23PM +0200, Andreas Schwab wrote:
> > - since I know that the assumption is wrong for MIPS.  Isn't there an
> > extract_address or something like that which would be suitable?
> 
> There is extract_typed_address, but I don't know how to construct the
> struct type that it needs.

Probably builtin_type_void_data_ptr is all you need.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-27 20:36     ` Daniel Jacobowitz
@ 2007-03-29 11:38       ` Andreas Schwab
  2007-03-29 17:56         ` Daniel Jacobowitz
                           ` (2 more replies)
  0 siblings, 3 replies; 11+ messages in thread
From: Andreas Schwab @ 2007-03-29 11:38 UTC (permalink / raw)
  To: gdb-patches

Daniel Jacobowitz <drow@false.org> writes:

> On Tue, Mar 27, 2007 at 10:20:23PM +0200, Andreas Schwab wrote:
>> > - since I know that the assumption is wrong for MIPS.  Isn't there an
>> > extract_address or something like that which would be suitable?
>> 
>> There is extract_typed_address, but I don't know how to construct the
>> struct type that it needs.
>
> Probably builtin_type_void_data_ptr is all you need.

How about this then?  Regtestest on
{i386,ia64,ppc,ppc64,s390,s390x,x86_64}-linux.

Andreas.

2007-03-29  Andreas Schwab  <schwab@suse.de>

	* solib-svr4.h (struct link_map_offsets): Remove l_addr_size,
	l_ld_size, l_next_size, l_prev_size, l_name_size.

	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use extract_typed_address
	to extract addresses from link map.
	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.
	(LM_NEXT): Likewise.
	(LM_NAME): Likewise.
	(IGNORE_FIRST_LINK_MAP_ENTRY): Likewise.
	(elf_locate_base): Likewise.
	(open_symbol_file_object): Likewise.
	(svr4_fetch_objfile_link_map): Likewise.
	(SOLIB_EXTRACT_ADDRESS): Remove unused macro.
	(HAS_LM_DYNAMIC_FROM_LINK_MAP): Test l_ld_offset instead of
	l_ld_size.
        (svr4_ilp32_fetch_link_map_offsets): Don't set removed members.
	(svr4_lp64_fetch_link_map_offsets): Likewise.

	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): Don't set
	removed members.  Set l_ld_offset to -1 if not present.

--- gdb/solib-legacy.c.~1.11.~	2007-01-10 11:18:50.000000000 +0100
+++ gdb/solib-legacy.c	2007-03-29 12:56:05.000000000 +0200
@@ -63,51 +63,28 @@ legacy_svr4_fetch_link_map_offsets (void
       lmo.link_map_size = sizeof (struct link_map);
 
       lmo.l_addr_offset = offsetof (struct link_map, l_addr);
-      lmo.l_addr_size = fieldsize (struct link_map, l_addr);
-
       lmo.l_next_offset = offsetof (struct link_map, l_next);
-      lmo.l_next_size = fieldsize (struct link_map, l_next);
-
       lmo.l_ld_offset = offsetof (struct link_map, l_ld);
-      lmo.l_ld_size = fieldsize (struct link_map, l_ld);
-
       lmo.l_prev_offset = offsetof (struct link_map, l_prev);
-      lmo.l_prev_size = fieldsize (struct link_map, l_prev);
-
       lmo.l_name_offset = offsetof (struct link_map, l_name);
-      lmo.l_name_size = fieldsize (struct link_map, l_name);
 #else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS) */
 #ifdef HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS
       lmo.link_map_size = sizeof (struct link_map);
 
       lmo.l_addr_offset = offsetof (struct link_map, lm_addr);
-      lmo.l_addr_size = fieldsize (struct link_map, lm_addr);
-
       lmo.l_next_offset = offsetof (struct link_map, lm_next);
-      lmo.l_next_size = fieldsize (struct link_map, lm_next);
-
       /* FIXME: Is this the right field name, or is it available at all?  */
       lmo.l_ld_offset = offsetof (struct link_map, lm_ld);
-      lmo.l_ld_size = fieldsize (struct link_map, lm_ld);
-
       lmo.l_name_offset = offsetof (struct link_map, lm_name);
-      lmo.l_name_size = fieldsize (struct link_map, lm_name);
 #else /* !defined(HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS) */
 #if HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS
       lmo.link_map_size = sizeof (struct so_map);
 
       lmo.l_addr_offset = offsetof (struct so_map, som_addr);
-      lmo.l_addr_size = fieldsize (struct so_map, som_addr);
-
       lmo.l_next_offset = offsetof (struct so_map, som_next);
-      lmo.l_next_size = fieldsize (struct so_map, som_next);
-
       lmo.l_name_offset = offsetof (struct so_map, som_path);
-      lmo.l_name_size = fieldsize (struct so_map, som_path);
-
       /* FIXME: Is the address of the dynamic table available?  */
-      lmo.l_ld_offset = 0;
-      lmo.l_ld_size = 0;
+      lmo.l_ld_offset = -1;
 #endif /* HAVE_STRUCT_SO_MAP_WITH_SOM_MEMBERS */
 #endif /* HAVE_STRUCT_LINK_MAP_WITH_LM_MEMBERS */
 #endif /* HAVE_STRUCT_LINK_MAP_WITH_L_MEMBERS */
@@ -126,16 +103,9 @@ legacy_svr4_fetch_link_map_offsets (void
       lmo32.link_map_size = sizeof (struct link_map32);
 
       lmo32.l_addr_offset = offsetof (struct link_map32, l_addr);
-      lmo32.l_addr_size = fieldsize (struct link_map32, l_addr);
-
       lmo32.l_next_offset = offsetof (struct link_map32, l_next);
-      lmo32.l_next_size = fieldsize (struct link_map32, l_next);
-
       lmo32.l_prev_offset = offsetof (struct link_map32, l_prev);
-      lmo32.l_prev_size = fieldsize (struct link_map32, l_prev);
-
       lmo32.l_name_offset = offsetof (struct link_map32, l_name);
-      lmo32.l_name_size = fieldsize (struct link_map32, l_name);
     }
 #endif /* defined (HAVE_STRUCT_LINK_MAP32) */
 
--- gdb/solib-svr4.c.~1.61.~	2007-03-27 21:15:04.000000000 +0200
+++ gdb/solib-svr4.c	2007-03-29 12:56:47.000000000 +0200
@@ -118,19 +118,6 @@ static char *main_name_list[] =
   NULL
 };
 
-/* Macro to extract an address from a solib structure.  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
-   have to extract only the significant bits of addresses to get the
-   right address when accessing the core file BFD.
-
-   Assume that the address is unsigned.  */
-
-#define SOLIB_EXTRACT_ADDRESS(MEMBER) \
-	extract_unsigned_integer (&(MEMBER), sizeof (MEMBER))
-
-/* local data declarations */
-
 /* link map access functions */
 
 static CORE_ADDR
@@ -138,9 +125,8 @@ LM_ADDR_FROM_LINK_MAP (struct so_list *s
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
-					     + lmo->l_addr_offset,
-					     lmo->l_addr_size);
+  return extract_typed_address (so->lm_info->lm + lmo->l_addr_offset,
+				builtin_type_void_data_ptr);
 }
 
 static int
@@ -148,7 +134,7 @@ HAS_LM_DYNAMIC_FROM_LINK_MAP ()
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  return (lmo->l_ld_size != 0);
+  return lmo->l_ld_offset >= 0;
 }
 
 static CORE_ADDR
@@ -156,11 +142,8 @@ LM_DYNAMIC_FROM_LINK_MAP (struct so_list
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  gdb_assert (lmo->l_ld_size != 0);
-
-  return (CORE_ADDR) extract_signed_integer (so->lm_info->lm
-					     + lmo->l_ld_offset,
-					     lmo->l_ld_size);
+  return extract_typed_address (so->lm_info->lm + lmo->l_ld_offset,
+				builtin_type_void_data_ptr);
 }
 
 static CORE_ADDR
@@ -238,9 +221,8 @@ LM_NEXT (struct so_list *so)
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  /* Assume that the address is unsigned.  */
-  return extract_unsigned_integer (so->lm_info->lm + lmo->l_next_offset,
-				   lmo->l_next_size);
+  return extract_typed_address (so->lm_info->lm + lmo->l_next_offset,
+				builtin_type_void_data_ptr);
 }
 
 static CORE_ADDR
@@ -248,9 +230,8 @@ LM_NAME (struct so_list *so)
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  /* Assume that the address is unsigned.  */
-  return extract_unsigned_integer (so->lm_info->lm + lmo->l_name_offset,
-				   lmo->l_name_size);
+  return extract_typed_address (so->lm_info->lm + lmo->l_name_offset,
+				builtin_type_void_data_ptr);
 }
 
 static int
@@ -258,9 +239,8 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_l
 {
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
 
-  /* Assume that the address is unsigned.  */
-  return extract_unsigned_integer (so->lm_info->lm + lmo->l_prev_offset,
-				   lmo->l_prev_size) == 0;
+  return extract_typed_address (so->lm_info->lm + lmo->l_prev_offset,
+				builtin_type_void_data_ptr) == 0;
 }
 
 static CORE_ADDR debug_base;	/* Base of dynamic linker structures */
@@ -446,7 +426,7 @@ elf_locate_base (void)
 	  else if (dyn_tag == DT_MIPS_RLD_MAP)
 	    {
 	      gdb_byte *pbuf;
-	      int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
+	      int pbuf_size = TYPE_LENGTH (builtin_type_void_data_ptr);
 
 	      pbuf = alloca (pbuf_size);
 	      /* DT_MIPS_RLD_MAP contains a pointer to the address
@@ -455,7 +435,7 @@ elf_locate_base (void)
 				      (bfd_byte *) x_dynp->d_un.d_ptr);
 	      if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
 		return 0;
-	      return extract_unsigned_integer (pbuf, pbuf_size);
+	      return extract_typed_address (pbuf, builtin_type_void_data_ptr);
 	    }
 	}
     }
@@ -481,7 +461,7 @@ elf_locate_base (void)
 	  else if (dyn_tag == DT_MIPS_RLD_MAP)
 	    {
 	      gdb_byte *pbuf;
-	      int pbuf_size = TARGET_PTR_BIT / HOST_CHAR_BIT;
+	      int pbuf_size = TYPE_LENGTH (builtin_type_void_data_ptr);
 
 	      pbuf = alloca (pbuf_size);
 	      /* DT_MIPS_RLD_MAP contains a pointer to the address
@@ -490,7 +470,7 @@ elf_locate_base (void)
 				      (bfd_byte *) x_dynp->d_un.d_ptr);
 	      if (target_read_memory (dyn_ptr, pbuf, pbuf_size))
 		return 0;
-	      return extract_unsigned_integer (pbuf, pbuf_size);
+	      return extract_typed_address (pbuf, builtin_type_void_data_ptr);
 	    }
 	}
     }
@@ -620,7 +600,8 @@ open_symbol_file_object (void *from_ttyp
   int errcode;
   int from_tty = *(int *)from_ttyp;
   struct link_map_offsets *lmo = svr4_fetch_link_map_offsets ();
-  gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
+  int l_name_size = TYPE_LENGTH (builtin_type_void_data_ptr);
+  gdb_byte *l_name_buf = xmalloc (l_name_size);
   struct cleanup *cleanups = make_cleanup (xfree, l_name_buf);
 
   if (symfile_objfile)
@@ -636,11 +617,10 @@ open_symbol_file_object (void *from_ttyp
     return 0;	/* failed somehow... */
 
   /* Read address of name from target memory to GDB.  */
-  read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
+  read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size);
 
-  /* Convert the address to host format.  Assume that the address is
-     unsigned.  */
-  l_name = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
+  /* Convert the address to host format.  */
+  l_name = extract_typed_address (l_name_buf, builtin_type_void_data_ptr);
 
   /* Free l_name_buf.  */
   do_cleanups (cleanups);
@@ -836,7 +816,8 @@ svr4_fetch_objfile_link_map (struct objf
       struct lm_info objfile_lm_info;
       struct cleanup *old_chain;
       CORE_ADDR name_address;
-      gdb_byte *l_name_buf = xmalloc (lmo->l_name_size);
+      int l_name_size = TYPE_LENGTH (builtin_type_void_data_ptr);
+      gdb_byte *l_name_buf = xmalloc (l_name_size);
       old_chain = make_cleanup (xfree, l_name_buf);
 
       /* Set up the buffer to contain the portion of the link_map
@@ -849,11 +830,11 @@ svr4_fetch_objfile_link_map (struct objf
       read_memory (lm, objfile_lm_info.lm, lmo->link_map_size);
 
       /* Read address of name from target memory to GDB.  */
-      read_memory (lm + lmo->l_name_offset, l_name_buf, lmo->l_name_size);
+      read_memory (lm + lmo->l_name_offset, l_name_buf, l_name_size);
 
-      /* Extract this object's name.  Assume that the address is
-         unsigned.  */
-      name_address = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
+      /* Extract this object's name.  */
+      name_address = extract_typed_address (l_name_buf,
+					    builtin_type_void_data_ptr);
       target_read_string (name_address, &buffer,
       			  SO_NAME_MAX_PATH_SIZE - 1, &errcode);
       make_cleanup (xfree, buffer);
@@ -872,10 +853,9 @@ svr4_fetch_objfile_link_map (struct objf
     	      return lm;
       	    }
   	}
-      /* Not the file we wanted, continue checking.  Assume that the
-         address is unsigned.  */
-      lm = extract_unsigned_integer (objfile_lm_info.lm + lmo->l_next_offset,
-				     lmo->l_next_size);
+      /* Not the file we wanted, continue checking.  */
+      lm = extract_typed_address (objfile_lm_info.lm + lmo->l_next_offset,
+				  builtin_type_void_data_ptr);
       do_cleanups (old_chain);
     }
   return 0;
@@ -1521,15 +1501,10 @@ svr4_ilp32_fetch_link_map_offsets (void)
       /* Everything we need is in the first 20 bytes.  */
       lmo.link_map_size = 20;
       lmo.l_addr_offset = 0;
-      lmo.l_addr_size = 4;
       lmo.l_name_offset = 4;
-      lmo.l_name_size = 4;
       lmo.l_ld_offset = 8;
-      lmo.l_ld_size = 4;
       lmo.l_next_offset = 12;
-      lmo.l_next_size = 4;
       lmo.l_prev_offset = 16;
-      lmo.l_prev_size = 4;
     }
 
   return lmp;
@@ -1556,15 +1531,10 @@ svr4_lp64_fetch_link_map_offsets (void)
       /* Everything we need is in the first 40 bytes.  */
       lmo.link_map_size = 40;
       lmo.l_addr_offset = 0;
-      lmo.l_addr_size = 8;
       lmo.l_name_offset = 8;
-      lmo.l_name_size = 8;
       lmo.l_ld_offset = 16;
-      lmo.l_ld_size = 8;
       lmo.l_next_offset = 24;
-      lmo.l_next_size = 8;
       lmo.l_prev_offset = 32;
-      lmo.l_prev_size = 8;
     }
 
   return lmp;
--- gdb/solib-svr4.h.~1.13.~	2007-01-10 11:18:50.000000000 +0100
+++ gdb/solib-svr4.h	2007-03-29 13:37:05.000000000 +0200
@@ -46,32 +46,17 @@ struct link_map_offsets
     /* Offset to l_addr field in struct link_map.  */
     int l_addr_offset;
 
-    /* Size of l_addr field in struct link_map.  */
-    int l_addr_size;
-
     /* Offset to l_ld field in struct link_map.  */
     int l_ld_offset;
 
-    /* Size of l_ld field in struct link_map.  */
-    int l_ld_size;
-
     /* Offset to l_next field in struct link_map.  */
     int l_next_offset;
 
-    /* Size of l_next field in struct link_map.  */
-    int l_next_size;
-
     /* Offset to l_prev field in struct link_map.  */
     int l_prev_offset;
 
-    /* Size of l_prev field in struct link_map.  */
-    int l_prev_size;
-
     /* Offset to l_name field in struct link_map.  */
     int l_name_offset;
-
-    /* Size of l_name field in struct link_map.  */
-    int l_name_size;
   };
 
 /* set_solib_svr4_fetch_link_map_offsets() is intended to be called by

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-29 11:38       ` Andreas Schwab
@ 2007-03-29 17:56         ` Daniel Jacobowitz
  2007-04-10  6:57           ` Kevin Buettner
  2007-03-31  9:10         ` Mark Kettenis
  2007-05-09 17:55         ` Ulrich Weigand
  2 siblings, 1 reply; 11+ messages in thread
From: Daniel Jacobowitz @ 2007-03-29 17:56 UTC (permalink / raw)
  To: gdb-patches; +Cc: Kevin Buettner

On Thu, Mar 29, 2007 at 01:38:36PM +0200, Andreas Schwab wrote:
> Daniel Jacobowitz <drow@false.org> writes:
> 
> > On Tue, Mar 27, 2007 at 10:20:23PM +0200, Andreas Schwab wrote:
> >> > - since I know that the assumption is wrong for MIPS.  Isn't there an
> >> > extract_address or something like that which would be suitable?
> >> 
> >> There is extract_typed_address, but I don't know how to construct the
> >> struct type that it needs.
> >
> > Probably builtin_type_void_data_ptr is all you need.
> 
> How about this then?  Regtestest on
> {i386,ia64,ppc,ppc64,s390,s390x,x86_64}-linux.

Looks good to me.  Kevin, what do you think?

> 2007-03-29  Andreas Schwab  <schwab@suse.de>
> 
> 	* solib-svr4.h (struct link_map_offsets): Remove l_addr_size,
> 	l_ld_size, l_next_size, l_prev_size, l_name_size.
> 
> 	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use extract_typed_address
> 	to extract addresses from link map.
> 	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.
> 	(LM_NEXT): Likewise.
> 	(LM_NAME): Likewise.
> 	(IGNORE_FIRST_LINK_MAP_ENTRY): Likewise.
> 	(elf_locate_base): Likewise.
> 	(open_symbol_file_object): Likewise.
> 	(svr4_fetch_objfile_link_map): Likewise.
> 	(SOLIB_EXTRACT_ADDRESS): Remove unused macro.
> 	(HAS_LM_DYNAMIC_FROM_LINK_MAP): Test l_ld_offset instead of
> 	l_ld_size.
>         (svr4_ilp32_fetch_link_map_offsets): Don't set removed members.
> 	(svr4_lp64_fetch_link_map_offsets): Likewise.
> 
> 	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): Don't set
> 	removed members.  Set l_ld_offset to -1 if not present.

-- 
Daniel Jacobowitz
CodeSourcery


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-29 11:38       ` Andreas Schwab
  2007-03-29 17:56         ` Daniel Jacobowitz
@ 2007-03-31  9:10         ` Mark Kettenis
  2007-05-09 17:55         ` Ulrich Weigand
  2 siblings, 0 replies; 11+ messages in thread
From: Mark Kettenis @ 2007-03-31  9:10 UTC (permalink / raw)
  To: schwab; +Cc: gdb-patches

> From: Andreas Schwab <schwab@suse.de>
> Date: Thu, 29 Mar 2007 13:38:36 +0200
> 
> Daniel Jacobowitz <drow@false.org> writes:
> 
> > On Tue, Mar 27, 2007 at 10:20:23PM +0200, Andreas Schwab wrote:
> >> > - since I know that the assumption is wrong for MIPS.  Isn't there an
> >> > extract_address or something like that which would be suitable?
> >> 
> >> There is extract_typed_address, but I don't know how to construct the
> >> struct type that it needs.
> >
> > Probably builtin_type_void_data_ptr is all you need.
> 
> How about this then?  Regtestest on
> {i386,ia64,ppc,ppc64,s390,s390x,x86_64}-linux.

I like this.

> 
> Andreas.
> 
> 2007-03-29  Andreas Schwab  <schwab@suse.de>
> 
> 	* solib-svr4.h (struct link_map_offsets): Remove l_addr_size,
> 	l_ld_size, l_next_size, l_prev_size, l_name_size.
> 
> 	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use extract_typed_address
> 	to extract addresses from link map.
> 	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.
> 	(LM_NEXT): Likewise.
> 	(LM_NAME): Likewise.
> 	(IGNORE_FIRST_LINK_MAP_ENTRY): Likewise.
> 	(elf_locate_base): Likewise.
> 	(open_symbol_file_object): Likewise.
> 	(svr4_fetch_objfile_link_map): Likewise.
> 	(SOLIB_EXTRACT_ADDRESS): Remove unused macro.
> 	(HAS_LM_DYNAMIC_FROM_LINK_MAP): Test l_ld_offset instead of
> 	l_ld_size.
>         (svr4_ilp32_fetch_link_map_offsets): Don't set removed members.
> 	(svr4_lp64_fetch_link_map_offsets): Likewise.
> 
> 	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): Don't set
> 	removed members.  Set l_ld_offset to -1 if not present.


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-29 17:56         ` Daniel Jacobowitz
@ 2007-04-10  6:57           ` Kevin Buettner
  0 siblings, 0 replies; 11+ messages in thread
From: Kevin Buettner @ 2007-04-10  6:57 UTC (permalink / raw)
  To: gdb-patches

On Thu, 29 Mar 2007 13:56:07 -0400
Daniel Jacobowitz <drow@false.org> wrote:

> On Thu, Mar 29, 2007 at 01:38:36PM +0200, Andreas Schwab wrote:
> > Daniel Jacobowitz <drow@false.org> writes:
> > 
> > > On Tue, Mar 27, 2007 at 10:20:23PM +0200, Andreas Schwab wrote:
> > >> > - since I know that the assumption is wrong for MIPS.  Isn't there an
> > >> > extract_address or something like that which would be suitable?
> > >> 
> > >> There is extract_typed_address, but I don't know how to construct the
> > >> struct type that it needs.
> > >
> > > Probably builtin_type_void_data_ptr is all you need.
> > 
> > How about this then?  Regtestest on
> > {i386,ia64,ppc,ppc64,s390,s390x,x86_64}-linux.
> 
> Looks good to me.  Kevin, what do you think?

I like it.

Andreas, please commit this patch.

Thanks,

Kevin


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-03-29 11:38       ` Andreas Schwab
  2007-03-29 17:56         ` Daniel Jacobowitz
  2007-03-31  9:10         ` Mark Kettenis
@ 2007-05-09 17:55         ` Ulrich Weigand
  2007-05-09 18:38           ` Andreas Schwab
  2 siblings, 1 reply; 11+ messages in thread
From: Ulrich Weigand @ 2007-05-09 17:55 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

> 2007-03-29  Andreas Schwab  <schwab@suse.de>
> 
> 	* solib-svr4.h (struct link_map_offsets): Remove l_addr_size,
> 	l_ld_size, l_next_size, l_prev_size, l_name_size.
> 
> 	* solib-svr4.c (LM_ADDR_FROM_LINK_MAP): Use extract_typed_address
> 	to extract addresses from link map.
> 	(LM_DYNAMIC_FROM_LINK_MAP): Likewise.
> 	(LM_NEXT): Likewise.
> 	(LM_NAME): Likewise.
> 	(IGNORE_FIRST_LINK_MAP_ENTRY): Likewise.
> 	(elf_locate_base): Likewise.
> 	(open_symbol_file_object): Likewise.
> 	(svr4_fetch_objfile_link_map): Likewise.
> 	(SOLIB_EXTRACT_ADDRESS): Remove unused macro.
> 	(HAS_LM_DYNAMIC_FROM_LINK_MAP): Test l_ld_offset instead of
> 	l_ld_size.
>         (svr4_ilp32_fetch_link_map_offsets): Don't set removed members.
> 	(svr4_lp64_fetch_link_map_offsets): Likewise.
> 
> 	* solib-legacy.c (legacy_svr4_fetch_link_map_offsets): Don't set
> 	removed members.  Set l_ld_offset to -1 if not present.

Looks like this patch broke building mipsnbsd-tdep.c
(mipsnbsd_ilp32_fetch_link_map_offsets,
mipsnbsd_lp64_fetch_link_map_offsets).

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-05-09 17:55         ` Ulrich Weigand
@ 2007-05-09 18:38           ` Andreas Schwab
  2007-05-09 19:46             ` Ulrich Weigand
  0 siblings, 1 reply; 11+ messages in thread
From: Andreas Schwab @ 2007-05-09 18:38 UTC (permalink / raw)
  To: Ulrich Weigand; +Cc: gdb-patches

"Ulrich Weigand" <uweigand@de.ibm.com> writes:

> Looks like this patch broke building mipsnbsd-tdep.c
> (mipsnbsd_ilp32_fetch_link_map_offsets,
> mipsnbsd_lp64_fetch_link_map_offsets).

Thanks, I have checked this in as obvious.

Andreas.

2007-05-09  Andreas Schwab  <schwab@suse.de>

	* mipsnbsd-tdep.c (mipsnbsd_ilp32_fetch_link_map_offsets): Don't
	set removed members.
	(mipsnbsd_lp64_fetch_link_map_offsets): Likewise.

--- mipsnbsd-tdep.c	6 May 2007 14:29:15 -0000	1.24
+++ mipsnbsd-tdep.c	9 May 2007 18:22:18 -0000
@@ -336,15 +336,10 @@ mipsnbsd_ilp32_fetch_link_map_offsets (v
       /* Everything we need is in the first 24 bytes.  */
       lmo.link_map_size = 24;
       lmo.l_addr_offset = 4;
-      lmo.l_addr_size = 4;
       lmo.l_name_offset = 8;
-      lmo.l_name_size = 4;
       lmo.l_ld_offset = 12;
-      lmo.l_ld_size = 4;
       lmo.l_next_offset = 16;
-      lmo.l_next_size = 4;
       lmo.l_prev_offset = 20;
-      lmo.l_prev_size = 4;
     }
 
   return lmp;
@@ -368,15 +363,10 @@ mipsnbsd_lp64_fetch_link_map_offsets (vo
       /* Everything we need is in the first 40 bytes.  */
       lmo.link_map_size = 48;
       lmo.l_addr_offset = 0;
-      lmo.l_addr_size = 8;
       lmo.l_name_offset = 16; 
-      lmo.l_name_size = 8;
       lmo.l_ld_offset = 24;
-      lmo.l_ld_size = 8;
       lmo.l_next_offset = 32;
-      lmo.l_next_size = 8;
       lmo.l_prev_offset = 40;
-      lmo.l_prev_size = 8;
     }
 
   return lmp;

-- 
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
PGP key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."


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

* Re: Signed vs. unsigned adresses in solib-svr4
  2007-05-09 18:38           ` Andreas Schwab
@ 2007-05-09 19:46             ` Ulrich Weigand
  0 siblings, 0 replies; 11+ messages in thread
From: Ulrich Weigand @ 2007-05-09 19:46 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gdb-patches

Andreas Schwab wrote:

> 	* mipsnbsd-tdep.c (mipsnbsd_ilp32_fetch_link_map_offsets): Don't
> 	set removed members.
> 	(mipsnbsd_lp64_fetch_link_map_offsets): Likewise.

Thanks!

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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

end of thread, other threads:[~2007-05-09 19:46 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-03-27 19:16 Signed vs. unsigned adresses in solib-svr4 Andreas Schwab
2007-03-27 19:21 ` Daniel Jacobowitz
2007-03-27 20:20   ` Andreas Schwab
2007-03-27 20:36     ` Daniel Jacobowitz
2007-03-29 11:38       ` Andreas Schwab
2007-03-29 17:56         ` Daniel Jacobowitz
2007-04-10  6:57           ` Kevin Buettner
2007-03-31  9:10         ` Mark Kettenis
2007-05-09 17:55         ` Ulrich Weigand
2007-05-09 18:38           ` Andreas Schwab
2007-05-09 19:46             ` Ulrich Weigand

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