This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch/multi-arch] Move TARGET_*_BIT to gdbarch.h
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch/multi-arch] Move TARGET_*_BIT to gdbarch.h
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Thu, 10 Aug 2000 19:25:59 -0700
Hello,
The attatched patch moves the #ifdefs that provide default values for
all the TARGET_*_BIT macros to gdbarch.{h,c,sh}. This in turn means
that new multi-arch targets no longer need to provide values for these
macros (unless they differ from the supplied defaults).
Andrew
Thu Aug 10 18:58:04 2000 Andrew Cagney <cagney@makita.cygnus.com>
* defs.h (TARGET_BFD_VMA_BIT, TARGET_SHORT_BIT, TARGET_INT_BIT,
TARGET_LONG_BIT, TARGET_LONG_LONG_BIT, TARGET_FLOAT_BIT,
TARGET_DOUBLE_BIT, TARGET_LONG_DOUBLE_BIT, TARGET_PTR_BIT): Move
non- multi-arch handling from here.
* gdbarch.sh: To here. Update printf gdbarch_update_p. Make more
portable.
* gdbarch.h, gdbarch.c: Regenerate.
Index: defs.h
===================================================================
RCS file: /cvs/src/src/gdb/defs.h,v
retrieving revision 1.29
diff -p -r1.29 defs.h
*** defs.h 2000/08/02 11:11:47 1.29
--- defs.h 2000/08/11 02:16:25
*************** extern char *alloca ();
*** 1025,1075 ****
#define TARGET_CHAR_BIT 8
#endif
- /* Number of bits in a short or unsigned short for the target machine. */
- #if !defined (TARGET_SHORT_BIT)
- #define TARGET_SHORT_BIT (2 * TARGET_CHAR_BIT)
- #endif
-
- /* Number of bits in an int or unsigned int for the target machine. */
- #if !defined (TARGET_INT_BIT)
- #define TARGET_INT_BIT (4 * TARGET_CHAR_BIT)
- #endif
-
- /* Number of bits in a long or unsigned long for the target machine. */
- #if !defined (TARGET_LONG_BIT)
- #define TARGET_LONG_BIT (4 * TARGET_CHAR_BIT)
- #endif
-
- /* Number of bits in a long long or unsigned long long for the target machine. */
- #if !defined (TARGET_LONG_LONG_BIT)
- #define TARGET_LONG_LONG_BIT (2 * TARGET_LONG_BIT)
- #endif
-
- /* Number of bits in a float for the target machine. */
- #if !defined (TARGET_FLOAT_BIT)
- #define TARGET_FLOAT_BIT (4 * TARGET_CHAR_BIT)
- #endif
-
- /* Number of bits in a double for the target machine. */
- #if !defined (TARGET_DOUBLE_BIT)
- #define TARGET_DOUBLE_BIT (8 * TARGET_CHAR_BIT)
- #endif
-
- /* Number of bits in a long double for the target machine. */
- #if !defined (TARGET_LONG_DOUBLE_BIT)
- #define TARGET_LONG_DOUBLE_BIT (2 * TARGET_DOUBLE_BIT)
- #endif
-
- /* Number of bits in a pointer for the target machine */
- #if !defined (TARGET_PTR_BIT)
- #define TARGET_PTR_BIT TARGET_INT_BIT
- #endif
-
- /* Number of bits in a BFD_VMA for the target object file format. */
- #if !defined (TARGET_BFD_VMA_BIT)
- #define TARGET_BFD_VMA_BIT TARGET_PTR_BIT
- #endif
-
/* If we picked up a copy of CHAR_BIT from a configuration file
(which may get it by including <limits.h>) then use it to set
the number of bits in a host char. If not, use the same size
--- 1025,1030 ----
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.38
diff -p -r1.38 gdbarch.sh
*** gdbarch.sh 2000/08/11 01:30:11 1.38
--- gdbarch.sh 2000/08/11 02:16:28
***************
*** 1,4 ****
! #!/usr/local/bin/bash -u
# Architecture commands for GDB, the GNU debugger.
# Copyright 1998-2000 Free Software Foundation, Inc.
--- 1,4 ----
! #!/bin/sh -u
# Architecture commands for GDB, the GNU debugger.
# Copyright 1998-2000 Free Software Foundation, Inc.
***************
*** 22,28 ****
compare_new ()
{
file=$1
! if ! test -r ${file}
then
echo "${file} missing? cp new-${file} ${file}" 1>&2
elif diff -c ${file} new-${file}
--- 22,28 ----
compare_new ()
{
file=$1
! if test ! -r ${file}
then
echo "${file} missing? cp new-${file} ${file}" 1>&2
elif diff -c ${file} new-${file}
*************** function_list ()
*** 300,316 ****
i:2:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
#
i:2:TARGET_BYTE_ORDER:int:byte_order::::BIG_ENDIAN
#
- v:1:TARGET_BFD_VMA_BIT:int:bfd_vma_bit::::8 * sizeof (void*):TARGET_ARCHITECTURE->bits_per_address::0
- v:1:TARGET_PTR_BIT:int:ptr_bit::::8 * sizeof (void*):0
- #v:1:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):0
- v:1:TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):0
- v:1:TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):0
- v:1:TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):0
- v:1:TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):0
- v:1:TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):0
- v:1:TARGET_DOUBLE_BIT:int:double_bit::::8 * sizeof (double):0
- v:1:TARGET_LONG_DOUBLE_BIT:int:long_double_bit::::8 * sizeof (long double):0
v:1:IEEE_FLOAT:int:ieee_float::::0:0::0:::
#
f:1:TARGET_READ_PC:CORE_ADDR:read_pc:int pid:pid::0:0
--- 300,329 ----
i:2:TARGET_ARCHITECTURE:const struct bfd_arch_info *:bfd_arch_info::::&bfd_default_arch_struct::::%s:TARGET_ARCHITECTURE->printable_name:TARGET_ARCHITECTURE != NULL
#
i:2:TARGET_BYTE_ORDER:int:byte_order::::BIG_ENDIAN
+ # Number of bits in a char or unsigned char for the target machine.
+ # Just like CHAR_BIT in <limits.h> but describes the target machine.
+ # v::TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):8::0:
+ #
+ # Number of bits in a short or unsigned short for the target machine.
+ v::TARGET_SHORT_BIT:int:short_bit::::8 * sizeof (short):2*TARGET_CHAR_BIT::0
+ # Number of bits in an int or unsigned int for the target machine.
+ v::TARGET_INT_BIT:int:int_bit::::8 * sizeof (int):4*TARGET_CHAR_BIT::0
+ # Number of bits in a long or unsigned long for the target machine.
+ v::TARGET_LONG_BIT:int:long_bit::::8 * sizeof (long):4*TARGET_CHAR_BIT::0
+ # Number of bits in a long long or unsigned long long for the target
+ # machine.
+ v::TARGET_LONG_LONG_BIT:int:long_long_bit::::8 * sizeof (LONGEST):2*TARGET_LONG_BIT::0
+ # Number of bits in a float for the target machine.
+ v::TARGET_FLOAT_BIT:int:float_bit::::8 * sizeof (float):4*TARGET_CHAR_BIT::0
+ # Number of bits in a double for the target machine.
+ 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
#
v:1:IEEE_FLOAT:int:ieee_float::::0:0::0:::
#
f:1:TARGET_READ_PC:CORE_ADDR:read_pc:int pid:pid::0:0
*************** f:1:TARGET_WRITE_FP:void:write_fp:CORE_A
*** 320,325 ****
--- 333,339 ----
f:1:TARGET_READ_SP:CORE_ADDR:read_sp:void:::0:0
f:1:TARGET_WRITE_SP:void:write_sp:CORE_ADDR val:val::0:0
#
+ #
v:2:NUM_REGS:int:num_regs::::0:-1
# This macro gives the number of pseudo-registers that live in the
# register namespace but do not get fetched or stored on the target.
*************** ${class} ${macro}(${actual})
*** 449,457 ****
staticdefault=${staticdefault}
predefault=${predefault}
postdefault=${postdefault}
! fallbackdefault=${fallbackdefault}
invalid_p=${invalid_p}
! valid_p=${valid_p}
fmt=${fmt}
print=${print}
print_p=${print_p}
--- 463,471 ----
staticdefault=${staticdefault}
predefault=${predefault}
postdefault=${postdefault}
! #fallbackdefault=${fallbackdefault}
invalid_p=${invalid_p}
! #valid_p=${valid_p}
fmt=${fmt}
print=${print}
print_p=${print_p}
*************** ${class} ${macro}(${actual})
*** 459,465 ****
EOF
if class_is_predicate_p && fallback_default_p
then
! echo "Error: predicate function can not have a non- multi-arch default" 1>&2
kill $$
exit 1
fi
--- 473,479 ----
EOF
if class_is_predicate_p && fallback_default_p
then
! echo "Error: predicate function ${macro} can not have a non- multi-arch default" 1>&2
kill $$
exit 1
fi
*************** EOF
*** 1134,1140 ****
echo ""
echo ""
cat <<EOF
! /* Create a new \`\`struct gdbarch'' based in information provided by
\`\`struct gdbarch_info''. */
EOF
echo ""
--- 1148,1154 ----
echo ""
echo ""
cat <<EOF
! /* Create a new \`\`struct gdbarch'' based on information provided by
\`\`struct gdbarch_info''. */
EOF
echo ""
*************** gdbarch_dump (struct gdbarch *gdbarch, s
*** 1273,1279 ****
EOF
function_list | while do_read
do
! if [ "${returntype}" == "void" ]
then
echo "#if defined (${macro}) && GDB_MULTI_ARCH"
echo " /* Macro might contain \`[{}]' when not multi-arch */"
--- 1287,1293 ----
EOF
function_list | while do_read
do
! if [ "${returntype}" = "void" ]
then
echo "#if defined (${macro}) && GDB_MULTI_ARCH"
echo " /* Macro might contain \`[{}]' when not multi-arch */"