1999-04-16 03:35:26 +02:00
|
|
|
/* Definitions for expressions stored in reversed prefix form, for GDB.
|
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* ax-gdb.c, c-valprint.c, charset.c, corefile.c: Update copyright.
* demangle.c, disasm.c, dwarf2cfi.c, dwarfread.c: Update copyright.
* elfread.c, eval.c, expprint.c, expression.h: Update copyright.
* f-typeprint.c, findvar.c, gcore.c, gdb_mbuild.sh: Update copyright.
* gdbtypes.h, gnu-v2-abi.c, inferior.h, inftarg.c: Update copyright.
* language.c, language.h, m32r-tdep.c: Update copyright.
* mn10200-tdep.c, scm-lang.c, scm-lang.h: Update copyright.
* somsolib.c, somsolib.h, symfile.c, symtab.h: Update copyright.
* thread-db.c, typeprint.c, utils.c, valarith.c: Update copyright.
* values.c, win32-nat.c, x86-64-linux-nat.c: Update copyright.
* x86-64-linux-tdep.c, z8k-tdep.c: Update copyright.
* cli/cli-decode.h, config/h8500/tm-h8500.h: Update copyright.
Index: mi/ChangeLog
2003-01-13 Andrew Cagney <ac131313@redhat.com>
* mi-cmd-env.c: Update copyright.
2003-01-14 01:49:06 +01:00
|
|
|
|
2012-01-04 09:17:56 +01:00
|
|
|
Copyright (C) 1986, 1989, 1992, 1994, 2000, 2003, 2005, 2007-2012
|
|
|
|
Free Software Foundation, Inc.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This file is part of GDB.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is free software; you can redistribute it and/or modify
|
|
|
|
it under the terms of the GNU General Public License as published by
|
2007-08-23 20:08:50 +02:00
|
|
|
the Free Software Foundation; either version 3 of the License, or
|
1999-07-07 22:19:36 +02:00
|
|
|
(at your option) any later version.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
This program is distributed in the hope that it will be useful,
|
|
|
|
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.
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
You should have received a copy of the GNU General Public License
|
2007-08-23 20:08:50 +02:00
|
|
|
along with this program. If not, see <http://www.gnu.org/licenses/>. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#if !defined (EXPRESSION_H)
|
|
|
|
#define EXPRESSION_H 1
|
|
|
|
|
|
|
|
|
2011-01-07 20:36:19 +01:00
|
|
|
#include "symtab.h" /* Needed for "struct block" type. */
|
* defs.h (HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_FLOAT_FORMAT, HOST_DOUBLE_FORMAT)
(HOST_LONG_DOUBLE_FORMAT, DOUBLEST)
(floatformat_to_doublest, floatformat_from_doublest)
(floatformat_is_negative, floatformat_is_nan)
(floatformat_mantissa, store_floating)
(extract_floating): Move declaration from here.
* doublest.h: To here. New file.
* utils.c (get_field, floatformat_to_doublest, put_field)
(ldfrexp, floatformat_from_doublest, floatformat_is_negative)
(floatformat_is_nan, floatformat_mantissa)
(FLOATFORMAT_CHAR_BIT): Move from here.
* doublest.c: To here. New file.
* findvar.c (store_floating, extract_floating): Move from here.
* doublest.c: To here.
* Makefile.in (SFILES): Add doublest.c.
(COMMON_OBS): Add doublest.o.
(doublest.o): Specify dependencies.
(doublest_h): Define.
* config/m88k/tm-m88k.h: Include "doublest.h".
* config/i960/tm-i960.h: Ditto.
* config/i386/tm-symmetry.h: Ditto.
* rs6000-tdep.c, valarith.c: Ditto.
* valprint.c, stabsread.c, sh-tdep.c: Ditto.
* ia64-tdep.c, i387-tdep.c, i386-tdep.c: Ditto.
* values.c, arm-tdep.c, arm-linux-tdep.c: Ditto.
* alpha-tdep.c, ax.h, expression.h: Ditto.
* sh-tdep.c, parse.c, top.c, value.h: Ditto.
* Makefile.in (arm-tdep.o): Add $(doublest_h).
(i386-tdep.o, i387-tdep.o, ia64-tdep.o): Ditto.
(rs6000-tdep.o, stabsread.o, valarith.o): Ditto.
(values.o, valprint.o, arm-linux-tdep.o): Ditto.
(alpha-tdep.o, ax_h, parse.o, top.o, value_h): Ditto.
(parser_defs_h): Ditto.
(expression_h): Add $(doublest_h) and $(symtab_h).
2001-08-01 20:39:27 +02:00
|
|
|
#include "doublest.h" /* Needed for DOUBLEST. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
|
|
|
|
/* Definitions for saved C expressions. */
|
|
|
|
|
|
|
|
/* An expression is represented as a vector of union exp_element's.
|
|
|
|
Each exp_element is an opcode, except that some opcodes cause
|
|
|
|
the following exp_element to be treated as a long or double constant
|
|
|
|
or as a variable. The opcodes are obeyed, using a stack for temporaries.
|
|
|
|
The value is left on the temporary stack at the end. */
|
|
|
|
|
|
|
|
/* When it is necessary to include a string,
|
|
|
|
it can occupy as many exp_elements as it needs.
|
|
|
|
We find the length of the string using strlen,
|
|
|
|
divide to find out how many exp_elements are used up,
|
|
|
|
and skip that many. Strings, like numbers, are indicated
|
|
|
|
by the preceding opcode. */
|
|
|
|
|
|
|
|
enum exp_opcode
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
2011-02-01 19:54:01 +01:00
|
|
|
#define OP(name) name ,
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2011-02-01 19:54:01 +01:00
|
|
|
#include "std-operator.def"
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2011-02-01 19:54:01 +01:00
|
|
|
/* First extension operator. Individual language modules define extra
|
|
|
|
operators in *.def include files below with numbers higher than
|
|
|
|
OP_EXTENDED0. */
|
|
|
|
OP (OP_EXTENDED0)
|
1999-07-07 22:19:36 +02:00
|
|
|
|
2011-02-01 19:54:01 +01:00
|
|
|
/* Language specific operators. */
|
|
|
|
#include "ada-operator.def"
|
1999-07-07 22:19:36 +02:00
|
|
|
|
2011-02-01 19:54:01 +01:00
|
|
|
#undef OP
|
2009-09-15 18:09:32 +02:00
|
|
|
|
|
|
|
/* Existing only to swallow the last comma (',') from last .inc file. */
|
|
|
|
OP_UNUSED_LAST
|
1999-07-07 22:19:36 +02:00
|
|
|
};
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
union exp_element
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
|
|
|
enum exp_opcode opcode;
|
|
|
|
struct symbol *symbol;
|
|
|
|
LONGEST longconst;
|
|
|
|
DOUBLEST doubleconst;
|
2007-10-25 20:01:58 +02:00
|
|
|
gdb_byte decfloatconst[16];
|
1999-07-07 22:19:36 +02:00
|
|
|
/* Really sizeof (union exp_element) characters (or less for the last
|
|
|
|
element of a string). */
|
|
|
|
char string;
|
|
|
|
struct type *type;
|
|
|
|
struct internalvar *internalvar;
|
|
|
|
struct block *block;
|
2006-10-10 05:17:53 +02:00
|
|
|
struct objfile *objfile;
|
1999-07-07 22:19:36 +02:00
|
|
|
};
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
struct expression
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
2011-01-05 23:22:53 +01:00
|
|
|
const struct language_defn *language_defn; /* language it was
|
2011-01-07 20:36:19 +01:00
|
|
|
entered in. */
|
|
|
|
struct gdbarch *gdbarch; /* architecture it was parsed in. */
|
1999-07-07 22:19:36 +02:00
|
|
|
int nelts;
|
|
|
|
union exp_element elts[1];
|
|
|
|
};
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* Macros for converting between number of expression elements and bytes
|
2011-01-07 20:36:19 +01:00
|
|
|
to store that many expression elements. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
#define EXP_ELEM_TO_BYTES(elements) \
|
|
|
|
((elements) * sizeof (union exp_element))
|
|
|
|
#define BYTES_TO_EXP_ELEM(bytes) \
|
|
|
|
(((bytes) + sizeof (union exp_element) - 1) / sizeof (union exp_element))
|
|
|
|
|
|
|
|
/* From parse.c */
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
extern struct expression *parse_expression (char *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2008-06-06 22:58:08 +02:00
|
|
|
extern struct type *parse_field_expression (char *, char **);
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
extern struct expression *parse_exp_1 (char **, struct block *, int);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2008-06-06 22:58:08 +02:00
|
|
|
/* For use by parsers; set if we want to parse an expression and
|
|
|
|
attempt to complete a field name. */
|
|
|
|
extern int in_parse_field;
|
|
|
|
|
1999-04-16 03:35:26 +02:00
|
|
|
/* The innermost context required by the stack and register variables
|
|
|
|
we've encountered so far. To use this, set it to NULL, then call
|
|
|
|
parse_<whatever>, then look at it. */
|
|
|
|
extern struct block *innermost_block;
|
|
|
|
|
|
|
|
/* From eval.c */
|
|
|
|
|
2002-09-19 05:58:41 +02:00
|
|
|
/* Values of NOSIDE argument to eval_subexp. */
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
enum noside
|
1999-07-07 22:19:36 +02:00
|
|
|
{
|
|
|
|
EVAL_NORMAL,
|
|
|
|
EVAL_SKIP, /* Only effect is to increment pos. */
|
|
|
|
EVAL_AVOID_SIDE_EFFECTS /* Don't modify any variables or
|
1999-04-16 03:35:26 +02:00
|
|
|
call any functions. The value
|
|
|
|
returned will have the correct
|
|
|
|
type, and will have an
|
|
|
|
approximately correct lvalue
|
|
|
|
type (inaccuracy: anything that is
|
|
|
|
listed as being in a register in
|
|
|
|
the function in which it was
|
|
|
|
declared will be lval_register). */
|
1999-07-07 22:19:36 +02:00
|
|
|
};
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
extern struct value *evaluate_subexp_standard
|
2000-05-28 03:12:42 +02:00
|
|
|
(struct type *, struct expression *, int *, enum noside);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
|
|
|
/* From expprint.c */
|
|
|
|
|
2000-02-02 01:21:19 +01:00
|
|
|
extern void print_expression (struct expression *, struct ui_file *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2012-03-21 16:16:24 +01:00
|
|
|
extern char *op_name (struct expression *exp, enum exp_opcode opcode);
|
|
|
|
|
2000-05-28 03:12:42 +02:00
|
|
|
extern char *op_string (enum exp_opcode);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
2011-01-05 23:22:53 +01:00
|
|
|
extern void dump_raw_expression (struct expression *,
|
|
|
|
struct ui_file *, char *);
|
2003-09-24 10:29:42 +02:00
|
|
|
extern void dump_prefix_expression (struct expression *, struct ui_file *);
|
1999-04-16 03:35:26 +02:00
|
|
|
|
1999-07-07 22:19:36 +02:00
|
|
|
#endif /* !defined (EXPRESSION_H) */
|