2007-06-06 Markus Deuling <deuling@de.ibm.com>

* gdbarch.sh (ADDRESS_TO_POINTER): Replace by
	gdbarch_address_to_pointer.
	* findvar.c (store_typed_address): Likewise.
	* gdbtypes.c (make_pointer_type): Likewise (comment).
	* procfs.c (procfs_address_to_host_pointer): Likewise.
	* std-regs.c (value_of_builtin_frame_reg): Likewise.
	(value_of_builtin_frame_fp_reg): Likewise.
	(value_of_builtin_frame_pc_reg): Likewise.
	* utils.c (paddress): Likewise (comment).
	* gdbarch.sh (POINTER_TO_ADDRESS): Replace by
	gdbarch_pointer_to_address.
	* findvar.c (extract_typed_address): Likewise.
	* gdbtypes.c (make_pointer_type): Likewise (comment).
	* valops.c (value_cast): Likewise (comment).
	* gdbarch.c, gdbarch.h: Regenerate.
This commit is contained in:
Ulrich Weigand 2007-06-06 15:23:06 +00:00
parent 91104499cb
commit 76e713237b
10 changed files with 38 additions and 41 deletions

View file

@ -1,3 +1,21 @@
2007-06-06 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (ADDRESS_TO_POINTER): Replace by
gdbarch_address_to_pointer.
* findvar.c (store_typed_address): Likewise.
* gdbtypes.c (make_pointer_type): Likewise (comment).
* procfs.c (procfs_address_to_host_pointer): Likewise.
* std-regs.c (value_of_builtin_frame_reg): Likewise.
(value_of_builtin_frame_fp_reg): Likewise.
(value_of_builtin_frame_pc_reg): Likewise.
* utils.c (paddress): Likewise (comment).
* gdbarch.sh (POINTER_TO_ADDRESS): Replace by
gdbarch_pointer_to_address.
* findvar.c (extract_typed_address): Likewise.
* gdbtypes.c (make_pointer_type): Likewise (comment).
* valops.c (value_cast): Likewise (comment).
* gdbarch.c, gdbarch.h: Regenerate.
2007-06-06 Markus Deuling <deuling@de.ibm.com> 2007-06-06 Markus Deuling <deuling@de.ibm.com>
* gdbarch.sh (GET_LONGJMP_TARGET): Replace by gdbarch_get_longjmp_target. * gdbarch.sh (GET_LONGJMP_TARGET): Replace by gdbarch_get_longjmp_target.

View file

@ -174,7 +174,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type)
_("extract_typed_address: " _("extract_typed_address: "
"type is not a pointer or reference")); "type is not a pointer or reference"));
return POINTER_TO_ADDRESS (type, buf); return gdbarch_pointer_to_address (current_gdbarch, type, buf);
} }
@ -243,7 +243,7 @@ store_typed_address (gdb_byte *buf, struct type *type, CORE_ADDR addr)
_("store_typed_address: " _("store_typed_address: "
"type is not a pointer or reference")); "type is not a pointer or reference"));
ADDRESS_TO_POINTER (type, buf, addr); gdbarch_address_to_pointer (current_gdbarch, type, buf, addr);
} }

View file

@ -703,12 +703,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n", "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n",
(long) current_gdbarch->address_class_type_flags_to_name); (long) current_gdbarch->address_class_type_flags_to_name);
#ifdef ADDRESS_TO_POINTER
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"ADDRESS_TO_POINTER(type, buf, addr)",
XSTRING (ADDRESS_TO_POINTER (type, buf, addr)));
#endif
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: address_to_pointer = <0x%lx>\n", "gdbarch_dump: address_to_pointer = <0x%lx>\n",
(long) current_gdbarch->address_to_pointer); (long) current_gdbarch->address_to_pointer);
@ -1184,12 +1178,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file)
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: pc_regnum = %s\n", "gdbarch_dump: pc_regnum = %s\n",
paddr_d (current_gdbarch->pc_regnum)); paddr_d (current_gdbarch->pc_regnum));
#ifdef POINTER_TO_ADDRESS
fprintf_unfiltered (file,
"gdbarch_dump: %s # %s\n",
"POINTER_TO_ADDRESS(type, buf)",
XSTRING (POINTER_TO_ADDRESS (type, buf)));
#endif
fprintf_unfiltered (file, fprintf_unfiltered (file,
"gdbarch_dump: pointer_to_address = <0x%lx>\n", "gdbarch_dump: pointer_to_address = <0x%lx>\n",
(long) current_gdbarch->pointer_to_address); (long) current_gdbarch->pointer_to_address);

