diff options
author | Andrew Cagney <cagney@redhat.com> | 2000-08-01 10:31:19 +0000 |
---|---|---|
committer | Andrew Cagney <cagney@redhat.com> | 2000-08-01 10:31:19 +0000 |
commit | 34620563ede5a71f360ccceb85121a9b70e65c73 (patch) | |
tree | 9f122ba63166e909c2883756ddb27fb5d9da2754 /gdb | |
parent | 710b33bd11f6344967c225427e3bf392c9e155ce (diff) | |
download | gdb-34620563ede5a71f360ccceb85121a9b70e65c73.zip gdb-34620563ede5a71f360ccceb85121a9b70e65c73.tar.gz gdb-34620563ede5a71f360ccceb85121a9b70e65c73.tar.bz2 |
Copy comments from gdbarch.sh to gdbarch.h. Fix a number of K&R params.
Diffstat (limited to 'gdb')
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/gdbarch.h | 17 | ||||
-rwxr-xr-x | gdb/gdbarch.sh | 150 |
3 files changed, 115 insertions, 59 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 386220e..d421327 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +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. + Tue Aug 1 14:50:55 2000 Andrew Cagney <cagney@b1.cygnus.com> * top.c (get_prompt_1), tracepoint.c (replace_comma): Update diff --git a/gdb/gdbarch.h b/gdb/gdbarch.h index bc69f97..f78db27 100644 --- a/gdb/gdbarch.h +++ b/gdb/gdbarch.h @@ -100,6 +100,8 @@ extern void set_gdbarch_ptr_bit (struct gdbarch *gdbarch, int ptr_bit); #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 @@ -231,6 +233,11 @@ extern void set_gdbarch_num_regs (struct gdbarch *gdbarch, int num_regs); #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) @@ -595,6 +602,10 @@ extern void set_gdbarch_register_convert_to_raw (struct gdbarch *gdbarch, gdbarc #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) @@ -609,6 +620,10 @@ extern void set_gdbarch_fetch_pseudo_register (struct gdbarch *gdbarch, gdbarch_ #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) @@ -710,6 +725,8 @@ extern void set_gdbarch_pop_frame (struct gdbarch *gdbarch, gdbarch_pop_frame_ft #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) #define D10V_MAKE_DADDR(x) (internal_error ("D10V_MAKE_DADDR"), 0) diff --git a/gdb/gdbarch.sh b/gdb/gdbarch.sh index 12fe71e..36ae199 100755 --- a/gdb/gdbarch.sh +++ b/gdb/gdbarch.sh @@ -39,46 +39,74 @@ read="class level macro returntype function formal actual attrib staticdefault p 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}" != "" ] + comment="" + class="" + while read line + do + if test "${line}" = "" + then + continue + elif test "${line}" = "#" -a "${comment}" = "" then - fallbackdefault="${postdefault}" - elif [ "${predefault}" != "" ] + continue + elif expr "${line}" : "#" > /dev/null then - fallbackdefault="${predefault}" + comment="${comment} +${line}" else - fallbackdefault="" + 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 - #NOT YET: - # See gdbarch.log for basic verification of database - : + done + if [ "${class}" ] + then + true else false fi @@ -264,12 +292,11 @@ do esac done -IFS=: function_list () { # See below (DOCO) for description of each field - cat <<EOF | + 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 @@ -338,13 +365,13 @@ f:1:GET_SAVED_REGISTER:void:get_saved_register:char *raw_buffer, int *optimized, 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. +# 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. +# 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 @@ -402,14 +429,13 @@ v:2:TARGET_FLOAT_FORMAT:const struct floatformat *:float_format::::::default_flo 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 +function_list | while do_read do cat <<EOF ${class} ${macro}(${actual}) @@ -521,7 +547,7 @@ EOF echo "" echo "" echo "/* The following are pre-initialized by GDBARCH. */" -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_info_p then @@ -540,8 +566,15 @@ done echo "" echo "" echo "/* The following are initialized by the target dependant code. */" -function_list | while do_read # eval read $read +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 "" @@ -990,7 +1023,7 @@ echo "" echo "struct gdbarch" echo "{" echo " /* basic architectural information */" -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_info_p then @@ -1037,7 +1070,7 @@ cat <<EOF */ EOF -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_variable_p then @@ -1076,7 +1109,7 @@ cat <<EOF 0, NULL, NULL, /* Multi-arch values */ EOF -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_function_p || class_is_variable_p then @@ -1109,7 +1142,7 @@ gdbarch_alloc (const struct gdbarch_info *info, gdbarch->tdep = tdep; EOF echo "" -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_info_p then @@ -1118,7 +1151,7 @@ do done echo "" echo " /* Force the explicit initialization of these. */" -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_function_p || class_is_variable_p then @@ -1172,7 +1205,7 @@ verify_gdbarch (struct gdbarch *gdbarch) 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 +function_list | while do_read do if class_is_function_p || class_is_variable_p then @@ -1233,7 +1266,7 @@ gdbarch_dump (struct gdbarch *gdbarch, struct ui_file *file) EOF function_list | while do_read do - if [ ${returntype} == "void" ] + if [ "${returntype}" == "void" ] then echo "#if defined (${macro}) && GDB_MULTI_ARCH" echo " /* Macro might contain \`[{}]' when not multi-arch */" @@ -1301,7 +1334,7 @@ gdbarch_tdep (struct gdbarch *gdbarch) } EOF echo "" -function_list | while do_read # eval read $read +function_list | while do_read do if class_is_predicate_p then @@ -1457,8 +1490,7 @@ init_gdbarch_data (struct gdbarch *gdbarch) data-pointer. */ void * -gdbarch_data (data) - struct gdbarch_data *data; +gdbarch_data (struct gdbarch_data *data) { if (data->index >= current_gdbarch->nr_data) internal_error ("gdbarch_data: request for non-existant data."); @@ -1850,7 +1882,7 @@ disassemble_info tm_print_insn_info; extern void _initialize_gdbarch (void); void -_initialize_gdbarch () +_initialize_gdbarch (void) { struct cmd_list_element *c; |