119370Spst/* Definitions for values of C expressions, for GDB.
2130803Smarcel
398944Sobrien   Copyright 1986, 1987, 1988, 1989, 1990, 1991, 1992, 1993, 1994,
4130803Smarcel   1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
546283Sdfr   Free Software Foundation, Inc.
619370Spst
798944Sobrien   This file is part of GDB.
819370Spst
998944Sobrien   This program is free software; you can redistribute it and/or modify
1098944Sobrien   it under the terms of the GNU General Public License as published by
1198944Sobrien   the Free Software Foundation; either version 2 of the License, or
1298944Sobrien   (at your option) any later version.
1319370Spst
1498944Sobrien   This program is distributed in the hope that it will be useful,
1598944Sobrien   but WITHOUT ANY WARRANTY; without even the implied warranty of
1698944Sobrien   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
1798944Sobrien   GNU General Public License for more details.
1819370Spst
1998944Sobrien   You should have received a copy of the GNU General Public License
2098944Sobrien   along with this program; if not, write to the Free Software
2198944Sobrien   Foundation, Inc., 59 Temple Place - Suite 330,
2298944Sobrien   Boston, MA 02111-1307, USA.  */
2319370Spst
2419370Spst#if !defined (VALUE_H)
2519370Spst#define VALUE_H 1
2619370Spst
2798944Sobrien#include "doublest.h"
28130803Smarcel#include "frame.h"		/* For struct frame_id.  */
2998944Sobrien
30130803Smarcelstruct block;
31130803Smarcelstruct expression;
32130803Smarcelstruct regcache;
33130803Smarcelstruct symbol;
34130803Smarcelstruct type;
35130803Smarcelstruct ui_file;
3619370Spst
37130803Smarcel/* The structure which defines the type of a value.  It should never
38130803Smarcel   be possible for a program lval value to survive over a call to the
39130803Smarcel   inferior (i.e. to be put into the history list or an internal
40130803Smarcel   variable).  */
41130803Smarcel
4219370Spststruct value
43130803Smarcel{
44130803Smarcel  /* Type of value; either not an lval, or one of the various
45130803Smarcel     different possible kinds of lval.  */
46130803Smarcel  enum lval_type lval;
47130803Smarcel
48130803Smarcel  /* Is it modifiable?  Only relevant if lval != not_lval.  */
49130803Smarcel  int modifiable;
50130803Smarcel
51130803Smarcel  /* Location of value (if lval).  */
52130803Smarcel  union
5319370Spst  {
54130803Smarcel    /* If lval == lval_memory, this is the address in the inferior.
55130803Smarcel       If lval == lval_register, this is the byte offset into the
56130803Smarcel       registers structure.  */
57130803Smarcel    CORE_ADDR address;
58130803Smarcel
59130803Smarcel    /* Pointer to internal variable.  */
60130803Smarcel    struct internalvar *internalvar;
61130803Smarcel
62130803Smarcel    /* Number of register.  Only used with lval_reg_frame_relative.  */
63130803Smarcel    int regnum;
64130803Smarcel  } location;
65130803Smarcel
66130803Smarcel  /* Describes offset of a value within lval of a structure in bytes.
67130803Smarcel     If lval == lval_memory, this is an offset to the address.
68130803Smarcel     If lval == lval_register, this is a further offset from
69130803Smarcel     location.address within the registers structure.
70130803Smarcel     Note also the member embedded_offset below.  */
71130803Smarcel  int offset;
72130803Smarcel
73130803Smarcel  /* Only used for bitfields; number of bits contained in them.  */
74130803Smarcel  int bitsize;
75130803Smarcel
76130803Smarcel  /* Only used for bitfields; position of start of field.
77130803Smarcel     For BITS_BIG_ENDIAN=0 targets, it is the position of the LSB.
78130803Smarcel     For BITS_BIG_ENDIAN=1 targets, it is the position of the MSB. */
7919370Spst    int bitpos;
8098944Sobrien
81130803Smarcel  /* Frame value is relative to.  In practice, this ID is only used if
82130803Smarcel     the value is stored in several registers in other than the
83130803Smarcel     current frame, and these registers have not all been saved at the
84130803Smarcel     same place in memory.  This will be described in the lval enum
85130803Smarcel     above as "lval_reg_frame_relative".  */
86130803Smarcel  struct frame_id frame_id;
8746283Sdfr
88130803Smarcel  /* Type of the value.  */
89130803Smarcel  struct type *type;
9098944Sobrien
91130803Smarcel  /* If a value represents a C++ object, then the `type' field gives
92130803Smarcel     the object's compile-time type.  If the object actually belongs
93130803Smarcel     to some class derived from `type', perhaps with other base
94130803Smarcel     classes and additional members, then `type' is just a subobject
95130803Smarcel     of the real thing, and the full object is probably larger than
96130803Smarcel     `type' would suggest.
9798944Sobrien
98130803Smarcel     If `type' is a dynamic class (i.e. one with a vtable), then GDB
99130803Smarcel     can actually determine the object's run-time type by looking at
100130803Smarcel     the run-time type information in the vtable.  When this
101130803Smarcel     information is available, we may elect to read in the entire
102130803Smarcel     object, for several reasons:
10398944Sobrien
104130803Smarcel     - When printing the value, the user would probably rather see the
105130803Smarcel       full object, not just the limited portion apparent from the
106130803Smarcel       compile-time type.
10798944Sobrien
108130803Smarcel     - If `type' has virtual base classes, then even printing `type'
109130803Smarcel       alone may require reaching outside the `type' portion of the
110130803Smarcel       object to wherever the virtual base class has been stored.
11198944Sobrien
112130803Smarcel     When we store the entire object, `enclosing_type' is the run-time
113130803Smarcel     type -- the complete object -- and `embedded_offset' is the
114130803Smarcel     offset of `type' within that larger type, in bytes.  The
115130803Smarcel     VALUE_CONTENTS macro takes `embedded_offset' into account, so
116130803Smarcel     most GDB code continues to see the `type' portion of the value,
117130803Smarcel     just as the inferior would.
11898944Sobrien
119130803Smarcel     If `type' is a pointer to an object, then `enclosing_type' is a
120130803Smarcel     pointer to the object's run-time type, and `pointed_to_offset' is
121130803Smarcel     the offset in bytes from the full object to the pointed-to object
122130803Smarcel     -- that is, the value `embedded_offset' would have if we
123130803Smarcel     followed the pointer and fetched the complete object.  (I don't
124130803Smarcel     really see the point.  Why not just determine the run-time type
125130803Smarcel     when you indirect, and avoid the special case?  The contents
126130803Smarcel     don't matter until you indirect anyway.)
127130803Smarcel
128130803Smarcel     If we're not doing anything fancy, `enclosing_type' is equal to
129130803Smarcel     `type', and `embedded_offset' is zero, so everything works
130130803Smarcel     normally.  */
13146283Sdfr    struct type *enclosing_type;
13298944Sobrien    int embedded_offset;
13398944Sobrien    int pointed_to_offset;
13498944Sobrien
13519370Spst    /* Values are stored in a chain, so that they can be deleted
13619370Spst       easily over calls to the inferior.  Values assigned to internal
13719370Spst       variables or put into the value history are taken off this
13819370Spst       list.  */
13919370Spst    struct value *next;
14019370Spst
141130803Smarcel    /* Register number if the value is from a register.  */
14219370Spst    short regno;
14398944Sobrien
144130803Smarcel    /* If zero, contents of this value are in the contents field.  If
145130803Smarcel       nonzero, contents are in inferior memory at address in the
146130803Smarcel       location.address field plus the offset field (and the lval
147130803Smarcel       field should be lval_memory).
148130803Smarcel
14998944Sobrien       WARNING: This field is used by the code which handles
15098944Sobrien       watchpoints (see breakpoint.c) to decide whether a particular
15198944Sobrien       value can be watched by hardware watchpoints.  If the lazy flag
15298944Sobrien       is set for some member of a value chain, it is assumed that
15398944Sobrien       this member of the chain doesn't need to be watched as part of
15498944Sobrien       watching the value itself.  This is how GDB avoids watching the
15598944Sobrien       entire struct or array when the user wants to watch a single
15698944Sobrien       struct member or array element.  If you ever change the way
15798944Sobrien       lazy flag is set and reset, be sure to consider this use as
15898944Sobrien       well!  */
15919370Spst    char lazy;
160130803Smarcel
16119370Spst    /* If nonzero, this is the value of a variable which does not
16219370Spst       actually exist in the program.  */
16319370Spst    char optimized_out;
164130803Smarcel
16546283Sdfr    /* The BFD section associated with this value.  */
16646283Sdfr    asection *bfd_section;
167130803Smarcel
16819370Spst    /* Actual contents of the value.  For use of this value; setting
16919370Spst       it uses the stuff above.  Not valid if lazy is nonzero.
17019370Spst       Target byte-order.  We force it to be aligned properly for any
17146283Sdfr       possible value.  Note that a value therefore extends beyond
17246283Sdfr       what is declared here.  */
17398944Sobrien    union
174130803Smarcel    {
175130803Smarcel      long contents[1];
176130803Smarcel      DOUBLEST force_doublest_align;
177130803Smarcel      LONGEST force_longest_align;
178130803Smarcel      CORE_ADDR force_core_addr_align;
179130803Smarcel      void *force_pointer_align;
180130803Smarcel    } aligner;
181130803Smarcel    /* Do not add any new members here -- contents above will trash them.  */
182130803Smarcel};
18319370Spst
18419370Spst#define VALUE_TYPE(val) (val)->type
18546283Sdfr#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
18619370Spst#define VALUE_LAZY(val) (val)->lazy
187130803Smarcel
18819370Spst/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of
189130803Smarcel   the gdb buffer used to hold a copy of the contents of the lval.
190130803Smarcel   VALUE_CONTENTS is used when the contents of the buffer are needed
191130803Smarcel   -- it uses value_fetch_lazy() to load the buffer from the process
192130803Smarcel   being debugged if it hasn't already been loaded.
193130803Smarcel   VALUE_CONTENTS_RAW is used when data is being stored into the
194130803Smarcel   buffer, or when it is certain that the contents of the buffer are
195130803Smarcel   valid.
196130803Smarcel
19746283Sdfr   Note: The contents pointer is adjusted by the offset required to
19846283Sdfr   get to the real subobject, if the value happens to represent
199130803Smarcel   something embedded in a larger run-time object.  */
20046283Sdfr
201130803Smarcel#define VALUE_CONTENTS_RAW(val) \
202130803Smarcel ((char *) (val)->aligner.contents + (val)->embedded_offset)
203130803Smarcel#define VALUE_CONTENTS(val) \
204130803Smarcel ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), VALUE_CONTENTS_RAW(val))
20546283Sdfr
20646283Sdfr/* The ALL variants of the above two macros do not adjust the returned
207130803Smarcel   pointer by the embedded_offset value.  */
20898944Sobrien
20946283Sdfr#define VALUE_CONTENTS_ALL_RAW(val) ((char *) (val)->aligner.contents)
210130803Smarcel#define VALUE_CONTENTS_ALL(val) \
211130803Smarcel  ((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \
212130803Smarcel   VALUE_CONTENTS_ALL_RAW(val))
21319370Spst
21498944Sobrienextern int value_fetch_lazy (struct value *val);
21598944Sobrien
21619370Spst#define VALUE_LVAL(val) (val)->lval
21719370Spst#define VALUE_ADDRESS(val) (val)->location.address
21819370Spst#define VALUE_INTERNALVAR(val) (val)->location.internalvar
21919370Spst#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)
220130803Smarcel#define VALUE_FRAME_ID(val) ((val)->frame_id)
22119370Spst#define VALUE_OFFSET(val) (val)->offset
22219370Spst#define VALUE_BITSIZE(val) (val)->bitsize
22319370Spst#define VALUE_BITPOS(val) (val)->bitpos
22419370Spst#define VALUE_NEXT(val) (val)->next
22519370Spst#define VALUE_REGNO(val) (val)->regno
22619370Spst#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
22746283Sdfr#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
22846283Sdfr#define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
22946283Sdfr#define VALUE_BFD_SECTION(val) ((val)->bfd_section)
23019370Spst
231130803Smarcel/* Convert a REF to the object referenced.  */
23219370Spst
233130803Smarcel#define COERCE_REF(arg) \
234130803Smarcel  do {									\
235130803Smarcel    struct type *value_type_arg_tmp = check_typedef (VALUE_TYPE (arg));	\
236130803Smarcel    if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)		\
237130803Smarcel      arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),	\
238130803Smarcel                           unpack_pointer (VALUE_TYPE (arg),		\
239130803Smarcel                                           VALUE_CONTENTS (arg)),	\
240130803Smarcel			                   VALUE_BFD_SECTION (arg));	\
241130803Smarcel  } while (0)
24219370Spst
24319370Spst/* If ARG is an array, convert it to a pointer.
24419370Spst   If ARG is an enum, convert it to an integer.
24519370Spst   If ARG is a function, convert it to a function pointer.
24619370Spst
24719370Spst   References are dereferenced.  */
24819370Spst
249130803Smarcel#define COERCE_ARRAY(arg) \
250130803Smarcel  do {									\
251130803Smarcel    COERCE_REF(arg);							\
252130803Smarcel    if (current_language->c_style_arrays				\
253130803Smarcel        && TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)		\
254130803Smarcel      arg = value_coerce_array (arg);					\
255130803Smarcel    if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC)			\
256130803Smarcel      arg = value_coerce_function (arg);				\
257130803Smarcel  } while (0)
25819370Spst
259130803Smarcel#define COERCE_NUMBER(arg) \
260130803Smarcel  do { COERCE_ARRAY(arg); COERCE_ENUM(arg); } while (0)
26119370Spst
262130803Smarcel/* NOTE: cagney/2002-12-17: This macro was handling a chill language
263130803Smarcel   problem but that language has gone away.  */
264130803Smarcel#define COERCE_VARYING_ARRAY(arg, real_arg_type)
26519370Spst
26619370Spst/* If ARG is an enum, convert it to an integer.  */
26719370Spst
268130803Smarcel#define COERCE_ENUM(arg) \
269130803Smarcel  do {									\
270130803Smarcel    if (TYPE_CODE (check_typedef (VALUE_TYPE (arg))) == TYPE_CODE_ENUM)	\
271130803Smarcel      arg = value_cast (builtin_type_unsigned_int, arg);		\
272130803Smarcel  } while (0)
27319370Spst
27419370Spst/* Internal variables (variables for convenience of use of debugger)
27519370Spst   are recorded as a chain of these structures.  */
27619370Spst
27719370Spststruct internalvar
278130803Smarcel{
279130803Smarcel  struct internalvar *next;
280130803Smarcel  char *name;
281130803Smarcel  struct value *value;
282130803Smarcel};
28319370Spst
284130803Smarcel/* Pointer to member function.  Depends on compiler implementation.  */
28519370Spst
28619370Spst#define METHOD_PTR_IS_VIRTUAL(ADDR)  ((ADDR) & 0x80000000)
28719370Spst#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))
28819370Spst#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))
28998944Sobrien
29019370Spst
29119370Spst#include "symtab.h"
29219370Spst#include "gdbtypes.h"
29319370Spst#include "expression.h"
29419370Spst
29519370Spststruct frame_info;
29619370Spststruct fn_field;
29719370Spst
29898944Sobrienextern void print_address_demangle (CORE_ADDR, struct ui_file *, int);
29919370Spst
30098944Sobrienextern LONGEST value_as_long (struct value *val);
30198944Sobrienextern DOUBLEST value_as_double (struct value *val);
30298944Sobrienextern CORE_ADDR value_as_address (struct value *val);
30319370Spst
304130803Smarcelextern LONGEST unpack_long (struct type *type, const char *valaddr);
305130803Smarcelextern DOUBLEST unpack_double (struct type *type, const char *valaddr,
306130803Smarcel			       int *invp);
307130803Smarcelextern CORE_ADDR unpack_pointer (struct type *type, const char *valaddr);
308130803Smarcelextern LONGEST unpack_field_as_long (struct type *type, const char *valaddr,
30998944Sobrien				     int fieldno);
31019370Spst
31198944Sobrienextern struct value *value_from_longest (struct type *type, LONGEST num);
31298944Sobrienextern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
31398944Sobrienextern struct value *value_from_double (struct type *type, DOUBLEST num);
31498944Sobrienextern struct value *value_from_string (char *string);
31519370Spst
31698944Sobrienextern struct value *value_at (struct type *type, CORE_ADDR addr,
31798944Sobrien			       asection * sect);
31898944Sobrienextern struct value *value_at_lazy (struct type *type, CORE_ADDR addr,
31998944Sobrien				    asection * sect);
32019370Spst
32198944Sobrienextern struct value *value_from_register (struct type *type, int regnum,
32298944Sobrien					  struct frame_info *frame);
32319370Spst
32498944Sobrienextern struct value *value_of_variable (struct symbol *var, struct block *b);
32519370Spst
326130803Smarcelextern struct value *value_of_register (int regnum,
327130803Smarcel					struct frame_info *frame);
32819370Spst
32998944Sobrienextern int symbol_read_needs_frame (struct symbol *);
33019370Spst
33198944Sobrienextern struct value *read_var_value (struct symbol *var,
33298944Sobrien				     struct frame_info *frame);
33319370Spst
33498944Sobrienextern struct value *locate_var_value (struct symbol *var,
33598944Sobrien				       struct frame_info *frame);
33619370Spst
33798944Sobrienextern struct value *allocate_value (struct type *type);
33819370Spst
33998944Sobrienextern struct value *allocate_repeat_value (struct type *type, int count);
34019370Spst
34198944Sobrienextern struct value *value_change_enclosing_type (struct value *val,
34298944Sobrien						  struct type *new_type);
34319370Spst
34498944Sobrienextern struct value *value_mark (void);
34519370Spst
34698944Sobrienextern void value_free_to_mark (struct value *mark);
34719370Spst
34898944Sobrienextern struct value *value_string (char *ptr, int len);
34998944Sobrienextern struct value *value_bitstring (char *ptr, int len);
35019370Spst
35198944Sobrienextern struct value *value_array (int lowbound, int highbound,
35298944Sobrien				  struct value ** elemvec);
35319370Spst
35498944Sobrienextern struct value *value_concat (struct value *arg1, struct value *arg2);
35519370Spst
35698944Sobrienextern struct value *value_binop (struct value *arg1, struct value *arg2,
35798944Sobrien				  enum exp_opcode op);
35819370Spst
35998944Sobrienextern struct value *value_add (struct value *arg1, struct value *arg2);
36019370Spst
36198944Sobrienextern struct value *value_sub (struct value *arg1, struct value *arg2);
36219370Spst
36398944Sobrienextern struct value *value_coerce_array (struct value *arg1);
36419370Spst
36598944Sobrienextern struct value *value_coerce_function (struct value *arg1);
36619370Spst
36798944Sobrienextern struct value *value_ind (struct value *arg1);
36819370Spst
36998944Sobrienextern struct value *value_addr (struct value *arg1);
37019370Spst
37198944Sobrienextern struct value *value_assign (struct value *toval, struct value *fromval);
37219370Spst
37398944Sobrienextern struct value *value_neg (struct value *arg1);
37419370Spst
37598944Sobrienextern struct value *value_complement (struct value *arg1);
37646283Sdfr
37798944Sobrienextern struct value *value_struct_elt (struct value **argp,
37898944Sobrien				       struct value **args,
37998944Sobrien				       char *name, int *static_memfuncp,
38098944Sobrien				       char *err);
38146283Sdfr
382130803Smarcelextern struct value *value_aggregate_elt (struct type *curtype,
383130803Smarcel					  char *name,
384130803Smarcel					  enum noside noside);
38519370Spst
38698944Sobrienextern struct value *value_static_field (struct type *type, int fieldno);
38719370Spst
38898944Sobrienextern struct fn_field *value_find_oload_method_list (struct value **, char *,
389130803Smarcel						      int, int *,
39098944Sobrien						      struct type **, int *);
39146283Sdfr
39298944Sobrienextern int find_overload_match (struct type **arg_types, int nargs,
39398944Sobrien				char *name, int method, int lax,
39498944Sobrien				struct value **objp, struct symbol *fsym,
39598944Sobrien				struct value **valp, struct symbol **symp,
39698944Sobrien				int *staticp);
39746283Sdfr
39898944Sobrienextern struct value *value_field (struct value *arg1, int fieldno);
39946283Sdfr
40098944Sobrienextern struct value *value_primitive_field (struct value *arg1, int offset,
40198944Sobrien					    int fieldno,
40298944Sobrien					    struct type *arg_type);
40319370Spst
40419370Spst
40598944Sobrienextern struct type *value_rtti_target_type (struct value *, int *, int *,
40698944Sobrien					    int *);
40719370Spst
40898944Sobrienextern struct value *value_full_object (struct value *, struct type *, int,
40998944Sobrien					int, int);
41019370Spst
41198944Sobrienextern struct value *value_cast (struct type *type, struct value *arg2);
41219370Spst
41398944Sobrienextern struct value *value_zero (struct type *type, enum lval_type lv);
41419370Spst
41598944Sobrienextern struct value *value_repeat (struct value *arg1, int count);
41619370Spst
41798944Sobrienextern struct value *value_subscript (struct value *array, struct value *idx);
41819370Spst
419130803Smarcelextern struct value *register_value_being_returned (struct type *valtype,
420130803Smarcel						    struct regcache *retbuf);
42119370Spst
42298944Sobrienextern struct value *value_in (struct value *element, struct value *set);
42319370Spst
42498944Sobrienextern int value_bit_index (struct type *type, char *addr, int index);
42519370Spst
426130803Smarcelextern int using_struct_return (struct type *value_type, int gcc_p);
42719370Spst
42898944Sobrienextern struct value *evaluate_expression (struct expression *exp);
42919370Spst
43098944Sobrienextern struct value *evaluate_type (struct expression *exp);
43119370Spst
43298944Sobrienextern struct value *evaluate_subexp_with_coercion (struct expression *,
43398944Sobrien						    int *, enum noside);
43419370Spst
43598944Sobrienextern struct value *parse_and_eval (char *exp);
43619370Spst
43798944Sobrienextern struct value *parse_to_comma_and_eval (char **expp);
43819370Spst
43998944Sobrienextern struct type *parse_and_eval_type (char *p, int length);
44019370Spst
44198944Sobrienextern CORE_ADDR parse_and_eval_address (char *exp);
44219370Spst
44398944Sobrienextern CORE_ADDR parse_and_eval_address_1 (char **expptr);
44419370Spst
44598944Sobrienextern LONGEST parse_and_eval_long (char *exp);
44619370Spst
44798944Sobrienextern struct value *access_value_history (int num);
44819370Spst
44998944Sobrienextern struct value *value_of_internalvar (struct internalvar *var);
45019370Spst
45198944Sobrienextern void set_internalvar (struct internalvar *var, struct value *val);
45219370Spst
45398944Sobrienextern void set_internalvar_component (struct internalvar *var,
45498944Sobrien				       int offset,
45598944Sobrien				       int bitpos, int bitsize,
45698944Sobrien				       struct value *newvalue);
45719370Spst
45898944Sobrienextern struct internalvar *lookup_internalvar (char *name);
45919370Spst
46098944Sobrienextern int value_equal (struct value *arg1, struct value *arg2);
46119370Spst
46298944Sobrienextern int value_less (struct value *arg1, struct value *arg2);
46319370Spst
46498944Sobrienextern int value_logical_not (struct value *arg1);
46519370Spst
46698944Sobrien/* C++ */
46719370Spst
46898944Sobrienextern struct value *value_of_this (int complain);
46919370Spst
47098944Sobrienextern struct value *value_x_binop (struct value *arg1, struct value *arg2,
47198944Sobrien				    enum exp_opcode op,
47298944Sobrien				    enum exp_opcode otherop,
47398944Sobrien				    enum noside noside);
47419370Spst
47598944Sobrienextern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
47698944Sobrien				   enum noside noside);
47719370Spst
47898944Sobrienextern struct value *value_fn_field (struct value ** arg1p, struct fn_field *f,
47998944Sobrien				     int j, struct type *type, int offset);
48019370Spst
48198944Sobrienextern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
48298944Sobrien				 struct value *arg2);
48319370Spst
48498944Sobrienextern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
48519370Spst
48698944Sobrienextern int destructor_name_p (const char *name, const struct type *type);
48719370Spst
48898944Sobrien#define value_free(val) xfree (val)
48919370Spst
49098944Sobrienextern void free_all_values (void);
49119370Spst
49298944Sobrienextern void release_value (struct value *val);
49319370Spst
49498944Sobrienextern int record_latest_value (struct value *val);
49519370Spst
496130803Smarcelextern void modify_field (char *addr, LONGEST fieldval, int bitpos,
497130803Smarcel			  int bitsize);
49819370Spst
49998944Sobrienextern void type_print (struct type * type, char *varstring,
50098944Sobrien			struct ui_file * stream, int show);
50146283Sdfr
50298944Sobrienextern char *baseclass_addr (struct type *type, int index, char *valaddr,
50398944Sobrien			     struct value **valuep, int *errp);
50419370Spst
50598944Sobrienextern void print_longest (struct ui_file * stream, int format,
50698944Sobrien			   int use_local, LONGEST val);
50719370Spst
50898944Sobrienextern void print_floating (char *valaddr, struct type * type,
50998944Sobrien			    struct ui_file * stream);
51019370Spst
51198944Sobrienextern int value_print (struct value *val, struct ui_file *stream, int format,
51298944Sobrien			enum val_prettyprint pretty);
51319370Spst
51498944Sobrienextern void value_print_array_elements (struct value *val,
51598944Sobrien					struct ui_file *stream, int format,
51698944Sobrien					enum val_prettyprint pretty);
51719370Spst
51898944Sobrienextern struct value *value_release_to_mark (struct value *mark);
51919370Spst
52098944Sobrienextern int val_print (struct type * type, char *valaddr,
52198944Sobrien		      int embedded_offset, CORE_ADDR address,
52298944Sobrien		      struct ui_file * stream, int format,
52398944Sobrien		      int deref_ref, int recurse,
52498944Sobrien		      enum val_prettyprint pretty);
52519370Spst
526242936Semasteextern int common_val_print (struct value *val,
527242936Semaste			     struct ui_file *stream, int format,
528242936Semaste			     int deref_ref, int recurse,
529242936Semaste			     enum val_prettyprint pretty);
530242936Semaste
53198944Sobrienextern int val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream);
53219370Spst
53398944Sobrienextern void print_variable_value (struct symbol * var,
53498944Sobrien				  struct frame_info * frame,
53598944Sobrien				  struct ui_file *stream);
53619370Spst
53798944Sobrienextern int check_field (struct value *, const char *);
53819370Spst
53998944Sobrienextern void typedef_print (struct type * type, struct symbol * news,
54098944Sobrien			     struct ui_file * stream);
54119370Spst
54298944Sobrienextern char *internalvar_name (struct internalvar *var);
54319370Spst
54498944Sobrienextern void clear_value_history (void);
54519370Spst
54698944Sobrienextern void clear_internalvars (void);
54719370Spst
54898944Sobrien/* From values.c */
54919370Spst
55098944Sobrienextern struct value *value_copy (struct value *);
55119370Spst
55298944Sobrien/* From valops.c */
55319370Spst
55498944Sobrienextern struct value *varying_to_slice (struct value *);
55519370Spst
55698944Sobrienextern struct value *value_slice (struct value *, int, int);
55719370Spst
55898944Sobrienextern struct value *value_literal_complex (struct value *, struct value *,
55998944Sobrien					    struct type *);
56019370Spst
56198944Sobrienextern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
56298944Sobrien				  int *, int *);
56319370Spst
564130803Smarcelextern struct value *find_function_in_inferior (const char *);
56519370Spst
56698944Sobrienextern struct value *value_allocate_space_in_inferior (int);
56719370Spst
568130803Smarcelextern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args,
569130803Smarcel					CORE_ADDR sp, int struct_return,
570130803Smarcel					CORE_ADDR struct_addr);
57146283Sdfr
572130803Smarcelextern struct value *value_of_local (const char *name, int complain);
573130803Smarcel
57498944Sobrien#endif /* !defined (VALUE_H) */
575