View file

@ -194,7 +194,8 @@ extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struc
/ addr_bit will be set from it. / addr_bit will be set from it.
If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well. also need to set gdbarch_pointer_to_address and gdbarch_address_to_pointer
as well.
ptr_bit is the size of a pointer on the target */ ptr_bit is the size of a pointer on the target */
@ -594,22 +595,10 @@ extern void set_gdbarch_value_from_register (struct gdbarch *gdbarch, gdbarch_va
typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const gdb_byte *buf); typedef CORE_ADDR (gdbarch_pointer_to_address_ftype) (struct type *type, const gdb_byte *buf);
extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf); extern CORE_ADDR gdbarch_pointer_to_address (struct gdbarch *gdbarch, struct type *type, const gdb_byte *buf);
extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address); extern void set_gdbarch_pointer_to_address (struct gdbarch *gdbarch, gdbarch_pointer_to_address_ftype *pointer_to_address);
#if !defined (GDB_TM_FILE) && defined (POINTER_TO_ADDRESS)
#error "Non multi-arch definition of POINTER_TO_ADDRESS"
#endif
#if !defined (POINTER_TO_ADDRESS)
#define POINTER_TO_ADDRESS(type, buf) (gdbarch_pointer_to_address (current_gdbarch, type, buf))
#endif
typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, gdb_byte *buf, CORE_ADDR addr); typedef void (gdbarch_address_to_pointer_ftype) (struct type *type, gdb_byte *buf, CORE_ADDR addr);
extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr); extern void gdbarch_address_to_pointer (struct gdbarch *gdbarch, struct type *type, gdb_byte *buf, CORE_ADDR addr);
extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer); extern void set_gdbarch_address_to_pointer (struct gdbarch *gdbarch, gdbarch_address_to_pointer_ftype *address_to_pointer);
#if !defined (GDB_TM_FILE) && defined (ADDRESS_TO_POINTER)
#error "Non multi-arch definition of ADDRESS_TO_POINTER"
#endif
#if !defined (ADDRESS_TO_POINTER)
#define ADDRESS_TO_POINTER(type, buf, addr) (gdbarch_address_to_pointer (current_gdbarch, type, buf, addr))
#endif
extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch); extern int gdbarch_integer_to_address_p (struct gdbarch *gdbarch);

View file

@ -407,7 +407,8 @@ v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::f
# / addr_bit will be set from it. # / addr_bit will be set from it.
# #
# If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably # If TARGET_PTR_BIT and TARGET_ADDR_BIT are different, you'll probably
# also need to set POINTER_TO_ADDRESS and ADDRESS_TO_POINTER as well. # also need to set gdbarch_pointer_to_address and gdbarch_address_to_pointer
# as well.
# #
# ptr_bit is the size of a pointer on the target # ptr_bit is the size of a pointer on the target
v:TARGET_PTR_BIT:int:ptr_bit:::8 * sizeof (void*):TARGET_INT_BIT::0 v:TARGET_PTR_BIT:int:ptr_bit:::8 * sizeof (void*):TARGET_INT_BIT::0
@ -496,8 +497,8 @@ f:=:void:value_to_register:struct frame_info *frame, int regnum, struct type *ty
# (but not the value contents) filled in. # (but not the value contents) filled in.
f::struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0 f::struct value *:value_from_register:struct type *type, int regnum, struct frame_info *frame:type, regnum, frame::default_value_from_register::0
# #
f:=:CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0 f::CORE_ADDR:pointer_to_address:struct type *type, const gdb_byte *buf:type, buf::unsigned_pointer_to_address::0
f:=:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0 f::void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::0
M::CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf M::CORE_ADDR:integer_to_address:struct type *type, const gdb_byte *buf:type, buf
# It has been suggested that this, well actually its predecessor, # It has been suggested that this, well actually its predecessor,

