This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[PATCH] TARGET_ADDR_BIT
- To: gdb-patches at sourceware dot cygnus dot com
- Subject: [PATCH] TARGET_ADDR_BIT
- From: David Taylor <taylor at cygnus dot com>
- Date: Fri, 25 Aug 2000 17:13:13 -0400
The following patch has been applied:
[NOTE: I'm not including the diffs for gdbarch.c and gdbarch.h -- they
can be generated from gdbarch.sh]
Fri Aug 25 12:03:15 2000 David Taylor <taylor@texas.cygnus.com>
* gdbarch.sh (TARGET_ADDR_BIT): New macro for the number
of bits in gdb's representation of a target address.
* gdbarch.c, gdbarch.h: Regenerated.
* gdbtypes.c (build_gdbtypes): Use TARGET_ADDR_BIT instead of
TARGET_PTR_BIT when initializing builtin_type_CORE_ADDR.
* printcmd.c (print_address_numeric): Use TARGET_ADDR_BIT instead
of TARGET_PTR_BIT, because we're printing an address, not a pointer.
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.40
retrieving revision 1.41
diff -c -r1.40 -r1.41
*** gdbarch.sh 2000/08/11 03:19:22 1.40
--- gdbarch.sh 2000/08/25 20:51:19 1.41
***************
*** 319,326 ****
v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
# Number of bits in a long double for the target machine.
v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):2*TARGET_DOUBLE_BIT::0
! # Number of bits in a pointer for the target machine
v::TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):TARGET_INT_BIT::0
# Number of bits in a BFD_VMA for the target object file format.
v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
#
--- 319,336 ----
v::TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):8*TARGET_CHAR_BIT::0
# Number of bits in a long double for the target machine.
v::TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):2*TARGET_DOUBLE_BIT::0
! # For most targets, a pointer on the target and its representation as an
! # address in GDB have the same size and "look the same". For such a
! # target, you need only set TARGET_PTR_BIT / ptr_bit and TARGET_ADDR_BIT
! # / 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.
! #
! # 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
+ # addr_bit is the size of a target address as represented in gdb
+ v::TARGET_ADDR_BIT:int:addr_bit::::8 * sizeof (void*):0:TARGET_PTR_BIT:
# Number of bits in a BFD_VMA for the target object file format.
v::TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
#
***************
*** 515,527 ****
/* This file was created with the aid of \`\`gdbarch.sh''.
! The bourn shell script \`\`gdbarch.sh'' creates the files
\`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
against the existing \`\`gdbarch.[hc]''. Any differences found
being reported.
If editing this file, please also run gdbarch.sh and merge any
! changes into that script. Conversely, when makeing sweeping changes
to this file, modifying gdbarch.sh and using its output may prove
easier. */
--- 525,537 ----
/* This file was created with the aid of \`\`gdbarch.sh''.
! The Bourne shell script \`\`gdbarch.sh'' creates the files
\`\`new-gdbarch.c'' and \`\`new-gdbarch.h and then compares them
against the existing \`\`gdbarch.[hc]''. Any differences found
being reported.
If editing this file, please also run gdbarch.sh and merge any
! changes into that script. Conversely, when making sweeping changes
to this file, modifying gdbarch.sh and using its output may prove
easier. */
Index: gdbtypes.c
===================================================================
RCS file: /cvs/src/src/gdb/gdbtypes.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -c -r1.12 -r1.13
*** gdbtypes.c 2000/07/30 01:48:25 1.12
--- gdbtypes.c 2000/08/25 20:51:19 1.13
***************
*** 2929,2935 ****
though the two can be different (cf d10v) */
builtin_type_ptr = make_pointer_type (builtin_type_void, NULL);
builtin_type_CORE_ADDR =
! init_type (TYPE_CODE_INT, TARGET_PTR_BIT / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
builtin_type_bfd_vma =
--- 2929,2935 ----
though the two can be different (cf d10v) */
builtin_type_ptr = make_pointer_type (builtin_type_void, NULL);
builtin_type_CORE_ADDR =
! init_type (TYPE_CODE_INT, TARGET_ADDR_BIT / 8,
TYPE_FLAG_UNSIGNED,
"__CORE_ADDR", (struct objfile *) NULL);
builtin_type_bfd_vma =
Index: printcmd.c
===================================================================
RCS file: /cvs/src/src/gdb/printcmd.c,v
retrieving revision 1.12
retrieving revision 1.13
diff -c -r1.12 -r1.13
*** printcmd.c 2000/07/30 01:48:26 1.12
--- printcmd.c 2000/08/25 20:51:19 1.13
***************
*** 726,734 ****
kept in the least significant bits of ADDR - the upper bits were
either zero or sign extended. Should ADDRESS_TO_POINTER() or
some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
! int ptr_bit = TARGET_PTR_BIT;
! if (ptr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
! addr &= ((CORE_ADDR) 1 << ptr_bit) - 1;
print_longest (stream, 'x', use_local, (ULONGEST) addr);
}
--- 726,734 ----
kept in the least significant bits of ADDR - the upper bits were
either zero or sign extended. Should ADDRESS_TO_POINTER() or
some ADDRESS_TO_PRINTABLE() be used to do the conversion? */
! int addr_bit = TARGET_ADDR_BIT;
! if (addr_bit < (sizeof (CORE_ADDR) * HOST_CHAR_BIT))
! addr &= ((CORE_ADDR) 1 << addr_bit) - 1;
print_longest (stream, 'x', use_local, (ULONGEST) addr);
}