2003-06-01 Andrew Cagney <cagney@redhat.com>

* solib-irix.c (extract_mips_address): Inline extract_address,
	replacing it with extract_signed_integer.
	* solib-svr4.c (SOLIB_EXTRACT_ADDRESS): Ditto.
	(LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY): Ditto.
	(first_link_map_member, open_symbol_file_object): Ditto.
	(svr4_fetch_objfile_link_map, svr4_fetch_objfile_link_map): Ditto.
	* solib-sunos.c (SOLIB_EXTRACT_ADDRESS): Ditto.
	(LM_NEXT, LM_NAME): Ditto.
This commit is contained in:
Andrew Cagney 2003-06-01 23:00:55 +00:00
parent 1fd4ae2263
commit ae0167b9b5
4 changed files with 56 additions and 33 deletions

View file

@ -1,3 +1,14 @@
2003-06-01 Andrew Cagney <cagney@redhat.com>
* solib-irix.c (extract_mips_address): Inline extract_address,
replacing it with extract_signed_integer.
* solib-svr4.c (SOLIB_EXTRACT_ADDRESS): Ditto.
(LM_NAME, IGNORE_FIRST_LINK_MAP_ENTRY): Ditto.
(first_link_map_member, open_symbol_file_object): Ditto.
(svr4_fetch_objfile_link_map, svr4_fetch_objfile_link_map): Ditto.
* solib-sunos.c (SOLIB_EXTRACT_ADDRESS): Ditto.
(LM_NEXT, LM_NAME): Ditto.
2003-06-01 Richard Henderson <rth@redhat.com> 2003-06-01 Richard Henderson <rth@redhat.com>
* alpha-tdep.h (ALPHA_FP_REGNUM): Remove. * alpha-tdep.h (ALPHA_FP_REGNUM): Remove.

View file

@ -123,16 +123,12 @@ union irix_obj_info
/* MIPS sign extends its 32 bit addresses. We could conceivably use /* MIPS sign extends its 32 bit addresses. We could conceivably use
extract_typed_address here, but to do so, we'd have to construct an extract_typed_address here, but to do so, we'd have to construct an
appropriate type. Calling extract_signed_integer or appropriate type. Calling extract_signed_integer seems simpler. */
extract_address seems simpler. */
static CORE_ADDR static CORE_ADDR
extract_mips_address (void *addr, int len) extract_mips_address (void *addr, int len)
{ {
if (len <= 32) return extract_signed_integer (addr, len);
return extract_signed_integer (addr, len);
else
return extract_address (addr, len);
} }
/* Fetch and return the link map data associated with ADDR. Note that /* Fetch and return the link map data associated with ADDR. Note that

View file

@ -68,14 +68,16 @@ static char *main_name_list[] =
NULL NULL
}; };
/* Macro to extract an address from a solib structure. /* Macro to extract an address from a solib structure. When GDB is
When GDB is configured for some 32-bit targets (e.g. Solaris 2.7 configured for some 32-bit targets (e.g. Solaris 2.7 sparc), BFD is
sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is configured to handle 64-bit targets, so CORE_ADDR is 64 bits. We
64 bits. We have to extract only the significant bits of addresses have to extract only the significant bits of addresses to get the
to get the right address when accessing the core file BFD. */ right address when accessing the core file BFD.
Assume that the address is unsigned. */
#define SOLIB_EXTRACT_ADDRESS(MEMBER) \ #define SOLIB_EXTRACT_ADDRESS(MEMBER) \
extract_address (&(MEMBER), sizeof (MEMBER)) extract_unsigned_integer (&(MEMBER), sizeof (MEMBER))
/* local data declarations */ /* local data declarations */
@ -108,7 +110,9 @@ LM_NEXT (struct so_list *so)
int lm_next_offset = offsetof (struct link_map, lm_next); int lm_next_offset = offsetof (struct link_map, lm_next);
int lm_next_size = fieldsize (struct link_map, lm_next); int lm_next_size = fieldsize (struct link_map, lm_next);
return extract_address (so->lm_info->lm + lm_next_offset, lm_next_size); /* Assume that the address is unsigned. */
return extract_unsigned_integer (so->lm_info->lm + lm_next_offset,
lm_next_size);
} }
static CORE_ADDR static CORE_ADDR
@ -117,7 +121,9 @@ LM_NAME (struct so_list *so)
int lm_name_offset = offsetof (struct link_map, lm_name); int lm_name_offset = offsetof (struct link_map, lm_name);
int lm_name_size = fieldsize (struct link_map, lm_name); int lm_name_size = fieldsize (struct link_map, lm_name);
return extract_address (so->lm_info->lm + lm_name_offset, lm_name_size); /* Assume that the address is unsigned. */
return extract_unsigned_integer (so->lm_info->lm + lm_name_offset,
lm_name_size);
} }
static CORE_ADDR debug_base; /* Base of dynamic linker structures */ static CORE_ADDR debug_base; /* Base of dynamic linker structures */