View file

@ -317,8 +317,8 @@ make_pointer_type (struct type *type, struct type **typeptr)
TYPE_CODE (ntype) = TYPE_CODE_PTR; TYPE_CODE (ntype) = TYPE_CODE_PTR;
/* Mark pointers as unsigned. The target converts between pointers /* Mark pointers as unsigned. The target converts between pointers
and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and
ADDRESS_TO_POINTER(). */ gdbarch_address_to_pointer. */
TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED; TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED;
if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */ if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */

View file

@ -2847,7 +2847,8 @@ procfs_address_to_host_pointer (CORE_ADDR addr)
void *ptr; void *ptr;
gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr)); gdb_assert (sizeof (ptr) == TYPE_LENGTH (builtin_type_void_data_ptr));
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, &ptr, addr); gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr,
&ptr, addr);
return ptr; return ptr;
} }

View file

@ -64,8 +64,8 @@ value_of_builtin_frame_reg (struct frame_info *frame, const void *baton)
memset (buf, 0, TYPE_LENGTH (value_type (val))); memset (buf, 0, TYPE_LENGTH (value_type (val)));
/* frame.base. */ /* frame.base. */
if (frame != NULL) if (frame != NULL)
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr,
get_frame_base (frame)); buf, get_frame_base (frame));
buf += TYPE_LENGTH (builtin_type_void_data_ptr); buf += TYPE_LENGTH (builtin_type_void_data_ptr);
/* frame.XXX. */ /* frame.XXX. */
return val; return val;
@ -89,8 +89,8 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame, const void *baton)
if (frame == NULL) if (frame == NULL)
memset (buf, 0, TYPE_LENGTH (value_type (val))); memset (buf, 0, TYPE_LENGTH (value_type (val)));
else else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr,
get_frame_base_address (frame)); buf, get_frame_base_address (frame));
return val; return val;
} }
} }
@ -107,8 +107,8 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame, const void *baton)
if (frame == NULL) if (frame == NULL)
memset (buf, 0, TYPE_LENGTH (value_type (val))); memset (buf, 0, TYPE_LENGTH (value_type (val)));
else else
ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr,
get_frame_pc (frame)); buf, get_frame_pc (frame));
return val; return val;
} }
} }

View file

@ -2559,7 +2559,7 @@ paddress (CORE_ADDR addr)
when it won't occur. */ when it won't occur. */
/* NOTE: This assumes that the significant address information is /* NOTE: This assumes that the significant address information is
kept in the least significant bits of ADDR - the upper bits were kept in the least significant bits of ADDR - the upper bits were
either zero or sign extended. Should ADDRESS_TO_POINTER() or either zero or sign extended. Should gdbarch_address_to_pointer or
some ADDRESS_TO_PRINTABLE() be used to do the conversion? */ some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
int addr_bit = TARGET_ADDR_BIT; int addr_bit = TARGET_ADDR_BIT;

View file

@ -374,7 +374,7 @@ value_cast (struct type *type, struct value *arg2)
LONGEST longest; LONGEST longest;
/* When we cast pointers to integers, we mustn't use /* When we cast pointers to integers, we mustn't use
POINTER_TO_ADDRESS to find the address the pointer gdbarch_pointer_to_address to find the address the pointer
represents, as value_as_long would. GDB should evaluate represents, as value_as_long would. GDB should evaluate
expressions just as the compiler would --- and the compiler expressions just as the compiler would --- and the compiler
sees a cast as a simple reinterpretation of the pointer's sees a cast as a simple reinterpretation of the pointer's