From 76e713237b3bb87b52b7716262a63fefd4a7f0bf Mon Sep 17 00:00:00 2001 From: Ulrich Weigand Date: Wed, 6 Jun 2007 15:23:06 +0000 Subject: [PATCH] 2007-06-06 Markus Deuling * 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. --- gdb/ChangeLog | 18 ++++++++++++++++++ gdb/findvar.c | 4 ++-- gdb/gdbarch.c | 12 ------------ gdb/gdbarch.h | 15 ++------------- gdb/gdbarch.sh | 7 ++++--- gdb/gdbtypes.c | 4 ++-- gdb/procfs.c | 3 ++- gdb/std-regs.c | 12 ++++++------ gdb/utils.c | 2 +- gdb/valops.c | 2 +- 10 files changed, 38 insertions(+), 41 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 349bbfd228..2034513c05 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,21 @@ +2007-06-06 Markus Deuling + + * 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 * gdbarch.sh (GET_LONGJMP_TARGET): Replace by gdbarch_get_longjmp_target. diff --git a/gdb/findvar.c b/gdb/findvar.c index 437ec2d4b0..e3f9fd528f 100644 --- a/gdb/findvar.c +++ b/gdb/findvar.c @@ -174,7 +174,7 @@ extract_typed_address (const gdb_byte *buf, struct type *type) _("extract_typed_address: " "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: " "type is not a pointer or reference")); - ADDRESS_TO_POINTER (type, buf, addr); + gdbarch_address_to_pointer (current_gdbarch, type, buf, addr); } diff --git a/gdb/gdbarch.c b/gdb/gdbarch.c index 11957fe3d5..5c95bbeb15 100644 --- a/gdb/gdbarch.c +++ b/gdb/gdbarch.c @@ -703,12 +703,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: address_class_type_flags_to_name = <0x%lx>\n", (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, "gdbarch_dump: address_to_pointer = <0x%lx>\n", (long) current_gdbarch->address_to_pointer); @@ -1184,12 +1178,6 @@ gdbarch_dump (struct gdbarch *current_gdbarch, struct ui_file *file) fprintf_unfiltered (file, "gdbarch_dump: pc_regnum = %s\n", 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, "gdbarch_dump: pointer_to_address = <0x%lx>\n", (long) current_gdbarch->pointer_to_address); diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index 9e1f700f68..42ef4b2b39 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -194,7 +194,8 @@ extern void set_gdbarch_long_double_format (struct gdbarch *gdbarch, const struc / addr_bit will be set from it. 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 */ @@ -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); 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); -#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); 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); -#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); diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index d7cc4bedb2..774c8d64ab 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -407,7 +407,8 @@ v:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat **:long_double_format:::::f # / addr_bit will be set from it. # # 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 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. 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:=:void:address_to_pointer:struct type *type, gdb_byte *buf, CORE_ADDR addr:type, buf, addr::unsigned_address_to_pointer::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 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, diff --git a/gdb/gdbtypes.c b/gdb/gdbtypes.c index 159a5de0ae..9ea7b633fa 100644 --- a/gdb/gdbtypes.c +++ b/gdb/gdbtypes.c @@ -317,8 +317,8 @@ make_pointer_type (struct type *type, struct type **typeptr) TYPE_CODE (ntype) = TYPE_CODE_PTR; /* Mark pointers as unsigned. The target converts between pointers - and addresses (CORE_ADDRs) using POINTER_TO_ADDRESS() and - ADDRESS_TO_POINTER(). */ + and addresses (CORE_ADDRs) using gdbarch_pointer_to_address and + gdbarch_address_to_pointer. */ TYPE_FLAGS (ntype) |= TYPE_FLAG_UNSIGNED; if (!TYPE_POINTER_TYPE (type)) /* Remember it, if don't have one. */ diff --git a/gdb/procfs.c b/gdb/procfs.c index 606466ec4e..10baaf9223 100644 --- a/gdb/procfs.c +++ b/gdb/procfs.c @@ -2847,7 +2847,8 @@ procfs_address_to_host_pointer (CORE_ADDR addr) void *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; } diff --git a/gdb/std-regs.c b/gdb/std-regs.c index 2edcba8ac3..2aa5b36dfc 100644 --- a/gdb/std-regs.c +++ b/gdb/std-regs.c @@ -64,8 +64,8 @@ value_of_builtin_frame_reg (struct frame_info *frame, const void *baton) memset (buf, 0, TYPE_LENGTH (value_type (val))); /* frame.base. */ if (frame != NULL) - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, - get_frame_base (frame)); + gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr, + buf, get_frame_base (frame)); buf += TYPE_LENGTH (builtin_type_void_data_ptr); /* frame.XXX. */ return val; @@ -89,8 +89,8 @@ value_of_builtin_frame_fp_reg (struct frame_info *frame, const void *baton) if (frame == NULL) memset (buf, 0, TYPE_LENGTH (value_type (val))); else - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, - get_frame_base_address (frame)); + gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr, + buf, get_frame_base_address (frame)); return val; } } @@ -107,8 +107,8 @@ value_of_builtin_frame_pc_reg (struct frame_info *frame, const void *baton) if (frame == NULL) memset (buf, 0, TYPE_LENGTH (value_type (val))); else - ADDRESS_TO_POINTER (builtin_type_void_data_ptr, buf, - get_frame_pc (frame)); + gdbarch_address_to_pointer (current_gdbarch, builtin_type_void_data_ptr, + buf, get_frame_pc (frame)); return val; } } diff --git a/gdb/utils.c b/gdb/utils.c index f5325f692f..e1fb9ed48c 100644 --- a/gdb/utils.c +++ b/gdb/utils.c @@ -2559,7 +2559,7 @@ paddress (CORE_ADDR addr) when it won't occur. */ /* NOTE: This assumes that the significant address information is 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? */ int addr_bit = TARGET_ADDR_BIT; diff --git a/gdb/valops.c b/gdb/valops.c index b55f45fe95..d32bb0273a 100644 --- a/gdb/valops.c +++ b/gdb/valops.c @@ -374,7 +374,7 @@ value_cast (struct type *type, struct value *arg2) LONGEST longest; /* 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 expressions just as the compiler would --- and the compiler sees a cast as a simple reinterpretation of the pointer's -- 2.34.1