This is the mail archive of the
gdb-patches@sources.redhat.com
mailing list for the GDB project.
[patch] Copy comments into gdbarch.h
- To: GDB Patches <gdb-patches at sourceware dot cygnus dot com>
- Subject: [patch] Copy comments into gdbarch.h
- From: Andrew Cagney <ac131313 at cygnus dot com>
- Date: Tue, 01 Aug 2000 20:30:12 +1000
FYI,
I've checked in the attatched. If you add comments to the gdbarch
table, they now appear in the gdbarch.h header file.
Andrew
Tue Aug 1 17:45:12 2000 Andrew Cagney <cagney@b1.cygnus.com>
* gdbarch.sh: Parse and save comments in the function_list. Print
them out as part of the header. Convert all function definitions
to ISO-C form.
* gdbarch.h, gdbarch.c: Regenerate.
Index: gdbarch.h
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.h,v
retrieving revision 1.26
diff -p -r1.26 gdbarch.h
*** gdbarch.h 2000/07/27 04:01:24 1.26
--- gdbarch.h 2000/08/01 10:15:29
*************** extern void set_gdbarch_ptr_bit (struct
*** 100,105 ****
--- 100,107 ----
#endif
#endif
+ /*v:1:TARGET_CHAR_BIT:int:char_bit::::8 * sizeof (char):0 */
+
extern int gdbarch_short_bit (struct gdbarch *gdbarch);
extern void set_gdbarch_short_bit (struct gdbarch *gdbarch, int short_bit);
#if GDB_MULTI_ARCH
*************** extern void set_gdbarch_num_regs (struct
*** 231,236 ****
--- 233,243 ----
#endif
#endif
+ /* This macro gives the number of pseudo-registers that live in the
+ register namespace but do not get fetched or stored on the target.
+ These pseudo-registers may be aliases for other registers,
+ combinations of other registers, or they may be computed by GDB. */
+
/* Default (value) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (NUM_PSEUDO_REGS)
#define NUM_PSEUDO_REGS (0)
*************** extern void set_gdbarch_register_convert
*** 595,600 ****
--- 602,611 ----
#endif
#endif
+ /* This function is called when the value of a pseudo-register needs to
+ be updated. Typically it will be defined on a per-architecture
+ basis. */
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (FETCH_PSEUDO_REGISTER)
#define FETCH_PSEUDO_REGISTER(regnum) (internal_error ("FETCH_PSEUDO_REGISTER"), 0)
*************** extern void set_gdbarch_fetch_pseudo_reg
*** 609,614 ****
--- 620,629 ----
#endif
#endif
+ /* This function is called when the value of a pseudo-register needs to
+ be set or stored. Typically it will be defined on a
+ per-architecture basis. */
+
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (STORE_PSEUDO_REGISTER)
#define STORE_PSEUDO_REGISTER(regnum) (internal_error ("STORE_PSEUDO_REGISTER"), 0)
*************** extern void set_gdbarch_pop_frame (struc
*** 709,714 ****
--- 724,731 ----
#define POP_FRAME (gdbarch_pop_frame (current_gdbarch))
#endif
#endif
+
+ /* I wish that these would just go away.... */
/* Default (function) for non- multi-arch platforms. */
#if (!GDB_MULTI_ARCH) && !defined (D10V_MAKE_DADDR)
Index: gdbarch.sh
===================================================================
RCS file: /cvs/src/src/gdb/gdbarch.sh,v
retrieving revision 1.32
diff -p -r1.32 gdbarch.sh
*** gdbarch.sh 2000/07/27 04:01:24 1.32
--- gdbarch.sh 2000/08/01 10:15:34
*************** read="class level macro returntype funct
*** 39,84 ****
do_read ()
{
! if eval read $read
! then
! test "${staticdefault}" || staticdefault=0
! # NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
! # multi-arch defaults.
! # test "${predefault}" || predefault=0
! test "${fmt}" || fmt="%ld"
! test "${print}" || print="(long) ${macro}"
! case "${invalid_p}" in
! 0 ) valid_p=1 ;;
! "" )
! if [ "${predefault}" ]
! then
! #invalid_p="gdbarch->${function} == ${predefault}"
! valid_p="gdbarch->${function} != ${predefault}"
! else
! #invalid_p="gdbarch->${function} == 0"
! valid_p="gdbarch->${function} != 0"
! fi
! ;;
! * ) valid_p="!(${invalid_p})"
! esac
!
! # PREDEFAULT is a valid fallback definition of MEMBER when
! # multi-arch is not enabled. This ensures that the default
! # value, when multi-arch is the same as the default value when
! # not multi-arch. POSTDEFAULT is always a valid definition of
! # MEMBER as this again ensures consistency.
! if [ "${postdefault}" != "" ]
then
! fallbackdefault="${postdefault}"
! elif [ "${predefault}" != "" ]
then
! fallbackdefault="${predefault}"
else
! fallbackdefault=""
fi
! #NOT YET:
! # See gdbarch.log for basic verification of database
! :
else
false
fi
--- 39,112 ----
do_read ()
{
! comment=""
! class=""
! while read line
! do
! if test "${line}" = ""
! then
! continue
! elif test "${line}" = "#" -a "${comment}" = ""
then
! continue
! elif expr "${line}" : "#" > /dev/null
then
! comment="${comment}
! ${line}"
else
! OFS="${IFS}" ; IFS=":"
! eval read ${read} <<EOF
! ${line}
! EOF
! IFS="${OFS}"
!
! test "${staticdefault}" || staticdefault=0
! # NOT YET: Breaks BELIEVE_PCC_PROMOTION and confuses non-
! # multi-arch defaults.
! # test "${predefault}" || predefault=0
! test "${fmt}" || fmt="%ld"
! test "${print}" || print="(long) ${macro}"
! case "${invalid_p}" in
! 0 ) valid_p=1 ;;
! "" )
! if [ "${predefault}" ]
! then
! #invalid_p="gdbarch->${function} == ${predefault}"
! valid_p="gdbarch->${function} != ${predefault}"
! else
! #invalid_p="gdbarch->${function} == 0"
! valid_p="gdbarch->${function} != 0"
! fi
! ;;
! * ) valid_p="!(${invalid_p})"
! esac
!
! # PREDEFAULT is a valid fallback definition of MEMBER when
! # multi-arch is not enabled. This ensures that the
! # default value, when multi-arch is the same as the
! # default value when not multi-arch. POSTDEFAULT is
! # always a valid definition of MEMBER as this again
! # ensures consistency.
!
! if [ "${postdefault}" != "" ]
! then
! fallbackdefault="${postdefault}"
! elif [ "${predefault}" != "" ]
! then
! fallbackdefault="${predefault}"
! else
! fallbackdefault=""
! fi
!
! #NOT YET: See gdbarch.log for basic verification of
! # database
!
! break
fi
! done
! if [ "${class}" ]
! then
! true
else
false
fi
*************** do
*** 264,275 ****
esac
done
- IFS=:
function_list ()
{
# See below (DOCO) for description of each field
! cat <<EOF |
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
--- 292,302 ----
esac
done
function_list ()
{
# See below (DOCO) for description of each field
! cat <<EOF
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
*************** f:1:GET_SAVED_REGISTER:void:get_saved_re
*** 338,350 ****
f:1:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0
! #This function is called when the value of a pseudo-register needs
! #to be updated. Typically it will be defined on a per-architecture
! #basis.
f:2:FETCH_PSEUDO_REGISTER:void:fetch_pseudo_register:int regnum:regnum:::0::0
! #This function is called when the value of a pseudo-register needs
! #to be set or stored. Typically it will be defined on a per-architecture
! #basis.
f:2:STORE_PSEUDO_REGISTER:void:store_pseudo_register:int regnum:regnum:::0::0
#
f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0
--- 365,377 ----
f:1:REGISTER_CONVERTIBLE:int:register_convertible:int nr:nr:::generic_register_convertible_not::0
f:2:REGISTER_CONVERT_TO_VIRTUAL:void:register_convert_to_virtual:int regnum, struct type *type, char *from, char *to:regnum, type, from, to:::0::0
f:2:REGISTER_CONVERT_TO_RAW:void:register_convert_to_raw:struct type *type, int regnum, char *from, char *to:type, regnum, from, to:::0::0
! # This function is called when the value of a pseudo-register needs to
! # be updated. Typically it will be defined on a per-architecture
! # basis.
f:2:FETCH_PSEUDO_REGISTER:void:fetch_pseudo_register:int regnum:regnum:::0::0
! # This function is called when the value of a pseudo-register needs to
! # be set or stored. Typically it will be defined on a
! # per-architecture basis.
f:2:STORE_PSEUDO_REGISTER:void:store_pseudo_register:int regnum:regnum:::0::0
#
f:2:POINTER_TO_ADDRESS:CORE_ADDR:pointer_to_address:struct type *type, void *buf:type, buf:::unsigned_pointer_to_address::0
*************** v:2:TARGET_FLOAT_FORMAT:const struct flo
*** 402,415 ****
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
EOF
- grep -v '^#'
}
#
# The .log file
#
exec > new-gdbarch.log
! function_list | while do_read # eval read $read
do
cat <<EOF
${class} ${macro}(${actual})
--- 429,441 ----
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
EOF
}
#
# The .log file
#
exec > new-gdbarch.log
! function_list | while do_read
do
cat <<EOF
${class} ${macro}(${actual})
*************** EOF
*** 521,527 ****
echo ""
echo ""
echo "/* The following are pre-initialized by GDBARCH. */"
! function_list | while do_read # eval read $read
do
if class_is_info_p
then
--- 547,553 ----
echo ""
echo ""
echo "/* The following are pre-initialized by GDBARCH. */"
! function_list | while do_read
do
if class_is_info_p
then
*************** done
*** 540,547 ****
echo ""
echo ""
echo "/* The following are initialized by the target dependant code. */"
! function_list | while do_read # eval read $read
do
if class_is_predicate_p
then
echo ""
--- 566,580 ----
echo ""
echo ""
echo "/* The following are initialized by the target dependant code. */"
! function_list | while do_read
do
+ if [ "${comment}" ]
+ then
+ echo "${comment}" | sed \
+ -e '2 s,#,/*,' \
+ -e '3,$ s,#, ,' \
+ -e '$ s,$, */,'
+ fi
if class_is_predicate_p
then
echo ""
*************** echo ""
*** 990,996 ****
echo "struct gdbarch"
echo "{"
echo " /* basic architectural information */"
! function_list | while do_read # eval read $read
do
if class_is_info_p
then
--- 1023,1029 ----
echo "struct gdbarch"
echo "{"
echo " /* basic architectural information */"
! function_list | while do_read
do
if class_is_info_p
then
*************** cat <<EOF
*** 1037,1043 ****
*/
EOF
! function_list | while do_read # eval read $read
do
if class_is_variable_p
then
--- 1070,1076 ----
*/
EOF
! function_list | while do_read
do
if class_is_variable_p
then
*************** cat <<EOF
*** 1076,1082 ****
0, NULL, NULL,
/* Multi-arch values */
EOF
! function_list | while do_read # eval read $read
do
if class_is_function_p || class_is_variable_p
then
--- 1109,1115 ----
0, NULL, NULL,
/* Multi-arch values */
EOF
! function_list | while do_read
do
if class_is_function_p || class_is_variable_p
then
*************** gdbarch_alloc (const struct gdbarch_info
*** 1109,1115 ****
gdbarch->tdep = tdep;
EOF
echo ""
! function_list | while do_read # eval read $read
do
if class_is_info_p
then
--- 1142,1148 ----
gdbarch->tdep = tdep;
EOF
echo ""
! function_list | while do_read
do
if class_is_info_p
then
*************** do
*** 1118,1124 ****
done
echo ""
echo " /* Force the explicit initialization of these. */"
! function_list | while do_read # eval read $read
do
if class_is_function_p || class_is_variable_p
then
--- 1151,1157 ----
done
echo ""
echo " /* Force the explicit initialization of these. */"
! function_list | while do_read
do
if class_is_function_p || class_is_variable_p
then
*************** verify_gdbarch (struct gdbarch *gdbarch)
*** 1172,1178 ****
internal_error ("verify_gdbarch: bfd_arch_info unset");
/* Check those that need to be defined for the given multi-arch level. */
EOF
! function_list | while do_read # eval read $read
do
if class_is_function_p || class_is_variable_p
then
--- 1205,1211 ----
internal_error ("verify_gdbarch: bfd_arch_info unset");
/* Check those that need to be defined for the given multi-arch level. */
EOF
! function_list | while do_read
do
if class_is_function_p || class_is_variable_p
then
*************** gdbarch_dump (struct gdbarch *gdbarch, s
*** 1233,1239 ****
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 */"
--- 1266,1272 ----
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 */"
*************** gdbarch_tdep (struct gdbarch *gdbarch)
*** 1301,1307 ****
}
EOF
echo ""
! function_list | while do_read # eval read $read
do
if class_is_predicate_p
then
--- 1334,1340 ----
}
EOF
echo ""
! function_list | while do_read
do
if class_is_predicate_p
then
*************** init_gdbarch_data (struct gdbarch *gdbar
*** 1457,1464 ****
data-pointer. */
void *
! gdbarch_data (data)
! struct gdbarch_data *data;
{
if (data->index >= current_gdbarch->nr_data)
internal_error ("gdbarch_data: request for non-existant data.");
--- 1490,1496 ----
data-pointer. */
void *
! gdbarch_data (struct gdbarch_data *data)
{
if (data->index >= current_gdbarch->nr_data)
internal_error ("gdbarch_data: request for non-existant data.");
*************** disassemble_info tm_print_insn_info;
*** 1850,1856 ****
extern void _initialize_gdbarch (void);
void
! _initialize_gdbarch ()
{
struct cmd_list_element *c;
--- 1882,1888 ----
extern void _initialize_gdbarch (void);
void
! _initialize_gdbarch (void)
{
struct cmd_list_element *c;