create a 0-length array type, and set BOUND_CANNOT_BE_DETERMINED.
* valops.c (value_cast): If a cast like (TYPE[])VALUE (i.e. array
of unknown length) use sizeof(VALUE)/sizeof(TYPE) as the length.
* c-typeprint.c (c_type_print_varspec_suffix): If array length
is 0, print it, but not if upper_bound is BOUND_CANNOT_BE_DETERMINED.
OP_UNDETERMINED_ARGLIST (no backtracking, more general).
* f-valprint.c (f_val_print): Print TYPE_CODE_STRING using
LA_PRINT_STRING, and not val_print_string (which reads from inferior).
* ch-lang.c (chill_is_varying_struct), ch-lang.h: Remve function
duplicate function made redundant by chill_varying_type.
Re-write of f77 string and complex number support:
* language.h (struct language_defn): New fields string_lower_bound
and string_char_type.
* c-lang.c (c_language_defn, cplus_language_defn, asm_language_defn),
language.c (unknown_language_defn, auto_language_defn,
local_language_defn), m2-lang.c (m2_language_defn), f-lang.c
(f_language_defn), ch-lang.c (chill_language_defn): Set new fields.
* gdbtypes.c (create_string_type): Use new string_char_type field.
* valops.c (value_string): Use new string_lower_bound field.
* defs.h (TARGET_COMPLEX_BIT, TARGET_DOUBLE_COMPLEX_BIT): Removed.
* f-lang.c (f_create_fundamental_type, _initialize_f_language),
m2-lang.c (m2_create_fundamental_type),
gdbtypes.c (_initialize_gdbtypes): Set TYPE_TARGET_TYPE of complex
types. Set their TYPE_CODEs to TYPE_CODE_COMPLEX.
* mdebugread.c (mdebug_type_complex, mdebug_type_double_complex):
Removed. Use builtin_type_complex and builtin_type_double_complex.
* gdbtypes.h (enum type_code): Removed TYPE_CODE_LITERAL_STRING
and TYPE_CODE_LITERAL_COMPLEX.
* c-typeprint.c, f-typeprint.c, f-valprint.c, eval.c: Removed uses of
TYPE_CODE_LITERAL_STRING and TYPE_CODE_LITERAL_COMPLEX.
* gdbtypes.c, gdbtypes.h (f77_create_literal_complex_type,
f77_create_literal_string_type): Removed.
* value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_MEMADDR,
VALUE_SUBSTRING_MYADDR): Removed.
* expression.h (enum exp_opcode): Rename OP_F77_LITERAL_COMPLEX to
OP_COMPLEX.
* parse.c: Update accordingly.
* f-valprint.c (f77_print_cmplx): Removed.
(f_val_print case TYPE_CODE_COMPLEX): Re-write to use print_floating.
* f-exp.y (STRING_LITERAL): Use OP_STRING instead of OP_ARRAY.
* eval.c (evaluate_subexp): For case OP_ARRAY, don't call
f77_value_literal_string.
* valops.c, value.h (f77_value_literal_string, f77_value_substring,
f77_assign_from_literal_string, f77_assign_from_literal_complex):
Removed.
(value_assign): No longer need to handle literal types.
* valops.c (f77_value_literal_complex), value.h: Re-written and
renamed to value_literal_complex. Last arg is now a (complex) type.
* valops.c (f77_cast_into_complex): Re-written and renamed to
cast_into_complex.
* eval.c (evaluate_subexp): Update accordingly.
start_element, left_element, right_element, slice_size,
lower_element, upper_element, first_element): Removed.
(value_string_slice, value_array_slice): Replaced by ...
(slice): New non-terminal, with working slice support.
(primitive_value_lparen, rparen): New non-terminals.
(maybe_tuple_elements): New non-terminal, to allow empty tuples.
(idtokentab): Added "up".
* value.h (COERCE_VARYING_ARRAY): New macro.
* valarith.c (value_subscript): Use it.
* valops.c (value_cast): Likewise. Also, do nothing if already
correct type, and allow converting from/to range to/from scalar.
* valops.c, value.h (varying_to_slice, value_slice): New functions.
* eval.c (OP_ARRAY): Add cast for array element.
* expression.h (TERNOP_SLICE, TERNOP_SLICE_COUNT): New exp_opcodes.
* valops.c (chill_varying_type): Moved function frp, here ...
* gdbtypes.c (chill_varying_type), gdbtypes.h: ... to here.
* parse.c (length_of_subexp, prefixify_subexp): Add support
for TERNOP_SLICE, TERNOP_SLICE_COUNT.
* expprint.c (print_subexp, dump_expression): Likewise.
* eval.c (evaluate_subexp): Likewise.
* eval.c (evaluate_subexp case MULTI_SUBSCRIPT): Don't call
value_x_binop on a Chill varying string.
labeled structre tuples.
* ch-exp.y (tuple_element, named_record_element, tuple_elements):
New non-terminals, to handle labeled structure tuples.
(tuple): Re-define using tuple_elements.
* eval.c (evaluate_labeled_field_init): New function, to handle
initialization of structure fields, possibly using OP_LABELED.
(evaluate_subexp): Use it.
* expprint.c (print_subexp case): For OP_ARRAY, use Chill syntax
for Chill. Handled OP_LABELED.
* parse.c (length_of_subexp, prefixify_subexp): Handle OP_LABELED.
* eval.c (evaluate_subexp): Handle Chill Powerset tuples.
* valarith.c (value_bit_index): Just treat bitstring as represented
by an array of bytes. Alignment is handled by compiler.
lookup_pointer_type (builtin_type_void).
* printcmd.c (_initialize_printcmd): Give examine_*_type
a name for `ptype $_'.
* printcmd.c (print_formatted): Call val_print_string directly,
rather than via value_print.
(fmbutt@engage.sps.mot.com).
* Makefile.in: Add Fortran-related files and dependencies.
* defs.h (language_fortran): New language enum.
* language.h (_LANG_fortran): Define.
(MAX_FORTRAN_DIMS): Define.
* expression.h: Reformat to standard.
(MULTI_F77_SUBSCRIPT, OP_F77_UNDETERMINED_ARGLIST,
OP_F77_LITERAL_COMPLEX, OP_F77_SUBSTR): New expression opcodes.
* gdbtypes.h (TYPE_CODE_COMPLEX, TYPE_CODE_LITERAL_COMPLEX,
TYPE_CODE_LITERAL_STRING): New type codes.
(type): New fields upper_bound_type and lower_bound_type.
(TYPE_ARRAY_UPPER_BOUND_TYPE, TYPE_ARRAY_LOWER_BOUND_TYPE,
TYPE_ARRAY_UPPER_BOUND_VALUE, TYPE_ARRAY_LOWER_BOUND_VALUE): New
macros.
(builtin_type_f_character, etc): Declare.
* value.h (VALUE_LITERAL_DATA, VALUE_SUBSTRING_START): Define.
* f-exp.y: New file, Fortran expression grammar.
* f-lang.c: New file, Fortran language support functions.
* f-lang.h: New file, Fortran language support declarations.
* f-typeprint.c: New file, Fortran type printing.
* f-valprint.c: New file, Fortran value printing.
* eval.c (evaluate_subexp): Add code for new expression opcodes,
fix wording of error message.
* gdbtypes.c (f77_create_literal_complex_type,
f77_create_literal_string_type): New functions.
* language.c (set_language_command): Add Fortran info.
(calc_f77_array_dims): New function.
* parse.c (length_of_subexp, prefixify_subexp): Add cases for new
expression opcodes.
* symfile.c (deduce_language_from_filename): Recognize .f and .F
as Fortran source files.
* valops.c (f77_value_literal_string, f77_value_substring,
f77_value_literal_complex): New functions.
library functions before the executable is run. Retrieve dynamic
symbols from stripped executables.
* symtab.h (minimal_symbol_type): Add mst_solib_trampoline type.
* parse.c (write_exp_msymbol), symmisc.c (dump_msymbols),
symtab.c (list_symbols): Handle mst_solib_trampoline.
* minsyms.c (lookup_minimal_symbol): Handle mst_solib_trampoline
for all targets, remove IBM6000_TARGET dependencies.
* dbxread.c (read_dbx_dynamic_symtab): New function.
* dbxread.c (dbx_symfile_read): Use it.
* dbxread.c (SET_NAMESTRING): Set namestring to
"<bad string table index>" instead of "foo" if the string index is
corrupt.
* xcoffread.c (read_xcoff_symtab): Use mst_solib_trampoline instead
of mst_unknown.
* symtab.c (list_symbols): Take from_tty as parameter and pass it
to break_command. Handle mst_file_* minimal symbol types.
gone now.
* c-exp.y, ch-exp.y, core.c, corelow.c, eval.c, fork-child.c,
m2-exp.y, minsyms.c, nlmread.c, parse.c, putenv.c, regex.c
remote-utils.c, stabsread.c: Include <string.h>.
* regex.c: Include "defs.h", change re_comp argument to const char *.
* infptrace.c (fetch_register, store_inferior_registers): Change
regaddr to type CORE_ADDR.
* config/alpha/alpha-nw.mt, config/alpha/alpha-osf1.mt (MT_CFLAGS):
Remove, no longer necessary now that we use bfd_vma for a CORE_ADDR.
Change all references to stdout/stderr to gdb_stdout/gdb_stderr.
Replace all calls to stdio output functions with calls to
corresponding _unfiltered functions (`fprintf_unfiltered')
Replaced calls to fopen for output to gdb_fopen.
Added sufficient goo to utils.c and defs.h to make the above work.
The net effect is that stdio output functions are only directly used
in utils.c. Elsewhere, the _unfiltered and _filtered functions and
GDB_FILE type are used.
In the near future, GDB_FILE will stop being equivalant to FILE.
The semantics of some commands has changed in a very subtle way:
called in the right context, they may cause new occurences of
prompt_for_continue() behavior. The testsuite doesn't notice anything
like this, though.
Please respect this change by not reintroducing stdio output
dependencies in the main body of gdb code. All output from commands
should go to a GDB_FILE.
Target-specific code can still use stdio directly to communicate with
targets.
* c-exp.y (ptype : typebase abs_decl): Use it.
* c-exp.y (ptype): Add support for type qualifiers after the
typebase. The typebase rule already has support for them before
the typebase.
* Makefile.in: Change the expected number of shift/reduce
conflicts to 6. This is OK--the 2 new conflicts are basically the
same as one of the old ones.
* c-exp.y (exp): Use lcurly and rcurly for arrays and UNOP_MEMVAL
constructs.
* parse.c (free_funcalls): Moved prototype from parser-defs.h,
made function static.
* parse.c (struct funcall): Moved struct def from parser-defs.h.
* parse.c (funcall_chain): Moved from parser-defs.h, made static.
* parse.c (start_arglist):
* parser-defs.h (free_funcalls): Moved prototype to parse.c.
* parser-defs.h (struct funcall): Moved struct def to parse.c.
* parser-defs.h (funcall_chain): Moved to parse.c.
* printcmd.c (print_frame_nameless_args): Fix prototype.
* tm-mips.h (setup_arbitrary_frame): Fix prototype.
* tm-sparc.h (setup_arbitrary_frame): Fix prototype.
* valops.c (typecmp): Moved prototype from values.h.
* value.h (typecmp): Moved prototype to valops.c, made static.
**** start-sanitize-chill ****
* ch-exp.y (yylex): Change way control sequences are disabled.
**** end-sanitize-chill ****
constants with an explicit null byte terminator. OP_STRING is
now used for real string types.
* c-lang.c (builtin_type_*): Move declarations to lang.c since
they are used by all languages.
* c-lang.c (_initialize_c_language): Move initializations of
builtin_type_* to lang.c.
* c-typeprint.c (c_type_print_varspec_prefix,
c_type_print_varspec_suffix): TYPE_CODE_PASCAL_ARRAY renamed
to TYPE_CODE_STRING.
* c-valprint.c (c_val_print): Change the way character arrays
are printed as strings to be consistent with the way strings
are printed when pointer-to-char types are dereferenced.
Remove test of print_max before calling val_print_string, which
now does it's own test.
* eval.c (evaluate_subexp): Add case for OP_ARRAY.
* expprint.c (print_subexp, dump_expression): Add case for OP_ARRAY.
* expression.h (enum exp_opcode): Add OP_ARRAY and document.
* gdbtypes.c (builtin_type_*): Add declarations moved from
c-lang.c.
* gdbtypes.c (create_string_type): New function to create real
string types.
* gdbtypes.c (recursive_dump_type): TYPE_CODE_PASCAL_ARRAY
renamed to TYPE_CODE_STRING.
* gdbtypes.c (_initialize_gdbtypes): Add initializations of
builtin_type_* types moved from c-lang.c.
* gdbtypes.h (enum type_code): TYPE_CODE_PASCAL_ARRAY renamed
to TYPE_CODE_STRING.
* gdbtypes.h (builtin_type_string): Add extern declaration.
* gdbtypes.h (create_string_type): Add prototype.
* m2-lang.c (m2_create_fundamental_type): TYPE_CODE_PASCAL_ARRAY
renamed to TYPE_CODE_STRING.
* m88k-tdep.c (pushed_size): TYPE_CODE_PASCAL_ARRAY renamed to
TYPE_CODE_STRING.
* mipsread.c (_initialize_mipsread): TYPE_CODE_PASCAL_ARRAY
renamed to TYPE_CODE_STRING.
* parse.c (length_of_subexp, prefixify_subexp): Add case for
OP_ARRAY.
* printcmd.c (print_formatted): Recognize TYPE_CODE_STRING.
* typeprint.c (print_type_scalar): TYPE_CODE_PASCAL_ARRAY renamed
to TYPE_CODE_STRING.
* valops.c (allocate_space_in_inferior): New function and
prototype, using code ripped out of value_string.
* valops.c (value_string): Rewritten to use new function
allocate_space_in_inferior, but temporarily disabled until some
other support is in place.
* valops.c (value_array): New function to create array constants.
* valprint.c (val_print_string): Add comment to document use,
complete rewrite to fix several small buglets.
* value.h (value_array): Add prototype.
* value.h (val_print_string): Change prototype to match rewrite.
**** start-sanitize-chill ****
* ch-valprint.c (chill_val_print): Add case for TYPE_CODE_STRING.
* ch-exp.y (match_character_literal): Disable recognition of
control sequence form of character literals and document why.
**** end-sanitize-chill ****
from a configuration file (typically including <limits.h>), or to
TARGET_CHAR_BIT if CHAR_BIT is not defined.
* eval.c (evaluate_subexp): Use new BYTES_TO_EXP_ELEM macro.
* eval.c (evaluate_subexp): Add case for OP_BITSTRING.
* expprint.c (print_subexp): Use new BYTES_TO_EXP_ELEM macro.
* exppritn.c (print_subexp, dump_expression): Add case for
OP_BITSTRING.
* expression.h (OP_BITSTRING): New expression element type for
packed bitstrings.
* expression.h (EXP_ELEM_TO_BYTES, BYTES_TO_EXP_ELEM): New
macros to convert between number of expression elements and bytes
to store that many elements.
* i960-tdep.c (leafproc_return): Use new macros to access
minimal symbol name and address fields.
* m88k-pinsn.c (sprint_address): Use new macros to access
minimal symbol name and address fields.
* nindy-tdep.c (nindy_frame_chain_valid): Use new macro to access
minimal symbol address field.
* parse.c (write_exp_elt, write_exp_string, prefixify_expression,
parse_exp_1): Use new EXP_ELEM_TO_BYTES macro.
* parse.c (write_exp_string, length_of_subexp, prefixify_expression):
Use new BYTES_TO_EXP_ELEM macro.
* parse.c (write_exp_bitstring): New function to write packed
bitstrings into the expression element vector.
* parse.c (length_of_subexp, prefixify_subexp): Add case for
OP_BITSTRING.
* parser-defs.h (struct stoken): Document that it is used for
OP_BITSTRING as well as OP_STRING.
* parser-defs.h (write_exp_bitstring): Add prototype.
**** start-sanitize-chill ****
* ch-exp.y (BIT_STRING_LITERAL): Change token type to sval.
* ch-exp.y (NUM, PRED, SUCC, ABS, CARD, MAX, MIN, SIZE, UPPER,
LOWER, LENGTH): New tokens for keywords.
* ch-exp.y (chill_value_built_in_routine_call, mode_argument,
upper_lower_argument, length_argument, array_mode_name,
string_mode_name, variant_structure_mode_name): New non-terminals
and productions.
* ch-exp.y (literal): Useful production for BIT_STRING_LITERAL.
* ch-exp.y (match_bitstring_literal): New lexer support function
to recognize bitstring literals.
* ch-exp.y (tokentab6): New token table for 6 character keywords.
* ch-exp.y (tokentab5): Add LOWER, UPPER.
* ch-exp.y (tokentab4): Add PRED, SUCC, CARD, SIZE.
* ch-exp.y (tokentab3): Add NUM, ABS, MIN, MAX.
* ch-exp.y (yylex): Check tokentab6.
* ch-exp.y (yylex): Call match_bitstring_literal.
**** end-sanitize-chill ****
* expprint.c (print_subexp): Rename BINOP_MULTI_SUBSCRIPT to
MULTI_SUBSCRIPT.
* expprint.c (dump_expression): New function for dumping
expression vectors during gdb debugging.
* expression.h (BINOP_MULTI_SUBSCRIPT): Name changed to
MULTI_SUBSCRIPT and moved out of BINOP range.
* expression.h (DUMP_EXPRESSION): New macro that calls
dump_expression if DEBUG_EXPRESSIONS is defined.
* m2-exp.y (BINOP_MULTI_SUBSCRIPT): Changed to MULTI_SUBSCRIPT.
* parse.c (length_of_subexp, prefixify_subexp): Change
BINOP_MULTI_SUBSCRIPT to MULTI_SUBSCRIPT.
* parse.c (parse_exp_1): Call DUMP_EXPRESSION before and after
prefixify'ing the expression.
* printcmd.c (print_command_1): Add comment.
**** start-sanitize-chill ****
* ch-exp.y (expression_list): Add useful actions.
* ch-exp.y (value_array_element): Add useful actions.
* ch-exp.y (array_primitive_value): Add production.
* ch-exp.y (yylex): Recognize ',' as a token.
**** end-sanitize-chill ****
contants as a leading explicit length, followed by the string data,
followed by a trailing explicit length.
* eval.c (evaluate_subexp), expprint.c (print_subexp),
parse.c (length_of_subexp), parse.c (prefixify_subexp):
Use recorded explicit length of strings in expression elements,
rather than strlen. Adjust code to skip over strings stored in
expression elements, and code to access strings, to account for
new leading explicit size expression element.
* parse.c (length_of_subexp): Test for minimum endpos of 1, not
0, to avoid negative expression element indices.
* valops.c (search_struct_method): Minor whitespace change.
symtab.h, tm-i386v4.h, valprint.c, values.c: Lint.
* breakpoint.c, c-exp.y, coffread.c, command.c, environ.c, eval.c,
findvar.c, infcmd.c, infptrace.c, infrun.c, m2-exp.y, parse.c,
putenv.c, solib.c, sparc-xdep.c, symtab.c, tm-i386v.h, tm-sparc.h,
utils.c, valarith.c, valops.c, valprint.c, values.c:
Replace bcopy() use with memcpy(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* breakpoint.c, buildsym.c, coffread.c, dbxread.c, i386-tdep.c,
ieee-float.c, infcmd.c, sparc-tdep.c, stack.c, symtab.c, symtab.h,
target.c, values.c:
Replace bzero() use with memset(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* i386-tdep.c, main.c, valprint.c:
Replace bcmp() use with memcmp(), which is more standard and can
take advantage of gcc's builtin functions for increased performance.
* All GDB files that #include defs.h: Removed stdio.h.
(defs.h): #include stdio.h.
This has been tested by building GDBs for all targets hosted on Sun4.
None of the build problems were related to stdio.h inclusion. (n.b.
many configurations don't build for other reasons.)
* expread.y, expread.tab.c: Remove.
* parser-defs.h: New file with common declarations from expread.y.
* c-exp.y: New file with the C parser from expread.y.
* m2-exp.y: New file with the Modula-2 parser.