This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] multi-arch ADDR_BITS_REMOVE; Was: New gdb 31 & 64 bit patches for S/390
- To: DJBARROW at de dot ibm dot com
- Subject: [patch] multi-arch ADDR_BITS_REMOVE; Was: New gdb 31 & 64 bit patches for S/390
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Fri, 15 Jun 2001 18:09:24 -0400
- Cc: gdb-patches at sourceware dot cygnus dot com, s390-patches at gnu dot org,schwidefsky at de dot ibm dot com, ARENZ at de dot ibm dot com
- References: <C1256A00.006F3FCE.00@d12mta09.de.ibm.com>
Hello,
(more s390 fallout) This patch multi-arches the ADDR_BITS_REMOVE
function. It uses a generic core_addr_identity() function as the default.
Andrew
2001-06-15 Andrew Cagney <ac131313@redhat.com>
* arch-utils.c (core_addr_identity): New function. Rename
default_convert_from_func_ptr_addr.
* gdbarch.sh (CONVERT_FROM_FUNC_PTR_ADDR): Update.
(ADDR_BITS_REMOVE): Define. Default to core_addr_identity.
* defs.h (ADDR_BITS_REMOVE): Delete macro definition.
* config/mips/tm-mips.h (ADDR_BITS_REMOVE): Delete definition.
* mips-tdep.c (mips_addr_bits_remove): Make static.
(mips_gdbarch_init): Initialize addr_bits_remove.
Index: arch-utils.c
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.c,v
retrieving revision 1.29
diff -p -r1.29 arch-utils.c
*** arch-utils.c 2001/06/06 17:47:28 1.29
--- arch-utils.c 2001/06/15 22:02:53
*************** default_register_sim_regno (int num)
*** 222,228 ****
CORE_ADDR
! default_convert_from_func_ptr_addr (CORE_ADDR addr)
{
return addr;
}
--- 222,228 ----
CORE_ADDR
! core_addr_identity (CORE_ADDR addr)
{
return addr;
}
Index: arch-utils.h
===================================================================
RCS file: /cvs/src/src/gdb/arch-utils.h,v
retrieving revision 1.14
diff -p -r1.14 arch-utils.h
*** arch-utils.h 2001/04/06 17:53:39 1.14
--- arch-utils.h 2001/06/15 22:02:53
*************** extern int (*target_architecture_hook) (
*** 93,101 ****
extern int default_register_sim_regno (int reg_nr);
! /* Default conversion of function pointer address - returns address. */
! extern CORE_ADDR default_convert_from_func_ptr_addr (CORE_ADDR addr);
/* No-op conversion of reg to regnum. */
--- 93,101 ----
extern int default_register_sim_regno (int reg_nr);
! /* Identity function on a CORE_ADDR. Just returns its parameter. */
! extern CORE_ADDR core_addr_identity (CORE_ADDR addr);
/* No-op conversion of reg to regnum. */
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.53
diff -p -r1.53 defs.h
*** defs.h 2001/06/12 15:03:04 1.53
--- defs.h 2001/06/15 22:02:53
*************** extern char *floatformat_mantissa (const
*** 1259,1277 ****
extern DOUBLEST extract_floating (void *, int);
extern void store_floating (void *, int, DOUBLEST);
- /* On some machines there are bits in addresses which are not really
- part of the address, but are used by the kernel, the hardware, etc.
- for special purposes. ADDR_BITS_REMOVE takes out any such bits
- so we get a "real" address such as one would find in a symbol
- table. This is used only for addresses of instructions, and even then
- I'm not sure it's used in all contexts. It exists to deal with there
- being a few stray bits in the PC which would mislead us, not as some sort
- of generic thing to handle alignment or segmentation (it's possible it
- should be in TARGET_READ_PC instead). */
- #if !defined (ADDR_BITS_REMOVE)
- #define ADDR_BITS_REMOVE(addr) (addr)
- #endif /* No ADDR_BITS_REMOVE. */
-
/* From valops.c */
extern CORE_ADDR push_bytes (CORE_ADDR, char *, int);
--- 1259,1264 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.67
diff -p -r1.67 gdbarch.sh
*** gdbarch.sh 2001/06/15 19:19:23 1.67
--- gdbarch.sh 2001/06/15 22:02:56
*************** v:2:PARM_BOUNDARY:int:parm_boundary
*** 513,519 ****
v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)
v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)
v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::&floatformat_unknown
! f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::default_convert_from_func_ptr_addr::0
# FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if
# the target needs software single step. An ISA method to implement it.
#
--- 513,529 ----
v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_float_format (gdbarch)
v:2:TARGET_DOUBLE_FORMAT:const struct floatformat *:double_format::::::default_double_format (gdbarch)
v:2:TARGET_LONG_DOUBLE_FORMAT:const struct floatformat *:long_double_format::::::&floatformat_unknown
! f:2:CONVERT_FROM_FUNC_PTR_ADDR:CORE_ADDR:convert_from_func_ptr_addr:CORE_ADDR addr:addr:::core_addr_identity::0
! # On some machines there are bits in addresses which are not really
! # part of the address, but are used by the kernel, the hardware, etc.
! # for special purposes. ADDR_BITS_REMOVE takes out any such bits so
! # we get a "real" address such as one would find in a symbol table.
! # This is used only for addresses of instructions, and even then I'm
! # not sure it's used in all contexts. It exists to deal with there
! # being a few stray bits in the PC which would mislead us, not as some
! # sort of generic thing to handle alignment or segmentation (it's
! # possible it should be in TARGET_READ_PC instead).
! f:2:ADDR_BITS_REMOVE:CORE_ADDR:addr_bits_remove:CORE_ADDR addr:addr:::core_addr_identity::0
# FIXME/cagney/2001-01-18: This should be split in two. A target method that indicates if
# the target needs software single step. An ISA method to implement it.
#
Index: mips-tdep.c
===================================================================
RCS file: /cvs/src/src/gdb/mips-tdep.c,v
retrieving revision 1.51
diff -p -r1.51 mips-tdep.c
*** mips-tdep.c 2001/06/07 15:57:57 1.51
--- mips-tdep.c 2001/06/15 22:02:57
*************** read_next_frame_reg (struct frame_info *
*** 1340,1346 ****
/* mips_addr_bits_remove - remove useless address bits */
! CORE_ADDR
mips_addr_bits_remove (CORE_ADDR addr)
{
if (GDB_TARGET_IS_MIPS64)
--- 1340,1346 ----
/* mips_addr_bits_remove - remove useless address bits */
! static CORE_ADDR
mips_addr_bits_remove (CORE_ADDR addr)
{
if (GDB_TARGET_IS_MIPS64)
*************** mips_gdbarch_init (struct gdbarch_info i
*** 4122,4127 ****
--- 4122,4131 ----
set_gdbarch_write_fp (gdbarch, generic_target_write_fp);
set_gdbarch_read_sp (gdbarch, generic_target_read_sp);
set_gdbarch_write_sp (gdbarch, generic_target_write_sp);
+
+ /* Add/remove bits from an address. The MIPS needs be careful to
+ ensure that all 32 bit addresses are sign extended to 64 bits. */
+ set_gdbarch_addr_bits_remove (gdbarch, mips_addr_bits_remove);
/* Map debug register numbers onto internal register numbers. */
set_gdbarch_stab_reg_to_regnum (gdbarch, mips_stab_reg_to_regnum);
Index: config/mips/tm-mips.h
===================================================================
RCS file: /cvs/src/src/gdb/config/mips/tm-mips.h,v
retrieving revision 1.18
diff -p -r1.18 tm-mips.h
*** tm-mips.h 2001/03/14 23:23:13 1.18
--- tm-mips.h 2001/06/15 22:02:58
*************** struct value;
*** 55,65 ****
#define DEFAULT_MIPS_TYPE "generic"
- /* Remove useless bits from an instruction address. */
-
- #define ADDR_BITS_REMOVE(addr) mips_addr_bits_remove(addr)
- CORE_ADDR mips_addr_bits_remove (CORE_ADDR addr);
-
/* Remove useless bits from the stack pointer. */
#define TARGET_READ_SP() ADDR_BITS_REMOVE (read_register (SP_REGNUM))
--- 55,60 ----