View file

@ -105,14 +105,16 @@ static char *main_name_list[] =
NULL NULL
}; };
/* Macro to extract an address from a solib structure. /* Macro to extract an address from a solib structure. When GDB is
When GDB is configured for some 32-bit targets (e.g. Solaris 2.7 configured for some 32-bit targets (e.g. Solaris 2.7 sparc), BFD is
sparc), BFD is configured to handle 64-bit targets, so CORE_ADDR is configured to handle 64-bit targets, so CORE_ADDR is 64 bits. We
64 bits. We have to extract only the significant bits of addresses have to extract only the significant bits of addresses to get the
to get the right address when accessing the core file BFD. */ right address when accessing the core file BFD.
Assume that the address is unsigned. */
#define SOLIB_EXTRACT_ADDRESS(MEMBER) \ #define SOLIB_EXTRACT_ADDRESS(MEMBER) \
extract_address (&(MEMBER), sizeof (MEMBER)) extract_unsigned_integer (&(MEMBER), sizeof (MEMBER))
/* local data declarations */ /* local data declarations */
@ -132,7 +134,9 @@ LM_NEXT (struct so_list *so)
{ {
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS (); struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
return extract_address (so->lm_info->lm + lmo->l_next_offset, lmo->l_next_size); /* Assume that the address is unsigned. */
return extract_unsigned_integer (so->lm_info->lm + lmo->l_next_offset,
lmo->l_next_size);
} }
static CORE_ADDR static CORE_ADDR
@ -140,7 +144,9 @@ LM_NAME (struct so_list *so)
{ {
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS (); struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
return extract_address (so->lm_info->lm + lmo->l_name_offset, lmo->l_name_size); /* Assume that the address is unsigned. */
return extract_unsigned_integer (so->lm_info->lm + lmo->l_name_offset,
lmo->l_name_size);
} }
static int static int
@ -148,8 +154,9 @@ IGNORE_FIRST_LINK_MAP_ENTRY (struct so_list *so)
{ {
struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS (); struct link_map_offsets *lmo = SVR4_FETCH_LINK_MAP_OFFSETS ();
return extract_address (so->lm_info->lm + lmo->l_prev_offset, /* Assume that the address is unsigned. */
lmo->l_prev_size) == 0; return extract_unsigned_integer (so->lm_info->lm + lmo->l_prev_offset,
lmo->l_prev_size) == 0;
} }
static CORE_ADDR debug_base; /* Base of dynamic linker structures */ static CORE_ADDR debug_base; /* Base of dynamic linker structures */
@ -587,7 +594,8 @@ first_link_map_member (void)
read_memory (debug_base + lmo->r_map_offset, r_map_buf, lmo->r_map_size); read_memory (debug_base + lmo->r_map_offset, r_map_buf, lmo->r_map_size);
lm = extract_address (r_map_buf, lmo->r_map_size); /* Assume that the address is unsigned. */
lm = extract_unsigned_integer (r_map_buf, lmo->r_map_size);
/* FIXME: Perhaps we should validate the info somehow, perhaps by /* FIXME: Perhaps we should validate the info somehow, perhaps by
checking r_version for a known version number, or r_state for checking r_version for a known version number, or r_state for
@ -645,8 +653,9 @@ open_symbol_file_object (void *from_ttyp)
/* Read address of name from target memory to GDB. */ /* 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, lmo->l_name_size);
/* Convert the address to host format. */ /* Convert the address to host format. Assume that the address is
l_name = extract_address (l_name_buf, lmo->l_name_size); unsigned. */
l_name = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
/* Free l_name_buf. */ /* Free l_name_buf. */
do_cleanups (cleanups); do_cleanups (cleanups);
@ -820,9 +829,9 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
/* Read address of name from target memory to GDB. */ /* 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, lmo->l_name_size);
/* Extract this object's name. */ /* Extract this object's name. Assume that the address is
name_address = extract_address (l_name_buf, unsigned. */
lmo->l_name_size); name_address = extract_unsigned_integer (l_name_buf, lmo->l_name_size);
target_read_string (name_address, &buffer, target_read_string (name_address, &buffer,
SO_NAME_MAX_PATH_SIZE - 1, &errcode); SO_NAME_MAX_PATH_SIZE - 1, &errcode);
make_cleanup (xfree, buffer); make_cleanup (xfree, buffer);
@ -843,9 +852,10 @@ svr4_fetch_objfile_link_map (struct objfile *objfile)
return lm; return lm;
} }
} }
/* Not the file we wanted, continue checking. */ /* Not the file we wanted, continue checking. Assume that the
lm = extract_address (objfile_lm_info.lm + lmo->l_next_offset, address is unsigned. */
lmo->l_next_size); lm = extract_unsigned_integer (objfile_lm_info.lm + lmo->l_next_offset,
lmo->l_next_size);
do_cleanups (old_chain); do_cleanups (old_chain);
} }
return 0; return 0;