1991-03-28 16:26:26 +00:00
|
|
|
|
/* Evaluate expressions for GDB.
|
1995-03-14 02:37:20 +00:00
|
|
|
|
Copyright 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995
|
1995-01-04 01:07:15 +00:00
|
|
|
|
Free Software Foundation, Inc.
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
This file is part of GDB.
|
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
This program is free software; you can redistribute it and/or modify
|
1991-03-28 16:26:26 +00:00
|
|
|
|
it under the terms of the GNU General Public License as published by
|
1991-09-19 07:40:51 +00:00
|
|
|
|
the Free Software Foundation; either version 2 of the License, or
|
|
|
|
|
(at your option) any later version.
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
This program is distributed in the hope that it will be useful,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
GNU General Public License for more details.
|
|
|
|
|
|
|
|
|
|
You should have received a copy of the GNU General Public License
|
1991-09-19 07:40:51 +00:00
|
|
|
|
along with this program; if not, write to the Free Software
|
|
|
|
|
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
#include "defs.h"
|
1995-01-04 01:07:15 +00:00
|
|
|
|
#include <string.h>
|
1991-03-28 16:26:26 +00:00
|
|
|
|
#include "symtab.h"
|
1992-03-20 21:57:17 +00:00
|
|
|
|
#include "gdbtypes.h"
|
1991-03-28 16:26:26 +00:00
|
|
|
|
#include "value.h"
|
|
|
|
|
#include "expression.h"
|
|
|
|
|
#include "target.h"
|
1991-09-19 07:40:51 +00:00
|
|
|
|
#include "frame.h"
|
1993-11-17 18:07:58 +00:00
|
|
|
|
#include "demangle.h"
|
1993-01-03 22:24:21 +00:00
|
|
|
|
#include "language.h" /* For CAST_IS_CONVERSION */
|
1995-03-14 02:37:20 +00:00
|
|
|
|
#include "f-lang.h" /* for array bound stuff */
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1992-03-20 21:57:17 +00:00
|
|
|
|
/* Prototypes for local functions. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
static value_ptr evaluate_subexp_for_sizeof PARAMS ((struct expression *,
|
|
|
|
|
int *));
|
1992-03-20 21:57:17 +00:00
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
static value_ptr evaluate_subexp_for_address PARAMS ((struct expression *,
|
|
|
|
|
int *, enum noside));
|
1992-03-20 21:57:17 +00:00
|
|
|
|
|
1995-02-12 19:21:04 +00:00
|
|
|
|
#ifdef __GNUC__
|
|
|
|
|
inline
|
|
|
|
|
#endif
|
|
|
|
|
static value_ptr
|
|
|
|
|
evaluate_subexp (expect_type, exp, pos, noside)
|
|
|
|
|
struct type *expect_type;
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
enum noside noside;
|
|
|
|
|
{
|
|
|
|
|
return (*exp->language_defn->evaluate_exp) (expect_type, exp, pos, noside);
|
|
|
|
|
}
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
/* Parse the string EXP as a C expression, evaluate it,
|
|
|
|
|
and return the result as a number. */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
parse_and_eval_address (exp)
|
|
|
|
|
char *exp;
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
struct expression *expr = parse_expression (exp);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
register CORE_ADDR addr;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
register struct cleanup *old_chain =
|
|
|
|
|
make_cleanup (free_current_contents, &expr);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
addr = value_as_pointer (evaluate_expression (expr));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Like parse_and_eval_address but takes a pointer to a char * variable
|
|
|
|
|
and advanced that variable across the characters parsed. */
|
|
|
|
|
|
|
|
|
|
CORE_ADDR
|
|
|
|
|
parse_and_eval_address_1 (expptr)
|
|
|
|
|
char **expptr;
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
struct expression *expr = parse_exp_1 (expptr, (struct block *)0, 0);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
register CORE_ADDR addr;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
register struct cleanup *old_chain =
|
|
|
|
|
make_cleanup (free_current_contents, &expr);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
addr = value_as_pointer (evaluate_expression (expr));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
return addr;
|
|
|
|
|
}
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
parse_and_eval (exp)
|
|
|
|
|
char *exp;
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
struct expression *expr = parse_expression (exp);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
register value_ptr val;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
register struct cleanup *old_chain
|
|
|
|
|
= make_cleanup (free_current_contents, &expr);
|
|
|
|
|
|
|
|
|
|
val = evaluate_expression (expr);
|
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Parse up to a comma (or to a closeparen)
|
|
|
|
|
in the string EXPP as an expression, evaluate it, and return the value.
|
|
|
|
|
EXPP is advanced to point to the comma. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
parse_to_comma_and_eval (expp)
|
|
|
|
|
char **expp;
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
struct expression *expr = parse_exp_1 (expp, (struct block *) 0, 1);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
register value_ptr val;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
register struct cleanup *old_chain
|
|
|
|
|
= make_cleanup (free_current_contents, &expr);
|
|
|
|
|
|
|
|
|
|
val = evaluate_expression (expr);
|
|
|
|
|
do_cleanups (old_chain);
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Evaluate an expression in internal prefix form
|
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
1991-12-19 01:14:31 +00:00
|
|
|
|
such as is constructed by parse.y.
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
See expression.h for info on the format of an expression. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
evaluate_expression (exp)
|
|
|
|
|
struct expression *exp;
|
|
|
|
|
{
|
|
|
|
|
int pc = 0;
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_NORMAL);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Evaluate an expression, avoiding all memory references
|
|
|
|
|
and getting a value whose type alone is correct. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
evaluate_type (exp)
|
|
|
|
|
struct expression *exp;
|
|
|
|
|
{
|
|
|
|
|
int pc = 0;
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, &pc, EVAL_AVOID_SIDE_EFFECTS);
|
|
|
|
|
}
|
|
|
|
|
|
1995-01-20 23:45:21 +00:00
|
|
|
|
/* Helper function called by evaluate_subexp to initialize a field
|
|
|
|
|
a structure from a tuple in Chill. This is recursive, to handle
|
|
|
|
|
more than one field name labels.
|
|
|
|
|
|
|
|
|
|
STRUCT_VAL is the structure value we are constructing.
|
|
|
|
|
(*FIELDNOP) is the field to set, if there is no label.
|
|
|
|
|
It is set to the field following this one.
|
|
|
|
|
EXP, POS, and NOSIDE are as for evaluate_subexp.
|
|
|
|
|
|
|
|
|
|
This function does not handle variant records. FIXME */
|
|
|
|
|
|
|
|
|
|
static value_ptr
|
|
|
|
|
evaluate_labeled_field_init (struct_val, fieldnop, exp, pos, noside)
|
|
|
|
|
value_ptr struct_val;
|
|
|
|
|
int *fieldnop;
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
enum noside noside;
|
|
|
|
|
{
|
|
|
|
|
int fieldno = *fieldnop;
|
|
|
|
|
value_ptr val;
|
|
|
|
|
int bitpos, bitsize;
|
|
|
|
|
char *addr;
|
|
|
|
|
struct type *struct_type = VALUE_TYPE (struct_val);
|
|
|
|
|
if (exp->elts[*pos].opcode == OP_LABELED)
|
|
|
|
|
{
|
|
|
|
|
int pc = (*pos)++;
|
|
|
|
|
char *name = &exp->elts[pc + 2].string;
|
|
|
|
|
int tem = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
|
|
|
|
|
for (fieldno = 0; ; fieldno++)
|
|
|
|
|
{
|
|
|
|
|
if (fieldno >= TYPE_NFIELDS (struct_type))
|
|
|
|
|
error ("there is no field named %s", name);
|
|
|
|
|
if (STREQ (TYPE_FIELD_NAME (struct_type, fieldno), name))
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
*fieldnop = fieldno;
|
|
|
|
|
val = evaluate_labeled_field_init (struct_val, fieldnop,
|
|
|
|
|
exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
fieldno = (*fieldnop)++;
|
|
|
|
|
if (fieldno >= TYPE_NFIELDS (struct_type))
|
|
|
|
|
error ("too many initializers");
|
|
|
|
|
val = evaluate_subexp (TYPE_FIELD_TYPE (struct_type, fieldno),
|
|
|
|
|
exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Assign val to field fieldno. */
|
|
|
|
|
if (VALUE_TYPE (val) != TYPE_FIELD_TYPE (struct_type, fieldno))
|
|
|
|
|
val = value_cast (TYPE_FIELD_TYPE (struct_type, fieldno), val);
|
|
|
|
|
#if 1
|
|
|
|
|
bitsize = TYPE_FIELD_BITSIZE (struct_type, fieldno);
|
|
|
|
|
bitpos = TYPE_FIELD_BITPOS (struct_type, fieldno);
|
|
|
|
|
addr = VALUE_CONTENTS (struct_val);
|
|
|
|
|
addr += bitpos / 8;
|
|
|
|
|
if (bitsize)
|
|
|
|
|
modify_field (addr, value_as_long (val),
|
|
|
|
|
bitpos % 8, bitsize);
|
|
|
|
|
else
|
|
|
|
|
memcpy (addr, VALUE_CONTENTS (val),
|
|
|
|
|
TYPE_LENGTH (VALUE_TYPE (val)));
|
|
|
|
|
#else
|
|
|
|
|
value_assign (value_primitive_field (struct_val, 0, fieldno, struct_type),
|
|
|
|
|
val);
|
|
|
|
|
#endif
|
|
|
|
|
return val;
|
|
|
|
|
}
|
|
|
|
|
|
1995-02-12 19:21:04 +00:00
|
|
|
|
value_ptr
|
|
|
|
|
evaluate_subexp_standard (expect_type, exp, pos, noside)
|
1991-03-28 16:26:26 +00:00
|
|
|
|
struct type *expect_type;
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
enum noside noside;
|
|
|
|
|
{
|
|
|
|
|
enum exp_opcode op;
|
1993-07-03 00:27:47 +00:00
|
|
|
|
int tem, tem2, tem3;
|
1993-11-17 18:07:58 +00:00
|
|
|
|
register int pc, pc2 = 0, oldpos;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
register value_ptr arg1 = NULL, arg2 = NULL, arg3;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
struct type *type;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
int nargs;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr *argvec;
|
|
|
|
|
struct symbol *tmp_symbol;
|
|
|
|
|
int upper, lower, retcode;
|
|
|
|
|
int code;
|
|
|
|
|
struct internalvar *var;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1995-01-14 20:56:55 +00:00
|
|
|
|
/* This expect_type crap should not be used for C. C expressions do
|
|
|
|
|
not have any notion of expected types, never has and (goddess
|
|
|
|
|
willing) never will. The C++ code uses it for some twisted
|
|
|
|
|
purpose (I haven't investigated but I suspect it just the usual
|
|
|
|
|
combination of Stroustrup figuring out some crazy language
|
|
|
|
|
feature and Tiemann figuring out some crazier way to try to
|
|
|
|
|
implement it). CHILL has the tuple stuff; I don't know enough
|
|
|
|
|
about CHILL to know whether expected types is the way to do it.
|
|
|
|
|
FORTRAN I don't know. */
|
1995-01-20 23:45:21 +00:00
|
|
|
|
if (exp->language_defn->la_language != language_cplus
|
|
|
|
|
&& exp->language_defn->la_language != language_chill)
|
1995-01-14 16:48:03 +00:00
|
|
|
|
expect_type = NULL_TYPE;
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
pc = (*pos)++;
|
|
|
|
|
op = exp->elts[pc].opcode;
|
|
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
|
{
|
|
|
|
|
case OP_SCOPE:
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
tem = longest_to_int (exp->elts[pc + 2].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
(*pos) += 4 + BYTES_TO_EXP_ELEM (tem + 1);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
arg1 = value_struct_elt_for_reference (exp->elts[pc + 1].type,
|
1992-06-19 21:09:54 +00:00
|
|
|
|
0,
|
1992-03-20 21:57:17 +00:00
|
|
|
|
exp->elts[pc + 1].type,
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
&exp->elts[pc + 3].string,
|
1992-03-20 21:57:17 +00:00
|
|
|
|
expect_type);
|
1991-04-26 22:59:54 +00:00
|
|
|
|
if (arg1 == NULL)
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
error ("There is no field named %s", &exp->elts[pc + 3].string);
|
1991-04-26 22:59:54 +00:00
|
|
|
|
return arg1;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case OP_LONG:
|
|
|
|
|
(*pos) += 3;
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (exp->elts[pc + 1].type,
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
exp->elts[pc + 2].longconst);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case OP_DOUBLE:
|
|
|
|
|
(*pos) += 3;
|
|
|
|
|
return value_from_double (exp->elts[pc + 1].type,
|
|
|
|
|
exp->elts[pc + 2].doubleconst);
|
|
|
|
|
|
|
|
|
|
case OP_VAR_VALUE:
|
1993-08-18 19:33:39 +00:00
|
|
|
|
(*pos) += 3;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
1993-11-17 18:07:58 +00:00
|
|
|
|
struct symbol * sym = exp->elts[pc + 2].symbol;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
enum lval_type lv;
|
|
|
|
|
|
|
|
|
|
switch (SYMBOL_CLASS (sym))
|
|
|
|
|
{
|
|
|
|
|
case LOC_CONST:
|
|
|
|
|
case LOC_LABEL:
|
|
|
|
|
case LOC_CONST_BYTES:
|
|
|
|
|
lv = not_lval;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case LOC_REGISTER:
|
|
|
|
|
case LOC_REGPARM:
|
|
|
|
|
lv = lval_register;
|
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
lv = lval_memory;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return value_zero (SYMBOL_TYPE (sym), lv);
|
|
|
|
|
}
|
|
|
|
|
else
|
1993-08-18 19:33:39 +00:00
|
|
|
|
return value_of_variable (exp->elts[pc + 2].symbol,
|
|
|
|
|
exp->elts[pc + 1].block);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case OP_LAST:
|
|
|
|
|
(*pos) += 2;
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return
|
|
|
|
|
access_value_history (longest_to_int (exp->elts[pc + 1].longconst));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case OP_REGISTER:
|
|
|
|
|
(*pos) += 2;
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_of_register (longest_to_int (exp->elts[pc + 1].longconst));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case OP_BOOL:
|
|
|
|
|
(*pos) += 2;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
if (current_language->la_language == language_fortran)
|
|
|
|
|
return value_from_longest (builtin_type_f_logical_s2,
|
|
|
|
|
exp->elts[pc + 1].longconst);
|
|
|
|
|
else
|
|
|
|
|
return value_from_longest (builtin_type_chill_bool,
|
|
|
|
|
exp->elts[pc + 1].longconst);
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case OP_INTERNALVAR:
|
|
|
|
|
(*pos) += 2;
|
|
|
|
|
return value_of_internalvar (exp->elts[pc + 1].internalvar);
|
|
|
|
|
|
|
|
|
|
case OP_STRING:
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
tem = longest_to_int (exp->elts[pc + 1].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
return value_string (&exp->elts[pc + 2].string, tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1993-07-03 00:27:47 +00:00
|
|
|
|
case OP_BITSTRING:
|
1995-01-23 21:20:58 +00:00
|
|
|
|
tem = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
|
|
(*pos)
|
|
|
|
|
+= 3 + BYTES_TO_EXP_ELEM ((tem + HOST_CHAR_BIT - 1) / HOST_CHAR_BIT);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
return value_bitstring (&exp->elts[pc + 2].string, tem);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
break;
|
|
|
|
|
|
|
|
|
|
case OP_ARRAY:
|
|
|
|
|
(*pos) += 3;
|
|
|
|
|
tem2 = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
|
|
tem3 = longest_to_int (exp->elts[pc + 2].longconst);
|
|
|
|
|
nargs = tem3 - tem2 + 1;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
|
|
|
|
|
&& TYPE_CODE (expect_type) == TYPE_CODE_STRUCT)
|
|
|
|
|
{
|
|
|
|
|
value_ptr rec = allocate_value (expect_type);
|
1995-01-20 23:45:21 +00:00
|
|
|
|
int fieldno = 0;
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
memset (VALUE_CONTENTS_RAW (rec), '\0', TYPE_LENGTH (expect_type));
|
1995-01-04 01:07:15 +00:00
|
|
|
|
for (tem = 0; tem < nargs; tem++)
|
1995-01-20 23:45:21 +00:00
|
|
|
|
evaluate_labeled_field_init (rec, &fieldno, exp, pos, noside);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
return rec;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
|
|
|
|
|
&& TYPE_CODE (expect_type) == TYPE_CODE_ARRAY)
|
|
|
|
|
{
|
|
|
|
|
struct type *range_type = TYPE_FIELD_TYPE (expect_type, 0);
|
|
|
|
|
struct type *element_type = TYPE_TARGET_TYPE (expect_type);
|
|
|
|
|
LONGEST low_bound = TYPE_FIELD_BITPOS (range_type, 0);
|
|
|
|
|
LONGEST high_bound = TYPE_FIELD_BITPOS (range_type, 1);
|
|
|
|
|
int element_size = TYPE_LENGTH (element_type);
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
value_ptr array = allocate_value (expect_type);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
if (nargs != (high_bound - low_bound + 1))
|
|
|
|
|
error ("wrong number of initialiers for array type");
|
|
|
|
|
for (tem = low_bound; tem <= high_bound; tem++)
|
|
|
|
|
{
|
|
|
|
|
value_ptr element = evaluate_subexp (element_type,
|
|
|
|
|
exp, pos, noside);
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
if (VALUE_TYPE (element) != element_type)
|
|
|
|
|
element = value_cast (element_type, element);
|
|
|
|
|
memcpy (VALUE_CONTENTS_RAW (array)
|
1995-01-04 01:07:15 +00:00
|
|
|
|
+ (tem - low_bound) * element_size,
|
|
|
|
|
VALUE_CONTENTS (element),
|
|
|
|
|
element_size);
|
|
|
|
|
}
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
return array;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
1995-01-20 23:45:21 +00:00
|
|
|
|
if (expect_type != NULL_TYPE && noside != EVAL_SKIP
|
|
|
|
|
&& TYPE_CODE (expect_type) == TYPE_CODE_SET)
|
|
|
|
|
{
|
|
|
|
|
value_ptr set = allocate_value (expect_type);
|
|
|
|
|
struct type *element_type = TYPE_INDEX_TYPE (expect_type);
|
|
|
|
|
int low_bound = TYPE_LOW_BOUND (element_type);
|
|
|
|
|
int high_bound = TYPE_HIGH_BOUND (element_type);
|
|
|
|
|
char *valaddr = VALUE_CONTENTS_RAW (set);
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
memset (valaddr, '\0', TYPE_LENGTH (expect_type));
|
1995-01-20 23:45:21 +00:00
|
|
|
|
for (tem = 0; tem < nargs; tem++)
|
|
|
|
|
{
|
|
|
|
|
value_ptr element_val = evaluate_subexp (element_type,
|
|
|
|
|
exp, pos, noside);
|
|
|
|
|
LONGEST element = value_as_long (element_val);
|
|
|
|
|
int bit_index;
|
|
|
|
|
if (element < low_bound || element > high_bound)
|
|
|
|
|
error ("POWERSET tuple element out of range");
|
|
|
|
|
element -= low_bound;
|
|
|
|
|
bit_index = (unsigned) element % TARGET_CHAR_BIT;
|
|
|
|
|
if (BITS_BIG_ENDIAN)
|
|
|
|
|
bit_index = TARGET_CHAR_BIT - 1 - bit_index;
|
|
|
|
|
valaddr [(unsigned) element / TARGET_CHAR_BIT] |= 1 << bit_index;
|
|
|
|
|
}
|
|
|
|
|
return set;
|
|
|
|
|
}
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
argvec = (value_ptr *) alloca (sizeof (value_ptr) * nargs);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
for (tem = 0; tem < nargs; tem++)
|
|
|
|
|
{
|
|
|
|
|
/* Ensure that array expressions are coerced into pointer objects. */
|
|
|
|
|
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
return value_array (tem2, tem3, argvec);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
|
* ch-exp.y (value_string_element, string_primitive_value,
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.
1995-02-01 21:02:51 +00:00
|
|
|
|
case TERNOP_SLICE:
|
|
|
|
|
{
|
|
|
|
|
value_ptr array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
int lowbound
|
|
|
|
|
= value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
int upper
|
|
|
|
|
= value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
return value_slice (array, lowbound, upper - lowbound + 1);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case TERNOP_SLICE_COUNT:
|
|
|
|
|
{
|
|
|
|
|
value_ptr array = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
int lowbound
|
|
|
|
|
= value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
int length
|
|
|
|
|
= value_as_long (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
return value_slice (array, lowbound, length);
|
|
|
|
|
}
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case TERNOP_COND:
|
|
|
|
|
/* Skip third and second args to evaluate the first one. */
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
if (value_logical_not (arg1))
|
1991-03-28 16:26:26 +00:00
|
|
|
|
{
|
|
|
|
|
evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
|
|
|
|
|
return arg2;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case OP_FUNCALL:
|
|
|
|
|
(*pos) += 2;
|
|
|
|
|
op = exp->elts[*pos].opcode;
|
|
|
|
|
if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
|
|
|
|
|
{
|
1995-01-04 01:07:15 +00:00
|
|
|
|
LONGEST fnptr;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
/* First, evaluate the structure into arg2 */
|
|
|
|
|
pc2 = (*pos)++;
|
|
|
|
|
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
|
|
|
|
|
if (op == STRUCTOP_MEMBER)
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp_for_address (exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* If the function is a virtual function, then the
|
|
|
|
|
aggregate value (providing the structure) plays
|
|
|
|
|
its part by providing the vtable. Otherwise,
|
|
|
|
|
it is just along for the ride: call the function
|
|
|
|
|
directly. */
|
|
|
|
|
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
fnptr = value_as_long (arg1);
|
1992-09-04 07:37:18 +00:00
|
|
|
|
|
|
|
|
|
if (METHOD_PTR_IS_VIRTUAL(fnptr))
|
1991-03-28 16:26:26 +00:00
|
|
|
|
{
|
1992-09-04 07:37:18 +00:00
|
|
|
|
int fnoffset = METHOD_PTR_TO_VOFFSET(fnptr);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
struct type *basetype;
|
1992-09-04 07:37:18 +00:00
|
|
|
|
struct type *domain_type =
|
|
|
|
|
TYPE_DOMAIN_TYPE (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
int i, j;
|
|
|
|
|
basetype = TYPE_TARGET_TYPE (VALUE_TYPE (arg2));
|
1992-09-04 07:37:18 +00:00
|
|
|
|
if (domain_type != basetype)
|
|
|
|
|
arg2 = value_cast(lookup_pointer_type (domain_type), arg2);
|
|
|
|
|
basetype = TYPE_VPTR_BASETYPE (domain_type);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
for (i = TYPE_NFN_FIELDS (basetype) - 1; i >= 0; i--)
|
|
|
|
|
{
|
|
|
|
|
struct fn_field *f = TYPE_FN_FIELDLIST1 (basetype, i);
|
|
|
|
|
/* If one is virtual, then all are virtual. */
|
|
|
|
|
if (TYPE_FN_FIELD_VIRTUAL_P (f, 0))
|
|
|
|
|
for (j = TYPE_FN_FIELDLIST_LENGTH (basetype, i) - 1; j >= 0; --j)
|
1992-09-04 07:37:18 +00:00
|
|
|
|
if (TYPE_FN_FIELD_VOFFSET (f, j) == fnoffset)
|
1991-03-28 16:26:26 +00:00
|
|
|
|
{
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr temp = value_ind (arg2);
|
1992-09-04 07:37:18 +00:00
|
|
|
|
arg1 = value_virtual_fn_field (&temp, f, j, domain_type, 0);
|
|
|
|
|
arg2 = value_addr (temp);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
goto got_it;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if (i < 0)
|
1992-09-04 07:37:18 +00:00
|
|
|
|
error ("virtual function at index %d not found", fnoffset);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
VALUE_TYPE (arg1) = lookup_pointer_type (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)));
|
|
|
|
|
}
|
|
|
|
|
got_it:
|
|
|
|
|
|
|
|
|
|
/* Now, say which argument to start evaluating from */
|
|
|
|
|
tem = 2;
|
|
|
|
|
}
|
|
|
|
|
else if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
|
|
|
|
|
{
|
|
|
|
|
/* Hair for method invocations */
|
|
|
|
|
int tem2;
|
|
|
|
|
|
1991-09-19 07:40:51 +00:00
|
|
|
|
nargs = longest_to_int (exp->elts[pc + 1].longconst) + 1;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
/* First, evaluate the structure into arg2 */
|
|
|
|
|
pc2 = (*pos)++;
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
tem2 = longest_to_int (exp->elts[pc2 + 1].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
*pos += 3 + BYTES_TO_EXP_ELEM (tem2 + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
|
|
|
|
|
if (op == STRUCTOP_STRUCT)
|
|
|
|
|
{
|
1993-08-18 19:33:39 +00:00
|
|
|
|
/* If v is a variable in a register, and the user types
|
|
|
|
|
v.method (), this will produce an error, because v has
|
|
|
|
|
no address.
|
|
|
|
|
|
|
|
|
|
A possible way around this would be to allocate a
|
|
|
|
|
copy of the variable on the stack, copy in the
|
|
|
|
|
contents, call the function, and copy out the
|
|
|
|
|
contents. I.e. convert this from call by reference
|
|
|
|
|
to call by copy-return (or whatever it's called).
|
|
|
|
|
However, this does not work because it is not the
|
|
|
|
|
same: the method being called could stash a copy of
|
|
|
|
|
the address, and then future uses through that address
|
|
|
|
|
(after the method returns) would be expected to
|
|
|
|
|
use the variable itself, not some copy of it. */
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg2 = evaluate_subexp_for_address (exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
}
|
|
|
|
|
/* Now, say which argument to start evaluating from */
|
|
|
|
|
tem = 2;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
tem = 0;
|
|
|
|
|
}
|
1993-07-03 00:27:47 +00:00
|
|
|
|
/* Allocate arg vector, including space for the function to be
|
|
|
|
|
called in argvec[0] and a terminating NULL */
|
1995-01-04 01:07:15 +00:00
|
|
|
|
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
for (; tem <= nargs; tem++)
|
|
|
|
|
/* Ensure that array expressions are coerced into pointer objects. */
|
|
|
|
|
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
/* signal end of arglist */
|
|
|
|
|
argvec[tem] = 0;
|
|
|
|
|
|
|
|
|
|
if (op == STRUCTOP_STRUCT || op == STRUCTOP_PTR)
|
|
|
|
|
{
|
|
|
|
|
int static_memfuncp;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr temp = arg2;
|
|
|
|
|
char tstr[64];
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
argvec[1] = arg2;
|
1993-11-17 18:07:58 +00:00
|
|
|
|
argvec[0] = 0;
|
|
|
|
|
strcpy(tstr, &exp->elts[pc2+2].string);
|
|
|
|
|
if (!argvec[0])
|
1991-03-28 16:26:26 +00:00
|
|
|
|
{
|
1993-11-17 18:07:58 +00:00
|
|
|
|
temp = arg2;
|
|
|
|
|
argvec[0] =
|
|
|
|
|
value_struct_elt (&temp, argvec+1, tstr,
|
|
|
|
|
&static_memfuncp,
|
|
|
|
|
op == STRUCTOP_STRUCT
|
|
|
|
|
? "structure" : "structure pointer");
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
1993-11-17 18:07:58 +00:00
|
|
|
|
arg2 = value_from_longest (lookup_pointer_type(VALUE_TYPE (temp)),
|
|
|
|
|
VALUE_ADDRESS (temp)+VALUE_OFFSET (temp));
|
|
|
|
|
argvec[1] = arg2;
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (static_memfuncp)
|
|
|
|
|
{
|
|
|
|
|
argvec[1] = argvec[0];
|
|
|
|
|
nargs--;
|
|
|
|
|
argvec++;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (op == STRUCTOP_MEMBER || op == STRUCTOP_MPTR)
|
|
|
|
|
{
|
|
|
|
|
argvec[1] = arg2;
|
|
|
|
|
argvec[0] = arg1;
|
|
|
|
|
}
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
do_call_it:
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
|
|
|
|
/* If the return type doesn't look like a function type, call an
|
|
|
|
|
error. This can happen if somebody tries to turn a variable into
|
|
|
|
|
a function call. This is here because people often want to
|
|
|
|
|
call, eg, strcmp, which gdb doesn't know is a function. If
|
|
|
|
|
gdb isn't asked for it's opinion (ie. through "whatis"),
|
|
|
|
|
it won't offer it. */
|
|
|
|
|
|
|
|
|
|
struct type *ftype =
|
|
|
|
|
TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0]));
|
|
|
|
|
|
|
|
|
|
if (ftype)
|
|
|
|
|
return allocate_value (TYPE_TARGET_TYPE (VALUE_TYPE (argvec[0])));
|
|
|
|
|
else
|
|
|
|
|
error ("Expression of type other than \"Function returning ...\" used as function");
|
|
|
|
|
}
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
return call_function_by_hand (argvec[0], nargs, argvec + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
case OP_F77_UNDETERMINED_ARGLIST:
|
|
|
|
|
|
|
|
|
|
/* Remember that in F77, functions, substring ops and
|
|
|
|
|
array subscript operations cannot be disambiguated
|
|
|
|
|
at parse time. We have made all array subscript operations,
|
|
|
|
|
substring operations as well as function calls come here
|
|
|
|
|
and we now have to discover what the heck this thing actually was.
|
1995-02-12 19:21:04 +00:00
|
|
|
|
If it is a function, we process just as if we got an OP_FUNCALL. */
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
nargs = longest_to_int (exp->elts[pc+1].longconst);
|
|
|
|
|
(*pos) += 2;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
/* First determine the type code we are dealing with. */
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
code = TYPE_CODE (VALUE_TYPE (arg1));
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
switch (code)
|
|
|
|
|
{
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
case TYPE_CODE_ARRAY:
|
|
|
|
|
goto multi_f77_subscript;
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
case TYPE_CODE_STRING:
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
goto op_f77_substr;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
case TYPE_CODE_PTR:
|
|
|
|
|
case TYPE_CODE_FUNC:
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
/* It's a function call. */
|
|
|
|
|
/* Allocate arg vector, including space for the function to be
|
|
|
|
|
called in argvec[0] and a terminating NULL */
|
|
|
|
|
argvec = (value_ptr *) alloca (sizeof (value_ptr) * (nargs + 2));
|
|
|
|
|
argvec[0] = arg1;
|
|
|
|
|
tem = 1;
|
|
|
|
|
for (; tem <= nargs; tem++)
|
|
|
|
|
argvec[tem] = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
argvec[tem] = 0; /* signal end of arglist */
|
|
|
|
|
goto do_call_it;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
error ("Cannot perform substring on this type");
|
|
|
|
|
}
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
op_f77_substr:
|
1995-01-04 01:07:15 +00:00
|
|
|
|
/* We have a substring operation on our hands here,
|
|
|
|
|
let us get the string we will be dealing with */
|
|
|
|
|
|
|
|
|
|
/* Now evaluate the 'from' and 'to' */
|
|
|
|
|
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT)
|
|
|
|
|
error ("Substring arguments must be of type integer");
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
if (nargs < 2)
|
|
|
|
|
return value_subscript (arg1, arg2);
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
arg3 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg3)) != TYPE_CODE_INT)
|
|
|
|
|
error ("Substring arguments must be of type integer");
|
|
|
|
|
|
|
|
|
|
tem2 = *((int *) VALUE_CONTENTS_RAW (arg2));
|
|
|
|
|
tem3 = *((int *) VALUE_CONTENTS_RAW (arg3));
|
|
|
|
|
|
|
|
|
|
if ((tem2 < 1) || (tem2 > tem3))
|
|
|
|
|
error ("Bad 'from' value %d on substring operation", tem2);
|
|
|
|
|
|
|
|
|
|
if ((tem3 < tem2) || (tem3 > (TYPE_LENGTH (VALUE_TYPE (arg1)))))
|
|
|
|
|
error ("Bad 'to' value %d on substring operation", tem3);
|
|
|
|
|
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
return value_slice (arg1, tem2, tem3 - tem2 + 1);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
case OP_COMPLEX:
|
1995-01-04 01:07:15 +00:00
|
|
|
|
/* We have a complex number, There should be 2 floating
|
|
|
|
|
point numbers that compose it */
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
return value_literal_complex (arg1, arg2, builtin_type_f_complex_s16);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case STRUCTOP_STRUCT:
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
tem = longest_to_int (exp->elts[pc + 1].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return value_zero (lookup_struct_elt_type (VALUE_TYPE (arg1),
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
&exp->elts[pc + 2].string,
|
1992-09-04 07:37:18 +00:00
|
|
|
|
0),
|
1991-03-28 16:26:26 +00:00
|
|
|
|
lval_memory);
|
|
|
|
|
else
|
|
|
|
|
{
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr temp = arg1;
|
|
|
|
|
return value_struct_elt (&temp, NULL, &exp->elts[pc + 2].string,
|
|
|
|
|
NULL, "structure");
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case STRUCTOP_PTR:
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
tem = longest_to_int (exp->elts[pc + 1].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (tem + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
1993-07-03 00:27:47 +00:00
|
|
|
|
return value_zero (lookup_struct_elt_type (VALUE_TYPE (arg1),
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
&exp->elts[pc + 2].string,
|
1992-09-04 07:37:18 +00:00
|
|
|
|
0),
|
1991-03-28 16:26:26 +00:00
|
|
|
|
lval_memory);
|
|
|
|
|
else
|
|
|
|
|
{
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr temp = arg1;
|
|
|
|
|
return value_struct_elt (&temp, NULL, &exp->elts[pc + 2].string,
|
|
|
|
|
NULL, "structure pointer");
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case STRUCTOP_MEMBER:
|
|
|
|
|
arg1 = evaluate_subexp_for_address (exp, pos, noside);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
goto handle_pointer_to_member;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case STRUCTOP_MPTR:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
handle_pointer_to_member:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
1992-03-20 21:57:17 +00:00
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_PTR)
|
|
|
|
|
goto bad_pointer_to_member;
|
|
|
|
|
type = TYPE_TARGET_TYPE (VALUE_TYPE (arg2));
|
|
|
|
|
if (TYPE_CODE (type) == TYPE_CODE_METHOD)
|
|
|
|
|
error ("not implemented: pointer-to-method in pointer-to-member construct");
|
|
|
|
|
if (TYPE_CODE (type) != TYPE_CODE_MEMBER)
|
|
|
|
|
goto bad_pointer_to_member;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
/* Now, convert these values to an address. */
|
1992-03-20 21:57:17 +00:00
|
|
|
|
arg1 = value_cast (lookup_pointer_type (TYPE_DOMAIN_TYPE (type)),
|
|
|
|
|
arg1);
|
|
|
|
|
arg3 = value_from_longest (lookup_pointer_type (TYPE_TARGET_TYPE (type)),
|
|
|
|
|
value_as_long (arg1) + value_as_long (arg2));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
return value_ind (arg3);
|
1992-03-20 21:57:17 +00:00
|
|
|
|
bad_pointer_to_member:
|
|
|
|
|
error("non-pointer-to-member value used in pointer-to-member construct");
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1993-07-03 00:27:47 +00:00
|
|
|
|
case BINOP_CONCAT:
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
|
|
|
|
else
|
|
|
|
|
return value_concat (arg1, arg2);
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case BINOP_ASSIGN:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
|
|
|
|
return value_assign (arg1, arg2);
|
|
|
|
|
|
|
|
|
|
case BINOP_ASSIGN_MODIFY:
|
|
|
|
|
(*pos) += 2;
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
op = exp->elts[pc + 1].opcode;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
return value_x_binop (arg1, arg2, BINOP_ASSIGN_MODIFY, op);
|
|
|
|
|
else if (op == BINOP_ADD)
|
|
|
|
|
arg2 = value_add (arg1, arg2);
|
|
|
|
|
else if (op == BINOP_SUB)
|
|
|
|
|
arg2 = value_sub (arg1, arg2);
|
|
|
|
|
else
|
|
|
|
|
arg2 = value_binop (arg1, arg2, op);
|
|
|
|
|
return value_assign (arg1, arg2);
|
|
|
|
|
|
|
|
|
|
case BINOP_ADD:
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
|
|
|
|
return value_add (arg1, arg2);
|
|
|
|
|
|
|
|
|
|
case BINOP_SUB:
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
|
|
|
|
return value_sub (arg1, arg2);
|
|
|
|
|
|
|
|
|
|
case BINOP_MUL:
|
|
|
|
|
case BINOP_DIV:
|
|
|
|
|
case BINOP_REM:
|
1993-01-05 01:18:07 +00:00
|
|
|
|
case BINOP_MOD:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
case BINOP_LSH:
|
|
|
|
|
case BINOP_RSH:
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case BINOP_BITWISE_AND:
|
|
|
|
|
case BINOP_BITWISE_IOR:
|
|
|
|
|
case BINOP_BITWISE_XOR:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS
|
1993-01-05 01:18:07 +00:00
|
|
|
|
&& (op == BINOP_DIV || op == BINOP_REM || op == BINOP_MOD))
|
1991-03-28 16:26:26 +00:00
|
|
|
|
return value_zero (VALUE_TYPE (arg1), not_lval);
|
|
|
|
|
else
|
|
|
|
|
return value_binop (arg1, arg2, op);
|
|
|
|
|
|
|
|
|
|
case BINOP_SUBSCRIPT:
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
1992-09-04 07:37:18 +00:00
|
|
|
|
{
|
|
|
|
|
/* If the user attempts to subscript something that has no target
|
|
|
|
|
type (like a plain int variable for example), then report this
|
|
|
|
|
as an error. */
|
|
|
|
|
|
|
|
|
|
type = TYPE_TARGET_TYPE (VALUE_TYPE (arg1));
|
|
|
|
|
if (type)
|
|
|
|
|
return value_zero (type, VALUE_LVAL (arg1));
|
|
|
|
|
else
|
|
|
|
|
error ("cannot subscript something of type `%s'",
|
|
|
|
|
TYPE_NAME (VALUE_TYPE (arg1)));
|
|
|
|
|
}
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
|
|
|
|
return value_subscript (arg1, arg2);
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
case BINOP_IN:
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
return value_in (arg1, arg2);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1993-01-02 20:32:01 +00:00
|
|
|
|
case MULTI_SUBSCRIPT:
|
|
|
|
|
(*pos) += 2;
|
|
|
|
|
nargs = longest_to_int (exp->elts[pc + 1].longconst);
|
|
|
|
|
arg1 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
while (nargs-- > 0)
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
/* FIXME: EVAL_SKIP handling may not be correct. */
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
{
|
|
|
|
|
if (nargs > 0)
|
|
|
|
|
{
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
goto nosideret;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
/* FIXME: EVAL_AVOID_SIDE_EFFECTS handling may not be correct. */
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
|
|
|
|
/* If the user attempts to subscript something that has no target
|
|
|
|
|
type (like a plain int variable for example), then report this
|
|
|
|
|
as an error. */
|
|
|
|
|
|
|
|
|
|
type = TYPE_TARGET_TYPE (VALUE_TYPE (arg1));
|
|
|
|
|
if (type != NULL)
|
|
|
|
|
{
|
|
|
|
|
arg1 = value_zero (type, VALUE_LVAL (arg1));
|
|
|
|
|
noside = EVAL_SKIP;
|
|
|
|
|
continue;
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
error ("cannot subscript something of type `%s'",
|
|
|
|
|
TYPE_NAME (VALUE_TYPE (arg1)));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
1995-02-12 19:21:04 +00:00
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
1993-01-02 20:32:01 +00:00
|
|
|
|
{
|
|
|
|
|
arg1 = value_x_binop (arg1, arg2, op, OP_NULL);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
arg1 = value_subscript (arg1, arg2);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return (arg1);
|
|
|
|
|
|
* eval.c (evaluate_subexp): Clean up handling of
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.
1995-02-02 03:37:26 +00:00
|
|
|
|
multi_f77_subscript:
|
1995-01-04 01:07:15 +00:00
|
|
|
|
{
|
|
|
|
|
int subscript_array[MAX_FORTRAN_DIMS+1]; /* 1-based array of
|
|
|
|
|
subscripts, max == 7 */
|
|
|
|
|
int array_size_array[MAX_FORTRAN_DIMS+1];
|
|
|
|
|
int ndimensions=1,i;
|
|
|
|
|
struct type *tmp_type;
|
|
|
|
|
int offset_item; /* The array offset where the item lives */
|
|
|
|
|
|
|
|
|
|
if (nargs > MAX_FORTRAN_DIMS)
|
|
|
|
|
error ("Too many subscripts for F77 (%d Max)", MAX_FORTRAN_DIMS);
|
|
|
|
|
|
|
|
|
|
ndimensions = calc_f77_array_dims (VALUE_TYPE (arg1));
|
|
|
|
|
|
|
|
|
|
if (nargs != ndimensions)
|
|
|
|
|
error ("Wrong number of subscripts");
|
|
|
|
|
|
|
|
|
|
/* Now that we know we have a legal array subscript expression
|
|
|
|
|
let us actually find out where this element exists in the array. */
|
|
|
|
|
|
|
|
|
|
tmp_type = VALUE_TYPE (arg1);
|
|
|
|
|
offset_item = 0;
|
|
|
|
|
for (i = 1; i <= nargs; i++)
|
|
|
|
|
{
|
|
|
|
|
/* Evaluate each subscript, It must be a legal integer in F77 */
|
|
|
|
|
arg2 = evaluate_subexp_with_coercion (exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT)
|
|
|
|
|
error ("Array subscripts must be of type integer");
|
|
|
|
|
|
|
|
|
|
/* Fill in the subscript and array size arrays */
|
|
|
|
|
|
|
|
|
|
subscript_array[i] = (* (unsigned int *) VALUE_CONTENTS(arg2));
|
|
|
|
|
|
|
|
|
|
retcode = f77_get_dynamic_upperbound (tmp_type, &upper);
|
|
|
|
|
if (retcode == BOUND_FETCH_ERROR)
|
|
|
|
|
error ("Cannot obtain dynamic upper bound");
|
|
|
|
|
|
|
|
|
|
retcode = f77_get_dynamic_lowerbound (tmp_type, &lower);
|
|
|
|
|
if (retcode == BOUND_FETCH_ERROR)
|
|
|
|
|
error("Cannot obtain dynamic lower bound");
|
|
|
|
|
|
|
|
|
|
array_size_array[i] = upper - lower + 1;
|
|
|
|
|
|
|
|
|
|
/* Zero-normalize subscripts so that offsetting will work. */
|
|
|
|
|
|
|
|
|
|
subscript_array[i] -= lower;
|
|
|
|
|
|
|
|
|
|
/* If we are at the bottom of a multidimensional
|
|
|
|
|
array type then keep a ptr to the last ARRAY
|
|
|
|
|
type around for use when calling value_subscript()
|
|
|
|
|
below. This is done because we pretend to value_subscript
|
|
|
|
|
that we actually have a one-dimensional array
|
|
|
|
|
of base element type that we apply a simple
|
|
|
|
|
offset to. */
|
|
|
|
|
|
|
|
|
|
if (i < nargs)
|
|
|
|
|
tmp_type = TYPE_TARGET_TYPE (tmp_type);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Now let us calculate the offset for this item */
|
|
|
|
|
|
|
|
|
|
offset_item = subscript_array[ndimensions];
|
|
|
|
|
|
|
|
|
|
for (i = ndimensions - 1; i >= 1; i--)
|
|
|
|
|
offset_item =
|
|
|
|
|
array_size_array[i] * offset_item + subscript_array[i];
|
|
|
|
|
|
|
|
|
|
/* Construct a value node with the value of the offset */
|
|
|
|
|
|
|
|
|
|
arg2 = value_from_longest (builtin_type_f_integer, offset_item);
|
|
|
|
|
|
|
|
|
|
/* Let us now play a dirty trick: we will take arg1
|
|
|
|
|
which is a value node pointing to the topmost level
|
|
|
|
|
of the multidimensional array-set and pretend
|
|
|
|
|
that it is actually a array of the final element
|
|
|
|
|
type, this will ensure that value_subscript()
|
|
|
|
|
returns the correct type value */
|
|
|
|
|
|
|
|
|
|
VALUE_TYPE (arg1) = tmp_type;
|
1995-02-12 19:21:04 +00:00
|
|
|
|
return value_ind (value_add (value_coerce_array (arg1), arg2));
|
1995-01-04 01:07:15 +00:00
|
|
|
|
}
|
|
|
|
|
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case BINOP_LOGICAL_AND:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
goto nosideret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldpos = *pos;
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
|
|
|
|
*pos = oldpos;
|
|
|
|
|
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
tem = value_logical_not (arg1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
|
|
|
|
|
(tem ? EVAL_SKIP : noside));
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int,
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
(LONGEST) (!tem && !value_logical_not (arg2)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case BINOP_LOGICAL_OR:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
goto nosideret;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
oldpos = *pos;
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
|
|
|
|
*pos = oldpos;
|
|
|
|
|
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
tem = value_logical_not (arg1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos,
|
|
|
|
|
(!tem ? EVAL_SKIP : noside));
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int,
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
(LONGEST) (!tem || !value_logical_not (arg2)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_EQUAL:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tem = value_equal (arg1, arg2);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_NOTEQUAL:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tem = value_equal (arg1, arg2);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) ! tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_LESS:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tem = value_less (arg1, arg2);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_GTR:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
tem = value_less (arg2, arg1);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_GEQ:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1992-06-19 21:09:54 +00:00
|
|
|
|
tem = value_less (arg2, arg1) || value_equal (arg1, arg2);
|
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_LEQ:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (VALUE_TYPE (arg1), exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (binop_user_defined_p (op, arg1, arg2))
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_x_binop (arg1, arg2, op, OP_NULL);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1992-06-19 21:09:54 +00:00
|
|
|
|
tem = value_less (arg1, arg2) || value_equal (arg1, arg2);
|
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST) tem);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case BINOP_REPEAT:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
arg2 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg2)) != TYPE_CODE_INT)
|
|
|
|
|
error ("Non-integral right operand for \"@\" operator.");
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return allocate_repeat_value (VALUE_TYPE (arg1),
|
1991-09-19 07:40:51 +00:00
|
|
|
|
longest_to_int (value_as_long (arg2)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_repeat (arg1, longest_to_int (value_as_long (arg2)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case BINOP_COMMA:
|
|
|
|
|
evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
case UNOP_NEG:
|
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (unop_user_defined_p (op, arg1))
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
else
|
|
|
|
|
return value_neg (arg1);
|
|
|
|
|
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case UNOP_COMPLEMENT:
|
1991-04-26 22:59:54 +00:00
|
|
|
|
/* C++: check for and handle destructor names. */
|
|
|
|
|
op = exp->elts[*pos].opcode;
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
if (unop_user_defined_p (UNOP_COMPLEMENT, arg1))
|
|
|
|
|
return value_x_unop (arg1, UNOP_COMPLEMENT);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
else
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
return value_complement (arg1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
case UNOP_LOGICAL_NOT:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
arg1 = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (unop_user_defined_p (op, arg1))
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
else
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int,
|
* Makefile.in (SFILES_MAINDIR): Add ch-exp.y.
* Makefile.in (YYFILES): Add ch-exp.tab.c.
* Makefile.in (YYOBJ): Add ch-exp.tab.o.
* Makefile.in (saber_gdb): Add unload of ch-exp.y and load
of ch-exp.tab.c.
* Makefile.in (distclean): Add target ch-exp.tab.c.
* Makefile.in (realclean): Add rm of ch-exp.tab.c.
* Makefile.in (c-exp.tab.c, m2-exp.tab.c): Add dependency on
Makefile since it contains sed patterns used in generation.
Add sed pattern to also delete #include of any malloc.h.
* Makefile.in (ch-exp.tab.o, ch-exp.tab.c): New targets.
* ch-exp.y: New expression parser, for GNU-Chill.
* c-exp.y, expr.c, expression.h, language.c, m2-exp.y,
parser-defs.h, valarith.c, valops.c, value.h: Remap macros and
function names to conform to K&R terminology with respect to
logical and bitwise operators:
UNOP_ZEROP => UNOP_LOGICAL_NOT
UNOP_LOGNOT => UNOP_COMPLEMENT
BINOP_LOGAND => BINOP_BITWISE_AND
BINOP_LOGXOR => BINOP_BITWISE_XOR
BINOP_LOGIOR => BINOP_BITWISE_IOR
BINOP_AND => BINOP_LOGICAL_AND
BINOP_OR => BINOP_LOGICAL_OR
PREC_OR => PREC_LOGICAL_OR
PREC_AND => PREC_LOGICAL_AND
PREC_LOGIOR => PREC_BITWISE_IOR
PREC_LOGXOR => PREC_BITWISE_XOR
PREC_LOGAND => PREC_BITWISE_AND
value_zerop() => value_logical_not()
value_lognot() => value_complement()
* c-exp.y (c_op_print_tab): Add explicit empty terminator.
* m2-exp.y (m2_op_print_tab): Add explicit empty terminator.
* defs.h (enum language): Add language_chill.
* dwarfread.c (set_cu_language): Add LANG_CHILL case and make
LANG_MODULA2 a recognized language.
* eval.c (evaluate_subexp): Add OP_BOOL case.
* expprint.c (print_subexp): Add OP_BOOL case.
* gdbtypes.h (enum_typecode): Note TYPE_CODE_BOOL used for
Chill as well as Modula-2.
* gdbtypes.y (builtin_type_chill_bool, builtin_type_chill_long,
builtin_type_chill_ulong, builtin_type_chill_real): Add.
* i387-tdep.c (sys/dir.h): Remove, appears to be unnecessary
and is nonexistant in some SVR4 based systems.
* language.c (DEFAULT_ALLOCSIZE): Change from 3 => 4.
* language.c (set_language_command): Add chill.
* language.c (binop_result_type, integral_type, character_type,
boolean_type, structured_type, value_true, binop_type_check):
Add language_chill cases.
* language.h (_LANG_chill): Define.
* m2-exp.y (number_sign, modblock): Make static, #ifdef out
unused modblock.
* m2-exp.y (ANDAND): Rename to LOGICAL_AND.
* source.c (source_info): Fix minor nits, print "1 line" rather
than "1 lines", and "language is <lang>".
* symfile.c (deduce_language_from_filename): Recognize the
filename extensions ".chill", ".c186", and ".c286" for Chill.
* valarith.c (value_binop): Handle TYPE_CODE_BOOL as well
as TYPE_CODE_INT and TYPE_CODE_FLOAT.
* valprint.c (val_print): Print TYPE_CODE_BOOL type values as
"TRUE" or "FALSE".
* valprint.c (typedef_print): Add case for language_chill.
* values.c (value_from_longest): Handle TYPE_CODE_BOOL.
1992-11-15 17:28:02 +00:00
|
|
|
|
(LONGEST) value_logical_not (arg1));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case UNOP_IND:
|
|
|
|
|
if (expect_type && TYPE_CODE (expect_type) == TYPE_CODE_PTR)
|
|
|
|
|
expect_type = TYPE_TARGET_TYPE (expect_type);
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
|
|
|
|
if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_PTR
|
|
|
|
|
|| TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_REF
|
|
|
|
|
/* In C you can dereference an array to get the 1st elt. */
|
|
|
|
|
|| TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_ARRAY
|
|
|
|
|
)
|
|
|
|
|
return value_zero (TYPE_TARGET_TYPE (VALUE_TYPE (arg1)),
|
|
|
|
|
lval_memory);
|
|
|
|
|
else if (TYPE_CODE (VALUE_TYPE (arg1)) == TYPE_CODE_INT)
|
|
|
|
|
/* GDB allows dereferencing an int. */
|
|
|
|
|
return value_zero (builtin_type_int, lval_memory);
|
|
|
|
|
else
|
|
|
|
|
error ("Attempt to take contents of a non-pointer value.");
|
|
|
|
|
}
|
|
|
|
|
return value_ind (arg1);
|
|
|
|
|
|
|
|
|
|
case UNOP_ADDR:
|
|
|
|
|
/* C++: check for and handle pointer to members. */
|
|
|
|
|
|
|
|
|
|
op = exp->elts[*pos].opcode;
|
|
|
|
|
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
{
|
|
|
|
|
if (op == OP_SCOPE)
|
|
|
|
|
{
|
* Makefile.in (VERSION): Bump to 4.7.4.
* Makefile.in (SFILES_MAINDIR): Add typeprint.c, c-typeprint.c,
m2-typeprint.c, c-valprint.c cp-valprint.c m2-valprint.c.
* Makefile.in (HFILES): Add valprint.h.
* Makefile.in (OBS): Add typeprint.o, c-typeprint.o,
m2-typeprint.o, c-valprint.o, cp-valprint.o m2-valprint.o.
* typeprint.c, typeprint.h: New files for language independent
type printing functions.
* c-typeprint.c, m2-typeprint.c: New files for language dependent
type printing functions and definitions.
* valprint.h: New include file for language independent value
printing definitions.
* c-valprint.c, cp-valprint.c, m2-valprint.c: New files for language
dependent value printing functions.
* c-exp.y (production ptype): Add range_type variable and use new
create_range_type function.
* c-exp.y (tokentab2, tokentab3), c-lang.c (c_op_print_tab),
infcmd.c (path_var_name), language.c (unk_op_print_tab),
m2-lang.c (m2_op_print_tab): Change from ANSI-obsolescent
"const static" to ANSI-conformant "static const".
* c-exp.y (c_create_fundamental_type): Remove unused nbytes.
* c-exp.y (c_language_defn, cplus_language_defn): Add c_print_type,
and c_val_print.
* c-lang.h (c_print_type, c_val_print): Add prototypes.
* coffread.c (decode_type): Add range_type variable and call to
new create_range_type function.
* complaints.c (complain): Remove unused val variable.
* complaints.c (_initialize_complaints): Make it void.
* convex-tdep.c (value_of_trapped_internalvar): Add range_type
variable and call new create_range_type function.
* defs.h (enum val_prettyprint): Move enum from value.h to here
so we can avoid having to include value.h just for prototypes that
need the enum (thanks ANSI).
* dwarfread.c (struct_type): Local anonymous_size variable is
only used if !BITS_BIG_ENDIAN.
* dwarfread.c (decode_subscript_data_item): Add rangetype
variable and call new create_range_type function.
* elfread.c (elf_symfile_read): Remove unused dbx and text_sect
variables.
* eval.c (evaluate_subexp): Remove unused local variable name
and the statement with no side effects that initializes it.
* expprint.c (print_subexp): Change local_printstr to
LA_PRINT_STRING.
* gdbtypes.c (create_range_type): New function that creates
a range type using code fragments from object file readers as
an example of what has to be initialized.
* gdbtypes.c (create_array_type): Removed index_type, low_bound,
and high_bound parameters, replaced with a single range_type
parameter. Change function body to use passed in range_type
rather than handcrafting one.
* gdbtypes.h (create_range_type): Add prototype.
* gdbtypes.h (create_array_type): Change prototype parameters.
* infrun.c (normal_stop): Remove unused local variables tem and c.
* infrun.c (hook_stop_stub): Return 0 rather than random value.
* language.c (unk_lang_print_type, unk_lang_val_print): Add
stub functions that call error if called.
* language.c (unknown_language_defn, auto_language_defn,
local_language_defn): Add initializers unk_lang_print_type and
unk_lang_val_print.
* language.h (struct language_defn): Reformat for larger
comments, add la_print_type and la_val_print members. Add
LA_PRINT_TYPE and LA_VAL_PRINT macros. Change local_printchar
to LA_PRINT_CHAR and local_printstr to LA_PRINT_STRING.
* m2-lang.c (m2_create_fundamental_type): Remove unused local
variable nbytes.
* m2-lang.c (m2_language_defn): Add initializers m2_print_type
and m2_val_print.
* m2-lang.h (m2_print_type, m2_val_print): Add prototypes.
* main.c (execute_command): Remove unused local variable cmdlines.
* main.c (echo_command), stabsread.c (read_type), printcmd.c
(clear_displays), symmisc.c (block_depth), values.c
(clear_value_history):
Make testing of truth value of assignment result explicit.
* mipsread.c (upgrade_type): Update FIXME to include future use
of create_range_type.
* printcmd.c (ptype_command, ptype_eval, whatis_command,
whatis_exp, maintenance_print_type): Move prototypes and functions
to new typeprint.c.
* printcmd.c (_initialize_printcmd): Move add_com calls for
ptype_command and whatis_command to new typeprint.c.
* ser-bsd.c (serial_open): Remove unused variable sgttyb.
* source.c (find_source_lines): Local variable c only used
when LSEEK_NOT_LINEAR is defined.
* stabsread.c (read_array_type): Use new create_range_type
function.
* stabsread.c (read_range_type): Add new index_type variable and
call new create_range_type function rather than handcrafting
range types.
* symmisc.c (type_print_1): Change usages to LA_PRINT_TYPE.
* symtab.c (typedef_print usages): Use c_typedef_print, renamed.
* symtab.c (type_print_base usages): Use c_type_print_base.
* symtab.c (type_print_varspec_prefix usages): Use
c_type_print_varspec_prefix.
* symtab.c (type_print_method_args usages): Use
cp_type_print_method_args.
* valprint.c: Completely ripped apart and the fragments used
to create c-valprint.c, cp-valprint.c, m2-valprint.c, and
valprint.h. Remaining stuff is language independent.
* value.h (struct fn_field): Forward declare for prototypes.
* value.h (type_print_1): Remove prototype.
* value.h (enum val_prettyprint): Moved to defs.h.
* value.h (typedef_print): Prototype renamed to c_typedef_print.
* value.h (baseclass_offset): Add prototype.
**** start-sanitize-chill ****
* Makefile.in (SFILES_MAINDIR): Add ch-typeprint.c, ch-valprint.c.
* Makefile.in (OBS): Add ch-typeprint.o, ch-valprint.o.
* ch-typeprint.c: New file for language dependent type printing.
* ch-valprint.c: New file for language dependent value printing.
* ch-exp.y (parse_number): Remove prototype and stub function.
* ch-exp.y (decode_integer_literal): Removed unused digits and
temp variables.
* ch-exp.y (convert_float): Completely ifdef out for now.
* ch-exp.y (tokentab2, tokentab3, tokentab4, tokentab5),
ch-lang.c (chill_op_print_tab):
Change from ANSI-obsolescent "const static" to ANSI-conformant
"static const".
* ch-exp.y (yylex): Add unhandled storage class enumeration
literals to switch statement for completeness.
* ch-lang.c (chill_create_fundamental_types): Remove unused
nbytes variable. Change dummy type to 2 bytes to match int.
Handle FT_VOID types gratuituously added to chill DWARF by
compiler. Change FT_CHAR case to generate an TYPE_CODE_CHAR
type rather than a one byte TYPE_CODE_INT type.
* ch-lang.c (chill_language_defn): Add chill_print_type and
chill_val_print.
* ch-lang.h (chill_print_type, chill_val_print): Add prototypes.
**** end-sanitize-chill ****
1992-12-18 20:21:32 +00:00
|
|
|
|
int temm = longest_to_int (exp->elts[pc+3].longconst);
|
1993-07-03 00:27:47 +00:00
|
|
|
|
(*pos) += 3 + BYTES_TO_EXP_ELEM (temm + 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
evaluate_subexp (expect_type, exp, pos, EVAL_SKIP);
|
|
|
|
|
goto nosideret;
|
|
|
|
|
}
|
|
|
|
|
|
1992-03-20 21:57:17 +00:00
|
|
|
|
return evaluate_subexp_for_address (exp, pos, noside);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case UNOP_SIZEOF:
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
{
|
|
|
|
|
evaluate_subexp (NULL_TYPE, exp, pos, EVAL_SKIP);
|
|
|
|
|
goto nosideret;
|
|
|
|
|
}
|
|
|
|
|
return evaluate_subexp_for_sizeof (exp, pos);
|
|
|
|
|
|
|
|
|
|
case UNOP_CAST:
|
|
|
|
|
(*pos) += 2;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
type = exp->elts[pc + 1].type;
|
|
|
|
|
arg1 = evaluate_subexp (type, exp, pos, noside);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
if (type != VALUE_TYPE (arg1))
|
|
|
|
|
arg1 = value_cast (type, arg1);
|
|
|
|
|
return arg1;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case UNOP_MEMVAL:
|
|
|
|
|
(*pos) += 2;
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP)
|
|
|
|
|
goto nosideret;
|
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return value_zero (exp->elts[pc + 1].type, lval_memory);
|
|
|
|
|
else
|
|
|
|
|
return value_at_lazy (exp->elts[pc + 1].type,
|
1991-09-19 07:40:51 +00:00
|
|
|
|
value_as_pointer (arg1));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
case UNOP_PREINCREMENT:
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
else if (unop_user_defined_p (op, arg1))
|
|
|
|
|
{
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
arg2 = value_add (arg1, value_from_longest (builtin_type_char,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) 1));
|
|
|
|
|
return value_assign (arg1, arg2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case UNOP_PREDECREMENT:
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
else if (unop_user_defined_p (op, arg1))
|
|
|
|
|
{
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
arg2 = value_sub (arg1, value_from_longest (builtin_type_char,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) 1));
|
|
|
|
|
return value_assign (arg1, arg2);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case UNOP_POSTINCREMENT:
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
else if (unop_user_defined_p (op, arg1))
|
|
|
|
|
{
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
arg2 = value_add (arg1, value_from_longest (builtin_type_char,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) 1));
|
|
|
|
|
value_assign (arg1, arg2);
|
|
|
|
|
return arg1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case UNOP_POSTDECREMENT:
|
|
|
|
|
arg1 = evaluate_subexp (expect_type, exp, pos, noside);
|
|
|
|
|
if (noside == EVAL_SKIP || noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
return arg1;
|
|
|
|
|
else if (unop_user_defined_p (op, arg1))
|
|
|
|
|
{
|
|
|
|
|
return value_x_unop (arg1, op);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
1991-09-19 07:40:51 +00:00
|
|
|
|
arg2 = value_sub (arg1, value_from_longest (builtin_type_char,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) 1));
|
|
|
|
|
value_assign (arg1, arg2);
|
|
|
|
|
return arg1;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
case OP_THIS:
|
|
|
|
|
(*pos) += 1;
|
|
|
|
|
return value_of_this (1);
|
|
|
|
|
|
1993-07-03 00:27:47 +00:00
|
|
|
|
case OP_TYPE:
|
|
|
|
|
error ("Attempt to use a type name as an expression");
|
|
|
|
|
|
1991-03-28 16:26:26 +00:00
|
|
|
|
default:
|
1993-07-03 00:27:47 +00:00
|
|
|
|
/* Removing this case and compiling with gcc -Wall reveals that
|
|
|
|
|
a lot of cases are hitting this case. Some of these should
|
|
|
|
|
probably be removed from expression.h (e.g. do we need a BINOP_SCOPE
|
|
|
|
|
and an OP_SCOPE?); others are legitimate expressions which are
|
|
|
|
|
(apparently) not fully implemented.
|
|
|
|
|
|
|
|
|
|
If there are any cases landing here which mean a user error,
|
|
|
|
|
then they should be separate cases, with more descriptive
|
|
|
|
|
error messages. */
|
|
|
|
|
|
|
|
|
|
error ("\
|
1995-01-04 01:07:15 +00:00
|
|
|
|
GDB does not (yet) know how to evaluate that kind of expression");
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
nosideret:
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_long, (LONGEST) 1);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Evaluate a subexpression of EXP, at index *POS,
|
|
|
|
|
and return the address of that subexpression.
|
|
|
|
|
Advance *POS over the subexpression.
|
|
|
|
|
If the subexpression isn't an lvalue, get an error.
|
|
|
|
|
NOSIDE may be EVAL_AVOID_SIDE_EFFECTS;
|
|
|
|
|
then only the type of the result need be correct. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
static value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
evaluate_subexp_for_address (exp, pos, noside)
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
enum noside noside;
|
|
|
|
|
{
|
|
|
|
|
enum exp_opcode op;
|
|
|
|
|
register int pc;
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
struct symbol *var;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
pc = (*pos);
|
|
|
|
|
op = exp->elts[pc].opcode;
|
|
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
|
{
|
|
|
|
|
case UNOP_IND:
|
|
|
|
|
(*pos)++;
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
|
|
|
|
|
|
|
|
|
case UNOP_MEMVAL:
|
|
|
|
|
(*pos) += 3;
|
|
|
|
|
return value_cast (lookup_pointer_type (exp->elts[pc + 1].type),
|
|
|
|
|
evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
|
|
|
|
|
case OP_VAR_VALUE:
|
1993-08-18 19:33:39 +00:00
|
|
|
|
var = exp->elts[pc + 2].symbol;
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
|
|
|
|
|
/* C++: The "address" of a reference should yield the address
|
|
|
|
|
* of the object pointed to. Let value_addr() deal with it. */
|
|
|
|
|
if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_REF)
|
|
|
|
|
goto default_case;
|
|
|
|
|
|
1993-08-18 19:33:39 +00:00
|
|
|
|
(*pos) += 4;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
|
|
|
|
struct type *type =
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
lookup_pointer_type (SYMBOL_TYPE (var));
|
|
|
|
|
enum address_class sym_class = SYMBOL_CLASS (var);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
if (sym_class == LOC_CONST
|
|
|
|
|
|| sym_class == LOC_CONST_BYTES
|
|
|
|
|
|| sym_class == LOC_REGISTER
|
|
|
|
|
|| sym_class == LOC_REGPARM)
|
|
|
|
|
error ("Attempt to take address of register or constant.");
|
|
|
|
|
|
|
|
|
|
return
|
|
|
|
|
value_zero (type, not_lval);
|
|
|
|
|
}
|
|
|
|
|
else
|
1993-08-18 19:33:39 +00:00
|
|
|
|
return
|
|
|
|
|
locate_var_value
|
|
|
|
|
(var,
|
|
|
|
|
block_innermost_frame (exp->elts[pc + 1].block));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
default:
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
default_case:
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (noside == EVAL_AVOID_SIDE_EFFECTS)
|
|
|
|
|
{
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr x = evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
if (VALUE_LVAL (x) == lval_memory)
|
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
1991-12-19 01:14:31 +00:00
|
|
|
|
return value_zero (lookup_pointer_type (VALUE_TYPE (x)),
|
1991-03-28 16:26:26 +00:00
|
|
|
|
not_lval);
|
|
|
|
|
else
|
|
|
|
|
error ("Attempt to take address of non-lval");
|
|
|
|
|
}
|
|
|
|
|
return value_addr (evaluate_subexp (NULL_TYPE, exp, pos, noside));
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Evaluate like `evaluate_subexp' except coercing arrays to pointers.
|
1993-01-03 22:24:21 +00:00
|
|
|
|
When used in contexts where arrays will be coerced anyway, this is
|
|
|
|
|
equivalent to `evaluate_subexp' but much faster because it avoids
|
1993-08-18 19:33:39 +00:00
|
|
|
|
actually fetching array contents (perhaps obsolete now that we have
|
|
|
|
|
VALUE_LAZY).
|
1993-01-03 22:24:21 +00:00
|
|
|
|
|
|
|
|
|
Note that we currently only do the coercion for C expressions, where
|
|
|
|
|
arrays are zero based and the coercion is correct. For other languages,
|
|
|
|
|
with nonzero based arrays, coercion loses. Use CAST_IS_CONVERSION
|
|
|
|
|
to decide if coercion is appropriate.
|
|
|
|
|
|
1993-08-18 19:33:39 +00:00
|
|
|
|
*/
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
1995-02-12 19:21:04 +00:00
|
|
|
|
value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
evaluate_subexp_with_coercion (exp, pos, noside)
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
enum noside noside;
|
|
|
|
|
{
|
|
|
|
|
register enum exp_opcode op;
|
|
|
|
|
register int pc;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
register value_ptr val;
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
struct symbol *var;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
pc = (*pos);
|
|
|
|
|
op = exp->elts[pc].opcode;
|
|
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
|
{
|
|
|
|
|
case OP_VAR_VALUE:
|
1993-08-18 19:33:39 +00:00
|
|
|
|
var = exp->elts[pc + 2].symbol;
|
1993-01-03 22:24:21 +00:00
|
|
|
|
if (TYPE_CODE (SYMBOL_TYPE (var)) == TYPE_CODE_ARRAY
|
|
|
|
|
&& CAST_IS_CONVERSION)
|
1991-03-28 16:26:26 +00:00
|
|
|
|
{
|
1993-08-18 19:33:39 +00:00
|
|
|
|
(*pos) += 4;
|
|
|
|
|
val =
|
|
|
|
|
locate_var_value
|
|
|
|
|
(var, block_innermost_frame (exp->elts[pc + 1].block));
|
* core.c, eval.c, exec.c, inftarg.c, remote-adapt.c, remote-eb.c,
remote-hms.c, remote-mm.c, remote-nindy.c, remote-vx.c, remote.c,
target.c, target.h, valarith.c, valops.c, value.h, xcoffexec.c:
Remove to_call_function and target_call_function, since it
always calls the same thing (call_function_by_hand).
1992-02-21 01:34:46 +00:00
|
|
|
|
return value_cast (lookup_pointer_type (TYPE_TARGET_TYPE (SYMBOL_TYPE (var))),
|
1991-03-28 16:26:26 +00:00
|
|
|
|
val);
|
|
|
|
|
}
|
1993-08-18 19:33:39 +00:00
|
|
|
|
/* FALLTHROUGH */
|
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
return evaluate_subexp (NULL_TYPE, exp, pos, noside);
|
1991-03-28 16:26:26 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/* Evaluate a subexpression of EXP, at index *POS,
|
|
|
|
|
and return a value for the size of that subexpression.
|
|
|
|
|
Advance *POS over the subexpression. */
|
|
|
|
|
|
1995-01-04 01:07:15 +00:00
|
|
|
|
static value_ptr
|
1991-03-28 16:26:26 +00:00
|
|
|
|
evaluate_subexp_for_sizeof (exp, pos)
|
|
|
|
|
register struct expression *exp;
|
|
|
|
|
register int *pos;
|
|
|
|
|
{
|
|
|
|
|
enum exp_opcode op;
|
|
|
|
|
register int pc;
|
1995-01-04 01:07:15 +00:00
|
|
|
|
value_ptr val;
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
pc = (*pos);
|
|
|
|
|
op = exp->elts[pc].opcode;
|
|
|
|
|
|
|
|
|
|
switch (op)
|
|
|
|
|
{
|
|
|
|
|
/* This case is handled specially
|
|
|
|
|
so that we avoid creating a value for the result type.
|
|
|
|
|
If the result type is very big, it's desirable not to
|
|
|
|
|
create a value unnecessarily. */
|
|
|
|
|
case UNOP_IND:
|
|
|
|
|
(*pos)++;
|
|
|
|
|
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int, (LONGEST)
|
1991-03-28 16:26:26 +00:00
|
|
|
|
TYPE_LENGTH (TYPE_TARGET_TYPE (VALUE_TYPE (val))));
|
|
|
|
|
|
|
|
|
|
case UNOP_MEMVAL:
|
|
|
|
|
(*pos) += 3;
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) TYPE_LENGTH (exp->elts[pc + 1].type));
|
|
|
|
|
|
|
|
|
|
case OP_VAR_VALUE:
|
1993-08-18 19:33:39 +00:00
|
|
|
|
(*pos) += 4;
|
|
|
|
|
return
|
|
|
|
|
value_from_longest
|
|
|
|
|
(builtin_type_int,
|
|
|
|
|
(LONGEST) TYPE_LENGTH (SYMBOL_TYPE (exp->elts[pc + 2].symbol)));
|
1991-03-28 16:26:26 +00:00
|
|
|
|
|
|
|
|
|
default:
|
|
|
|
|
val = evaluate_subexp (NULL_TYPE, exp, pos, EVAL_AVOID_SIDE_EFFECTS);
|
1991-09-19 07:40:51 +00:00
|
|
|
|
return value_from_longest (builtin_type_int,
|
1991-03-28 16:26:26 +00:00
|
|
|
|
(LONGEST) TYPE_LENGTH (VALUE_TYPE (val)));
|
|
|
|
|
}
|
|
|
|
|
}
|
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
1991-12-19 01:14:31 +00:00
|
|
|
|
|
|
|
|
|
/* Parse a type expression in the string [P..P+LENGTH). */
|
|
|
|
|
|
|
|
|
|
struct type *
|
|
|
|
|
parse_and_eval_type (p, length)
|
|
|
|
|
char *p;
|
|
|
|
|
int length;
|
|
|
|
|
{
|
|
|
|
|
char *tmp = (char *)alloca (length + 4);
|
|
|
|
|
struct expression *expr;
|
|
|
|
|
tmp[0] = '(';
|
1992-09-04 07:37:18 +00:00
|
|
|
|
memcpy (tmp+1, p, length);
|
* command.h, defs.h, eval.h, expression.h, remote-sa.sparc.c,
sparc-tdep.c, symtab.h, target.h, value.h, vx-share/ptrace.h,
vx-share/xdr_ptrace.h, vx-share/xdr_rdb.h: ANSIfy enums.
1991-12-19 01:14:31 +00:00
|
|
|
|
tmp[length+1] = ')';
|
|
|
|
|
tmp[length+2] = '0';
|
|
|
|
|
tmp[length+3] = '\0';
|
|
|
|
|
expr = parse_expression (tmp);
|
|
|
|
|
if (expr->elts[0].opcode != UNOP_CAST)
|
|
|
|
|
error ("Internal error in eval_type.");
|
|
|
|
|
return expr->elts[1].type;
|
|
|
|
|
}
|
1995-01-04 01:07:15 +00:00
|
|
|
|
|
|
|
|
|
int
|
|
|
|
|
calc_f77_array_dims (array_type)
|
|
|
|
|
struct type *array_type;
|
|
|
|
|
{
|
|
|
|
|
int ndimen = 1;
|
|
|
|
|
struct type *tmp_type;
|
|
|
|
|
|
|
|
|
|
if ((TYPE_CODE(array_type) != TYPE_CODE_ARRAY))
|
|
|
|
|
error ("Can't get dimensions for a non-array type");
|
|
|
|
|
|
|
|
|
|
tmp_type = array_type;
|
|
|
|
|
|
1995-03-14 02:37:20 +00:00
|
|
|
|
while ((tmp_type = TYPE_TARGET_TYPE (tmp_type)))
|
1995-01-04 01:07:15 +00:00
|
|
|
|
{
|
|
|
|
|
if (TYPE_CODE (tmp_type) == TYPE_CODE_ARRAY)
|
|
|
|
|
++ndimen;
|
|
|
|
|
}
|
|
|
|
|
return ndimen;
|
|
|
|
|
}
|