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
168283029Ssbruno    /* If value is a variable, is it initialized or not.  */
169283029Ssbruno    int initialized;
170283029Ssbruno
17119370Spst    /* Actual contents of the value.  For use of this value; setting
17219370Spst       it uses the stuff above.  Not valid if lazy is nonzero.
17319370Spst       Target byte-order.  We force it to be aligned properly for any
17446283Sdfr       possible value.  Note that a value therefore extends beyond
17546283Sdfr       what is declared here.  */
17698944Sobrien    union
177130803Smarcel    {
178130803Smarcel      long contents[1];
179130803Smarcel      DOUBLEST force_doublest_align;
180130803Smarcel      LONGEST force_longest_align;
181130803Smarcel      CORE_ADDR force_core_addr_align;
182130803Smarcel      void *force_pointer_align;
183130803Smarcel    } aligner;
184130803Smarcel    /* Do not add any new members here -- contents above will trash them.  */
185130803Smarcel};
18619370Spst
18719370Spst#define VALUE_TYPE(val) (val)->type
18846283Sdfr#define VALUE_ENCLOSING_TYPE(val) (val)->enclosing_type
18919370Spst#define VALUE_LAZY(val) (val)->lazy
190130803Smarcel
19119370Spst/* VALUE_CONTENTS and VALUE_CONTENTS_RAW both return the address of
192130803Smarcel   the gdb buffer used to hold a copy of the contents of the lval.
193130803Smarcel   VALUE_CONTENTS is used when the contents of the buffer are needed
194130803Smarcel   -- it uses value_fetch_lazy() to load the buffer from the process
195130803Smarcel   being debugged if it hasn't already been loaded.
196130803Smarcel   VALUE_CONTENTS_RAW is used when data is being stored into the
197130803Smarcel   buffer, or when it is certain that the contents of the buffer are
198130803Smarcel   valid.
199130803Smarcel
20046283Sdfr   Note: The contents pointer is adjusted by the offset required to
20146283Sdfr   get to the real subobject, if the value happens to represent
202130803Smarcel   something embedded in a larger run-time object.  */
20346283Sdfr
204130803Smarcel#define VALUE_CONTENTS_RAW(val) \
205130803Smarcel ((char *) (val)->aligner.contents + (val)->embedded_offset)
206130803Smarcel#define VALUE_CONTENTS(val) \
207130803Smarcel ((void)(VALUE_LAZY(val) && value_fetch_lazy(val)), VALUE_CONTENTS_RAW(val))
20846283Sdfr
20946283Sdfr/* The ALL variants of the above two macros do not adjust the returned
210130803Smarcel   pointer by the embedded_offset value.  */
21198944Sobrien
21246283Sdfr#define VALUE_CONTENTS_ALL_RAW(val) ((char *) (val)->aligner.contents)
213130803Smarcel#define VALUE_CONTENTS_ALL(val) \
214130803Smarcel  ((void) (VALUE_LAZY(val) && value_fetch_lazy(val)), \
215130803Smarcel   VALUE_CONTENTS_ALL_RAW(val))
21619370Spst
21798944Sobrienextern int value_fetch_lazy (struct value *val);
21898944Sobrien
21919370Spst#define VALUE_LVAL(val) (val)->lval
22019370Spst#define VALUE_ADDRESS(val) (val)->location.address
22119370Spst#define VALUE_INTERNALVAR(val) (val)->location.internalvar
22219370Spst#define VALUE_FRAME_REGNUM(val) ((val)->location.regnum)
223130803Smarcel#define VALUE_FRAME_ID(val) ((val)->frame_id)
22419370Spst#define VALUE_OFFSET(val) (val)->offset
22519370Spst#define VALUE_BITSIZE(val) (val)->bitsize
22619370Spst#define VALUE_BITPOS(val) (val)->bitpos
22719370Spst#define VALUE_NEXT(val) (val)->next
22819370Spst#define VALUE_REGNO(val) (val)->regno
22919370Spst#define VALUE_OPTIMIZED_OUT(val) ((val)->optimized_out)
23046283Sdfr#define VALUE_EMBEDDED_OFFSET(val) ((val)->embedded_offset)
23146283Sdfr#define VALUE_POINTED_TO_OFFSET(val) ((val)->pointed_to_offset)
23246283Sdfr#define VALUE_BFD_SECTION(val) ((val)->bfd_section)
23319370Spst
234130803Smarcel/* Convert a REF to the object referenced.  */
23519370Spst
236130803Smarcel#define COERCE_REF(arg) \
237130803Smarcel  do {									\
238130803Smarcel    struct type *value_type_arg_tmp = check_typedef (VALUE_TYPE (arg));	\
239130803Smarcel    if (TYPE_CODE (value_type_arg_tmp) == TYPE_CODE_REF)		\
240130803Smarcel      arg = value_at_lazy (TYPE_TARGET_TYPE (value_type_arg_tmp),	\
241130803Smarcel                           unpack_pointer (VALUE_TYPE (arg),		\
242130803Smarcel                                           VALUE_CONTENTS (arg)),	\
243130803Smarcel			                   VALUE_BFD_SECTION (arg));	\
244130803Smarcel  } while (0)
24519370Spst
24619370Spst/* If ARG is an array, convert it to a pointer.
24719370Spst   If ARG is an enum, convert it to an integer.
24819370Spst   If ARG is a function, convert it to a function pointer.
24919370Spst
25019370Spst   References are dereferenced.  */
25119370Spst
252130803Smarcel#define COERCE_ARRAY(arg) \
253130803Smarcel  do {									\
254130803Smarcel    COERCE_REF(arg);							\
255130803Smarcel    if (current_language->c_style_arrays				\
256130803Smarcel        && TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_ARRAY)		\
257130803Smarcel      arg = value_coerce_array (arg);					\
258130803Smarcel    if (TYPE_CODE (VALUE_TYPE (arg)) == TYPE_CODE_FUNC)			\
259130803Smarcel      arg = value_coerce_function (arg);				\
260130803Smarcel  } while (0)
26119370Spst
262130803Smarcel#define COERCE_NUMBER(arg) \
263130803Smarcel  do { COERCE_ARRAY(arg); COERCE_ENUM(arg); } while (0)
26419370Spst
265130803Smarcel/* NOTE: cagney/2002-12-17: This macro was handling a chill language
266130803Smarcel   problem but that language has gone away.  */
267130803Smarcel#define COERCE_VARYING_ARRAY(arg, real_arg_type)
26819370Spst
26919370Spst/* If ARG is an enum, convert it to an integer.  */
27019370Spst
271130803Smarcel#define COERCE_ENUM(arg) \
272130803Smarcel  do {									\
273130803Smarcel    if (TYPE_CODE (check_typedef (VALUE_TYPE (arg))) == TYPE_CODE_ENUM)	\
274130803Smarcel      arg = value_cast (builtin_type_unsigned_int, arg);		\
275130803Smarcel  } while (0)
27619370Spst
27719370Spst/* Internal variables (variables for convenience of use of debugger)
27819370Spst   are recorded as a chain of these structures.  */
27919370Spst
28019370Spststruct internalvar
281130803Smarcel{
282130803Smarcel  struct internalvar *next;
283130803Smarcel  char *name;
284130803Smarcel  struct value *value;
285130803Smarcel};
28619370Spst
287130803Smarcel/* Pointer to member function.  Depends on compiler implementation.  */
28819370Spst
28919370Spst#define METHOD_PTR_IS_VIRTUAL(ADDR)  ((ADDR) & 0x80000000)
29019370Spst#define METHOD_PTR_FROM_VOFFSET(OFFSET) (0x80000000 + (OFFSET))
29119370Spst#define METHOD_PTR_TO_VOFFSET(ADDR) (~0x80000000 & (ADDR))
29298944Sobrien
29319370Spst
29419370Spst#include "symtab.h"
29519370Spst#include "gdbtypes.h"
29619370Spst#include "expression.h"
29719370Spst
29819370Spststruct frame_info;
29919370Spststruct fn_field;
30019370Spst
30198944Sobrienextern void print_address_demangle (CORE_ADDR, struct ui_file *, int);
30219370Spst
30398944Sobrienextern LONGEST value_as_long (struct value *val);
30498944Sobrienextern DOUBLEST value_as_double (struct value *val);
30598944Sobrienextern CORE_ADDR value_as_address (struct value *val);
30619370Spst
307130803Smarcelextern LONGEST unpack_long (struct type *type, const char *valaddr);
308130803Smarcelextern DOUBLEST unpack_double (struct type *type, const char *valaddr,
309130803Smarcel			       int *invp);
310130803Smarcelextern CORE_ADDR unpack_pointer (struct type *type, const char *valaddr);
311130803Smarcelextern LONGEST unpack_field_as_long (struct type *type, const char *valaddr,
31298944Sobrien				     int fieldno);
31319370Spst
31498944Sobrienextern struct value *value_from_longest (struct type *type, LONGEST num);
31598944Sobrienextern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
31698944Sobrienextern struct value *value_from_double (struct type *type, DOUBLEST num);
31798944Sobrienextern struct value *value_from_string (char *string);
31819370Spst
31998944Sobrienextern struct value *value_at (struct type *type, CORE_ADDR addr,
32098944Sobrien			       asection * sect);
32198944Sobrienextern struct value *value_at_lazy (struct type *type, CORE_ADDR addr,
32298944Sobrien				    asection * sect);
32319370Spst
32498944Sobrienextern struct value *value_from_register (struct type *type, int regnum,
32598944Sobrien					  struct frame_info *frame);
32619370Spst
32798944Sobrienextern struct value *value_of_variable (struct symbol *var, struct block *b);
32819370Spst
329130803Smarcelextern struct value *value_of_register (int regnum,
330130803Smarcel					struct frame_info *frame);
33119370Spst
33298944Sobrienextern int symbol_read_needs_frame (struct symbol *);
33319370Spst
33498944Sobrienextern struct value *read_var_value (struct symbol *var,
33598944Sobrien				     struct frame_info *frame);
33619370Spst
33798944Sobrienextern struct value *locate_var_value (struct symbol *var,
33898944Sobrien				       struct frame_info *frame);
33919370Spst
34098944Sobrienextern struct value *allocate_value (struct type *type);
34119370Spst
34298944Sobrienextern struct value *allocate_repeat_value (struct type *type, int count);
34319370Spst
34498944Sobrienextern struct value *value_change_enclosing_type (struct value *val,
34598944Sobrien						  struct type *new_type);
34619370Spst
34798944Sobrienextern struct value *value_mark (void);
34819370Spst
34998944Sobrienextern void value_free_to_mark (struct value *mark);
35019370Spst
35198944Sobrienextern struct value *value_string (char *ptr, int len);
35298944Sobrienextern struct value *value_bitstring (char *ptr, int len);
35319370Spst
35498944Sobrienextern struct value *value_array (int lowbound, int highbound,
35598944Sobrien				  struct value ** elemvec);
35619370Spst
35798944Sobrienextern struct value *value_concat (struct value *arg1, struct value *arg2);
35819370Spst
35998944Sobrienextern struct value *value_binop (struct value *arg1, struct value *arg2,
36098944Sobrien				  enum exp_opcode op);
36119370Spst
36298944Sobrienextern struct value *value_add (struct value *arg1, struct value *arg2);
36319370Spst
36498944Sobrienextern struct value *value_sub (struct value *arg1, struct value *arg2);
36519370Spst
36698944Sobrienextern struct value *value_coerce_array (struct value *arg1);
36719370Spst
36898944Sobrienextern struct value *value_coerce_function (struct value *arg1);
36919370Spst
37098944Sobrienextern struct value *value_ind (struct value *arg1);
37119370Spst
37298944Sobrienextern struct value *value_addr (struct value *arg1);
37319370Spst
37498944Sobrienextern struct value *value_assign (struct value *toval, struct value *fromval);
37519370Spst
37698944Sobrienextern struct value *value_neg (struct value *arg1);
37719370Spst
37898944Sobrienextern struct value *value_complement (struct value *arg1);
37946283Sdfr
38098944Sobrienextern struct value *value_struct_elt (struct value **argp,
38198944Sobrien				       struct value **args,
38298944Sobrien				       char *name, int *static_memfuncp,
38398944Sobrien				       char *err);
38446283Sdfr
385130803Smarcelextern struct value *value_aggregate_elt (struct type *curtype,
386130803Smarcel					  char *name,
387130803Smarcel					  enum noside noside);
38819370Spst
38998944Sobrienextern struct value *value_static_field (struct type *type, int fieldno);
39019370Spst
39198944Sobrienextern struct fn_field *value_find_oload_method_list (struct value **, char *,
392130803Smarcel						      int, int *,
39398944Sobrien						      struct type **, int *);
39446283Sdfr
39598944Sobrienextern int find_overload_match (struct type **arg_types, int nargs,
39698944Sobrien				char *name, int method, int lax,
39798944Sobrien				struct value **objp, struct symbol *fsym,
39898944Sobrien				struct value **valp, struct symbol **symp,
39998944Sobrien				int *staticp);
40046283Sdfr
40198944Sobrienextern struct value *value_field (struct value *arg1, int fieldno);
40246283Sdfr
40398944Sobrienextern struct value *value_primitive_field (struct value *arg1, int offset,
40498944Sobrien					    int fieldno,
40598944Sobrien					    struct type *arg_type);
40619370Spst
40719370Spst
40898944Sobrienextern struct type *value_rtti_target_type (struct value *, int *, int *,
40998944Sobrien					    int *);
41019370Spst
41198944Sobrienextern struct value *value_full_object (struct value *, struct type *, int,
41298944Sobrien					int, int);
41319370Spst
41498944Sobrienextern struct value *value_cast (struct type *type, struct value *arg2);
41519370Spst
41698944Sobrienextern struct value *value_zero (struct type *type, enum lval_type lv);
41719370Spst
41898944Sobrienextern struct value *value_repeat (struct value *arg1, int count);
41919370Spst
42098944Sobrienextern struct value *value_subscript (struct value *array, struct value *idx);
42119370Spst
422130803Smarcelextern struct value *register_value_being_returned (struct type *valtype,
423130803Smarcel						    struct regcache *retbuf);
42419370Spst
42598944Sobrienextern struct value *value_in (struct value *element, struct value *set);
42619370Spst
42798944Sobrienextern int value_bit_index (struct type *type, char *addr, int index);
42819370Spst
429130803Smarcelextern int using_struct_return (struct type *value_type, int gcc_p);
43019370Spst
43198944Sobrienextern struct value *evaluate_expression (struct expression *exp);
43219370Spst
43398944Sobrienextern struct value *evaluate_type (struct expression *exp);
43419370Spst
43598944Sobrienextern struct value *evaluate_subexp_with_coercion (struct expression *,
43698944Sobrien						    int *, enum noside);
43719370Spst
43898944Sobrienextern struct value *parse_and_eval (char *exp);
43919370Spst
44098944Sobrienextern struct value *parse_to_comma_and_eval (char **expp);
44119370Spst
44298944Sobrienextern struct type *parse_and_eval_type (char *p, int length);
44319370Spst
44498944Sobrienextern CORE_ADDR parse_and_eval_address (char *exp);
44519370Spst
44698944Sobrienextern CORE_ADDR parse_and_eval_address_1 (char **expptr);
44719370Spst
44898944Sobrienextern LONGEST parse_and_eval_long (char *exp);
44919370Spst
45098944Sobrienextern struct value *access_value_history (int num);
45119370Spst
45298944Sobrienextern struct value *value_of_internalvar (struct internalvar *var);
45319370Spst
45498944Sobrienextern void set_internalvar (struct internalvar *var, struct value *val);
45519370Spst
45698944Sobrienextern void set_internalvar_component (struct internalvar *var,
45798944Sobrien				       int offset,
45898944Sobrien				       int bitpos, int bitsize,
45998944Sobrien				       struct value *newvalue);
46019370Spst
46198944Sobrienextern struct internalvar *lookup_internalvar (char *name);
46219370Spst
46398944Sobrienextern int value_equal (struct value *arg1, struct value *arg2);
46419370Spst
46598944Sobrienextern int value_less (struct value *arg1, struct value *arg2);
46619370Spst
46798944Sobrienextern int value_logical_not (struct value *arg1);
46819370Spst
46998944Sobrien/* C++ */
47019370Spst
47198944Sobrienextern struct value *value_of_this (int complain);
47219370Spst
47398944Sobrienextern struct value *value_x_binop (struct value *arg1, struct value *arg2,
47498944Sobrien				    enum exp_opcode op,
47598944Sobrien				    enum exp_opcode otherop,
47698944Sobrien				    enum noside noside);
47719370Spst
47898944Sobrienextern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
47998944Sobrien				   enum noside noside);
48019370Spst
48198944Sobrienextern struct value *value_fn_field (struct value ** arg1p, struct fn_field *f,
48298944Sobrien				     int j, struct type *type, int offset);
48319370Spst
48498944Sobrienextern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
48598944Sobrien				 struct value *arg2);
48619370Spst
48798944Sobrienextern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
48819370Spst
48998944Sobrienextern int destructor_name_p (const char *name, const struct type *type);
49019370Spst
49198944Sobrien#define value_free(val) xfree (val)
49219370Spst
49398944Sobrienextern void free_all_values (void);
49419370Spst
49598944Sobrienextern void release_value (struct value *val);
49619370Spst
49798944Sobrienextern int record_latest_value (struct value *val);
49819370Spst
499130803Smarcelextern void modify_field (char *addr, LONGEST fieldval, int bitpos,
500130803Smarcel			  int bitsize);
50119370Spst
50298944Sobrienextern void type_print (struct type * type, char *varstring,
50398944Sobrien			struct ui_file * stream, int show);
50446283Sdfr
50598944Sobrienextern char *baseclass_addr (struct type *type, int index, char *valaddr,
50698944Sobrien			     struct value **valuep, int *errp);
50719370Spst
50898944Sobrienextern void print_longest (struct ui_file * stream, int format,
50998944Sobrien			   int use_local, LONGEST val);
51019370Spst
51198944Sobrienextern void print_floating (char *valaddr, struct type * type,
51298944Sobrien			    struct ui_file * stream);
51319370Spst
51498944Sobrienextern int value_print (struct value *val, struct ui_file *stream, int format,
51598944Sobrien			enum val_prettyprint pretty);
51619370Spst
51798944Sobrienextern void value_print_array_elements (struct value *val,
51898944Sobrien					struct ui_file *stream, int format,
51998944Sobrien					enum val_prettyprint pretty);
52019370Spst
52198944Sobrienextern struct value *value_release_to_mark (struct value *mark);
52219370Spst
52398944Sobrienextern int val_print (struct type * type, char *valaddr,
52498944Sobrien		      int embedded_offset, CORE_ADDR address,
52598944Sobrien		      struct ui_file * stream, int format,
52698944Sobrien		      int deref_ref, int recurse,
52798944Sobrien		      enum val_prettyprint pretty);
52819370Spst
529242936Semasteextern int common_val_print (struct value *val,
530242936Semaste			     struct ui_file *stream, int format,
531242936Semaste			     int deref_ref, int recurse,
532242936Semaste			     enum val_prettyprint pretty);
533242936Semaste
53498944Sobrienextern int val_print_string (CORE_ADDR addr, int len, int width, struct ui_file *stream);
53519370Spst
53698944Sobrienextern void print_variable_value (struct symbol * var,
53798944Sobrien				  struct frame_info * frame,
53898944Sobrien				  struct ui_file *stream);
53919370Spst
54098944Sobrienextern int check_field (struct value *, const char *);
54119370Spst
54298944Sobrienextern void typedef_print (struct type * type, struct symbol * news,
54398944Sobrien			     struct ui_file * stream);
54419370Spst
54598944Sobrienextern char *internalvar_name (struct internalvar *var);
54619370Spst
54798944Sobrienextern void clear_value_history (void);
54819370Spst
54998944Sobrienextern void clear_internalvars (void);
55019370Spst
55198944Sobrien/* From values.c */
55219370Spst
55398944Sobrienextern struct value *value_copy (struct value *);
55419370Spst
55598944Sobrien/* From valops.c */
55619370Spst
55798944Sobrienextern struct value *varying_to_slice (struct value *);
55819370Spst
55998944Sobrienextern struct value *value_slice (struct value *, int, int);
56019370Spst
56198944Sobrienextern struct value *value_literal_complex (struct value *, struct value *,
56298944Sobrien					    struct type *);
56319370Spst
56498944Sobrienextern void find_rt_vbase_offset (struct type *, struct type *, char *, int,
56598944Sobrien				  int *, int *);
56619370Spst
567130803Smarcelextern struct value *find_function_in_inferior (const char *);
56819370Spst
56998944Sobrienextern struct value *value_allocate_space_in_inferior (int);
57019370Spst
571130803Smarcelextern CORE_ADDR legacy_push_arguments (int nargs, struct value ** args,
572130803Smarcel					CORE_ADDR sp, int struct_return,
573130803Smarcel					CORE_ADDR struct_addr);
57446283Sdfr
575130803Smarcelextern struct value *value_of_local (const char *name, int complain);
576130803Smarcel
57798944Sobrien#endif /* !defined (VALUE_H) */
578