value.h revision 1.1.1.4 1 1.1 christos /* Definitions for values of C expressions, for GDB.
2 1.1 christos
3 1.1.1.4 christos Copyright (C) 1986-2016 Free Software Foundation, Inc.
4 1.1 christos
5 1.1 christos This file is part of GDB.
6 1.1 christos
7 1.1 christos This program is free software; you can redistribute it and/or modify
8 1.1 christos it under the terms of the GNU General Public License as published by
9 1.1 christos the Free Software Foundation; either version 3 of the License, or
10 1.1 christos (at your option) any later version.
11 1.1 christos
12 1.1 christos This program is distributed in the hope that it will be useful,
13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 christos GNU General Public License for more details.
16 1.1 christos
17 1.1 christos You should have received a copy of the GNU General Public License
18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 1.1 christos
20 1.1 christos #if !defined (VALUE_H)
21 1.1 christos #define VALUE_H 1
22 1.1 christos
23 1.1 christos #include "doublest.h"
24 1.1 christos #include "frame.h" /* For struct frame_id. */
25 1.1 christos
26 1.1 christos struct block;
27 1.1 christos struct expression;
28 1.1 christos struct regcache;
29 1.1 christos struct symbol;
30 1.1 christos struct type;
31 1.1 christos struct ui_file;
32 1.1 christos struct language_defn;
33 1.1 christos struct value_print_options;
34 1.1.1.2 christos struct xmethod_worker;
35 1.1.1.2 christos
36 1.1.1.2 christos /* Values can be partially 'optimized out' and/or 'unavailable'.
37 1.1.1.2 christos These are distinct states and have different string representations
38 1.1.1.2 christos and related error strings.
39 1.1.1.2 christos
40 1.1.1.2 christos 'unavailable' has a specific meaning in this context. It means the
41 1.1.1.2 christos value exists in the program (at the machine level), but GDB has no
42 1.1.1.2 christos means to get to it. Such a value is normally printed as
43 1.1.1.2 christos <unavailable>. Examples of how to end up with an unavailable value
44 1.1.1.2 christos would be:
45 1.1.1.2 christos
46 1.1.1.2 christos - We're inspecting a traceframe, and the memory or registers the
47 1.1.1.2 christos debug information says the value lives on haven't been collected.
48 1.1.1.2 christos
49 1.1.1.2 christos - We're inspecting a core dump, the memory or registers the debug
50 1.1.1.2 christos information says the value lives aren't present in the dump
51 1.1.1.2 christos (that is, we have a partial/trimmed core dump, or we don't fully
52 1.1.1.2 christos understand/handle the core dump's format).
53 1.1.1.2 christos
54 1.1.1.2 christos - We're doing live debugging, but the debug API has no means to
55 1.1.1.2 christos get at where the value lives in the machine, like e.g., ptrace
56 1.1.1.2 christos not having access to some register or register set.
57 1.1.1.2 christos
58 1.1.1.2 christos - Any other similar scenario.
59 1.1.1.2 christos
60 1.1.1.2 christos OTOH, "optimized out" is about what the compiler decided to generate
61 1.1.1.2 christos (or not generate). A chunk of a value that was optimized out does
62 1.1.1.2 christos not actually exist in the program. There's no way to get at it
63 1.1.1.2 christos short of compiling the program differently.
64 1.1.1.2 christos
65 1.1.1.2 christos A register that has not been saved in a frame is likewise considered
66 1.1.1.2 christos optimized out, except not-saved registers have a different string
67 1.1.1.2 christos representation and related error strings. E.g., we'll print them as
68 1.1.1.2 christos <not-saved> instead of <optimized out>, as in:
69 1.1.1.2 christos
70 1.1.1.2 christos (gdb) p/x $rax
71 1.1.1.2 christos $1 = <not saved>
72 1.1.1.2 christos (gdb) info registers rax
73 1.1.1.2 christos rax <not saved>
74 1.1.1.2 christos
75 1.1.1.2 christos If the debug info describes a variable as being in such a register,
76 1.1.1.2 christos we'll still print the variable as <optimized out>. IOW, <not saved>
77 1.1.1.2 christos is reserved for inspecting registers at the machine level.
78 1.1.1.2 christos
79 1.1.1.2 christos When comparing value contents, optimized out chunks, unavailable
80 1.1.1.2 christos chunks, and valid contents data are all considered different. See
81 1.1.1.2 christos value_contents_eq for more info.
82 1.1.1.2 christos */
83 1.1 christos
84 1.1 christos /* The structure which defines the type of a value. It should never
85 1.1 christos be possible for a program lval value to survive over a call to the
86 1.1 christos inferior (i.e. to be put into the history list or an internal
87 1.1 christos variable). */
88 1.1 christos
89 1.1 christos struct value;
90 1.1 christos
91 1.1 christos /* Values are stored in a chain, so that they can be deleted easily
92 1.1 christos over calls to the inferior. Values assigned to internal variables,
93 1.1 christos put into the value history or exposed to Python are taken off this
94 1.1 christos list. */
95 1.1 christos
96 1.1.1.4 christos struct value *value_next (const struct value *);
97 1.1 christos
98 1.1 christos /* Type of the value. */
99 1.1 christos
100 1.1 christos extern struct type *value_type (const struct value *);
101 1.1 christos
102 1.1.1.4 christos /* Return the gdbarch associated with the value. */
103 1.1.1.4 christos
104 1.1.1.4 christos extern struct gdbarch *get_value_arch (const struct value *value);
105 1.1.1.4 christos
106 1.1 christos /* This is being used to change the type of an existing value, that
107 1.1 christos code should instead be creating a new value with the changed type
108 1.1 christos (but possibly shared content). */
109 1.1 christos
110 1.1 christos extern void deprecated_set_value_type (struct value *value,
111 1.1 christos struct type *type);
112 1.1 christos
113 1.1 christos /* Only used for bitfields; number of bits contained in them. */
114 1.1 christos
115 1.1.1.4 christos extern LONGEST value_bitsize (const struct value *);
116 1.1.1.4 christos extern void set_value_bitsize (struct value *, LONGEST bit);
117 1.1 christos
118 1.1 christos /* Only used for bitfields; position of start of field. For
119 1.1 christos gdbarch_bits_big_endian=0 targets, it is the position of the LSB. For
120 1.1 christos gdbarch_bits_big_endian=1 targets, it is the position of the MSB. */
121 1.1 christos
122 1.1.1.4 christos extern LONGEST value_bitpos (const struct value *);
123 1.1.1.4 christos extern void set_value_bitpos (struct value *, LONGEST bit);
124 1.1 christos
125 1.1 christos /* Only used for bitfields; the containing value. This allows a
126 1.1 christos single read from the target when displaying multiple
127 1.1 christos bitfields. */
128 1.1 christos
129 1.1.1.4 christos struct value *value_parent (const struct value *);
130 1.1 christos extern void set_value_parent (struct value *value, struct value *parent);
131 1.1 christos
132 1.1 christos /* Describes offset of a value within lval of a structure in bytes.
133 1.1 christos If lval == lval_memory, this is an offset to the address. If lval
134 1.1 christos == lval_register, this is a further offset from location.address
135 1.1 christos within the registers structure. Note also the member
136 1.1 christos embedded_offset below. */
137 1.1 christos
138 1.1.1.4 christos extern LONGEST value_offset (const struct value *);
139 1.1.1.4 christos extern void set_value_offset (struct value *, LONGEST offset);
140 1.1 christos
141 1.1 christos /* The comment from "struct value" reads: ``Is it modifiable? Only
142 1.1 christos relevant if lval != not_lval.''. Shouldn't the value instead be
143 1.1 christos not_lval and be done with it? */
144 1.1 christos
145 1.1.1.4 christos extern int deprecated_value_modifiable (const struct value *value);
146 1.1 christos
147 1.1 christos /* If a value represents a C++ object, then the `type' field gives the
148 1.1 christos object's compile-time type. If the object actually belongs to some
149 1.1 christos class derived from `type', perhaps with other base classes and
150 1.1 christos additional members, then `type' is just a subobject of the real
151 1.1 christos thing, and the full object is probably larger than `type' would
152 1.1 christos suggest.
153 1.1 christos
154 1.1 christos If `type' is a dynamic class (i.e. one with a vtable), then GDB can
155 1.1 christos actually determine the object's run-time type by looking at the
156 1.1 christos run-time type information in the vtable. When this information is
157 1.1 christos available, we may elect to read in the entire object, for several
158 1.1 christos reasons:
159 1.1 christos
160 1.1 christos - When printing the value, the user would probably rather see the
161 1.1 christos full object, not just the limited portion apparent from the
162 1.1 christos compile-time type.
163 1.1 christos
164 1.1 christos - If `type' has virtual base classes, then even printing `type'
165 1.1 christos alone may require reaching outside the `type' portion of the
166 1.1 christos object to wherever the virtual base class has been stored.
167 1.1 christos
168 1.1 christos When we store the entire object, `enclosing_type' is the run-time
169 1.1 christos type -- the complete object -- and `embedded_offset' is the offset
170 1.1 christos of `type' within that larger type, in bytes. The value_contents()
171 1.1 christos macro takes `embedded_offset' into account, so most GDB code
172 1.1 christos continues to see the `type' portion of the value, just as the
173 1.1 christos inferior would.
174 1.1 christos
175 1.1 christos If `type' is a pointer to an object, then `enclosing_type' is a
176 1.1 christos pointer to the object's run-time type, and `pointed_to_offset' is
177 1.1 christos the offset in bytes from the full object to the pointed-to object
178 1.1 christos -- that is, the value `embedded_offset' would have if we followed
179 1.1 christos the pointer and fetched the complete object. (I don't really see
180 1.1 christos the point. Why not just determine the run-time type when you
181 1.1 christos indirect, and avoid the special case? The contents don't matter
182 1.1 christos until you indirect anyway.)
183 1.1 christos
184 1.1 christos If we're not doing anything fancy, `enclosing_type' is equal to
185 1.1 christos `type', and `embedded_offset' is zero, so everything works
186 1.1 christos normally. */
187 1.1 christos
188 1.1.1.4 christos extern struct type *value_enclosing_type (const struct value *);
189 1.1 christos extern void set_value_enclosing_type (struct value *val,
190 1.1 christos struct type *new_type);
191 1.1 christos
192 1.1 christos /* Returns value_type or value_enclosing_type depending on
193 1.1 christos value_print_options.objectprint.
194 1.1 christos
195 1.1 christos If RESOLVE_SIMPLE_TYPES is 0 the enclosing type will be resolved
196 1.1 christos only for pointers and references, else it will be returned
197 1.1 christos for all the types (e.g. structures). This option is useful
198 1.1 christos to prevent retrieving enclosing type for the base classes fields.
199 1.1 christos
200 1.1 christos REAL_TYPE_FOUND is used to inform whether the real type was found
201 1.1 christos (or just static type was used). The NULL may be passed if it is not
202 1.1 christos necessary. */
203 1.1 christos
204 1.1 christos extern struct type *value_actual_type (struct value *value,
205 1.1 christos int resolve_simple_types,
206 1.1 christos int *real_type_found);
207 1.1 christos
208 1.1.1.4 christos extern LONGEST value_pointed_to_offset (const struct value *value);
209 1.1.1.4 christos extern void set_value_pointed_to_offset (struct value *value, LONGEST val);
210 1.1.1.4 christos extern LONGEST value_embedded_offset (const struct value *value);
211 1.1.1.4 christos extern void set_value_embedded_offset (struct value *value, LONGEST val);
212 1.1 christos
213 1.1 christos /* For lval_computed values, this structure holds functions used to
214 1.1 christos retrieve and set the value (or portions of the value).
215 1.1 christos
216 1.1 christos For each function, 'V' is the 'this' pointer: an lval_funcs
217 1.1 christos function F may always assume that the V it receives is an
218 1.1 christos lval_computed value, and has F in the appropriate slot of its
219 1.1 christos lval_funcs structure. */
220 1.1 christos
221 1.1 christos struct lval_funcs
222 1.1 christos {
223 1.1 christos /* Fill in VALUE's contents. This is used to "un-lazy" values. If
224 1.1 christos a problem arises in obtaining VALUE's bits, this function should
225 1.1 christos call 'error'. If it is NULL value_fetch_lazy on "un-lazy"
226 1.1 christos non-optimized-out value is an internal error. */
227 1.1 christos void (*read) (struct value *v);
228 1.1 christos
229 1.1 christos /* Handle an assignment TOVAL = FROMVAL by writing the value of
230 1.1 christos FROMVAL to TOVAL's location. The contents of TOVAL have not yet
231 1.1 christos been updated. If a problem arises in doing so, this function
232 1.1 christos should call 'error'. If it is NULL such TOVAL assignment is an error as
233 1.1 christos TOVAL is not considered as an lvalue. */
234 1.1 christos void (*write) (struct value *toval, struct value *fromval);
235 1.1 christos
236 1.1 christos /* If non-NULL, this is used to implement pointer indirection for
237 1.1 christos this value. This method may return NULL, in which case value_ind
238 1.1 christos will fall back to ordinary indirection. */
239 1.1 christos struct value *(*indirect) (struct value *value);
240 1.1 christos
241 1.1 christos /* If non-NULL, this is used to implement reference resolving for
242 1.1 christos this value. This method may return NULL, in which case coerce_ref
243 1.1 christos will fall back to ordinary references resolving. */
244 1.1 christos struct value *(*coerce_ref) (const struct value *value);
245 1.1 christos
246 1.1 christos /* If non-NULL, this is used to determine whether the indicated bits
247 1.1 christos of VALUE are a synthetic pointer. */
248 1.1 christos int (*check_synthetic_pointer) (const struct value *value,
249 1.1.1.4 christos LONGEST offset, int length);
250 1.1 christos
251 1.1 christos /* Return a duplicate of VALUE's closure, for use in a new value.
252 1.1 christos This may simply return the same closure, if VALUE's is
253 1.1 christos reference-counted or statically allocated.
254 1.1 christos
255 1.1 christos This may be NULL, in which case VALUE's closure is re-used in the
256 1.1 christos new value. */
257 1.1 christos void *(*copy_closure) (const struct value *v);
258 1.1 christos
259 1.1 christos /* Drop VALUE's reference to its closure. Maybe this frees the
260 1.1 christos closure; maybe this decrements a reference count; maybe the
261 1.1 christos closure is statically allocated and this does nothing.
262 1.1 christos
263 1.1 christos This may be NULL, in which case no action is taken to free
264 1.1 christos VALUE's closure. */
265 1.1 christos void (*free_closure) (struct value *v);
266 1.1 christos };
267 1.1 christos
268 1.1 christos /* Create a computed lvalue, with type TYPE, function pointers FUNCS,
269 1.1 christos and closure CLOSURE. */
270 1.1 christos
271 1.1 christos extern struct value *allocate_computed_value (struct type *type,
272 1.1 christos const struct lval_funcs *funcs,
273 1.1 christos void *closure);
274 1.1 christos
275 1.1 christos /* Helper function to check the validity of some bits of a value.
276 1.1 christos
277 1.1 christos If TYPE represents some aggregate type (e.g., a structure), return 1.
278 1.1 christos
279 1.1 christos Otherwise, any of the bytes starting at OFFSET and extending for
280 1.1 christos TYPE_LENGTH(TYPE) bytes are invalid, print a message to STREAM and
281 1.1 christos return 0. The checking is done using FUNCS.
282 1.1 christos
283 1.1 christos Otherwise, return 1. */
284 1.1 christos
285 1.1 christos extern int valprint_check_validity (struct ui_file *stream, struct type *type,
286 1.1.1.4 christos LONGEST embedded_offset,
287 1.1 christos const struct value *val);
288 1.1 christos
289 1.1 christos extern struct value *allocate_optimized_out_value (struct type *type);
290 1.1 christos
291 1.1 christos /* If VALUE is lval_computed, return its lval_funcs structure. */
292 1.1 christos
293 1.1 christos extern const struct lval_funcs *value_computed_funcs (const struct value *);
294 1.1 christos
295 1.1 christos /* If VALUE is lval_computed, return its closure. The meaning of the
296 1.1 christos returned value depends on the functions VALUE uses. */
297 1.1 christos
298 1.1 christos extern void *value_computed_closure (const struct value *value);
299 1.1 christos
300 1.1 christos /* If zero, contents of this value are in the contents field. If
301 1.1 christos nonzero, contents are in inferior. If the lval field is lval_memory,
302 1.1 christos the contents are in inferior memory at location.address plus offset.
303 1.1 christos The lval field may also be lval_register.
304 1.1 christos
305 1.1 christos WARNING: This field is used by the code which handles watchpoints
306 1.1 christos (see breakpoint.c) to decide whether a particular value can be
307 1.1 christos watched by hardware watchpoints. If the lazy flag is set for some
308 1.1 christos member of a value chain, it is assumed that this member of the
309 1.1 christos chain doesn't need to be watched as part of watching the value
310 1.1 christos itself. This is how GDB avoids watching the entire struct or array
311 1.1 christos when the user wants to watch a single struct member or array
312 1.1 christos element. If you ever change the way lazy flag is set and reset, be
313 1.1 christos sure to consider this use as well! */
314 1.1 christos
315 1.1.1.4 christos extern int value_lazy (const struct value *);
316 1.1 christos extern void set_value_lazy (struct value *value, int val);
317 1.1 christos
318 1.1.1.4 christos extern int value_stack (const struct value *);
319 1.1 christos extern void set_value_stack (struct value *value, int val);
320 1.1 christos
321 1.1 christos /* Throw an error complaining that the value has been optimized
322 1.1 christos out. */
323 1.1 christos
324 1.1 christos extern void error_value_optimized_out (void);
325 1.1 christos
326 1.1 christos /* value_contents() and value_contents_raw() both return the address
327 1.1 christos of the gdb buffer used to hold a copy of the contents of the lval.
328 1.1 christos value_contents() is used when the contents of the buffer are needed
329 1.1 christos -- it uses value_fetch_lazy() to load the buffer from the process
330 1.1 christos being debugged if it hasn't already been loaded
331 1.1 christos (value_contents_writeable() is used when a writeable but fetched
332 1.1 christos buffer is required).. value_contents_raw() is used when data is
333 1.1 christos being stored into the buffer, or when it is certain that the
334 1.1 christos contents of the buffer are valid.
335 1.1 christos
336 1.1 christos Note: The contents pointer is adjusted by the offset required to
337 1.1 christos get to the real subobject, if the value happens to represent
338 1.1 christos something embedded in a larger run-time object. */
339 1.1 christos
340 1.1 christos extern gdb_byte *value_contents_raw (struct value *);
341 1.1 christos
342 1.1 christos /* Actual contents of the value. For use of this value; setting it
343 1.1 christos uses the stuff above. Not valid if lazy is nonzero. Target
344 1.1 christos byte-order. We force it to be aligned properly for any possible
345 1.1 christos value. Note that a value therefore extends beyond what is
346 1.1 christos declared here. */
347 1.1 christos
348 1.1 christos extern const gdb_byte *value_contents (struct value *);
349 1.1 christos extern gdb_byte *value_contents_writeable (struct value *);
350 1.1 christos
351 1.1 christos /* The ALL variants of the above two macros do not adjust the returned
352 1.1 christos pointer by the embedded_offset value. */
353 1.1 christos
354 1.1 christos extern gdb_byte *value_contents_all_raw (struct value *);
355 1.1 christos extern const gdb_byte *value_contents_all (struct value *);
356 1.1 christos
357 1.1 christos /* Like value_contents_all, but does not require that the returned
358 1.1 christos bits be valid. This should only be used in situations where you
359 1.1 christos plan to check the validity manually. */
360 1.1 christos extern const gdb_byte *value_contents_for_printing (struct value *value);
361 1.1 christos
362 1.1 christos /* Like value_contents_for_printing, but accepts a constant value
363 1.1 christos pointer. Unlike value_contents_for_printing however, the pointed
364 1.1 christos value must _not_ be lazy. */
365 1.1 christos extern const gdb_byte *
366 1.1 christos value_contents_for_printing_const (const struct value *value);
367 1.1 christos
368 1.1.1.3 christos extern void value_fetch_lazy (struct value *val);
369 1.1 christos
370 1.1 christos /* If nonzero, this is the value of a variable which does not actually
371 1.1 christos exist in the program, at least partially. If the value is lazy,
372 1.1 christos this may fetch it now. */
373 1.1 christos extern int value_optimized_out (struct value *value);
374 1.1 christos
375 1.1.1.2 christos /* Given a value, return true if any of the contents bits starting at
376 1.1.1.2 christos OFFSET and extending for LENGTH bits is optimized out, false
377 1.1.1.2 christos otherwise. */
378 1.1.1.2 christos
379 1.1.1.2 christos extern int value_bits_any_optimized_out (const struct value *value,
380 1.1.1.2 christos int bit_offset, int bit_length);
381 1.1.1.2 christos
382 1.1.1.2 christos /* Like value_optimized_out, but return true iff the whole value is
383 1.1.1.2 christos optimized out. */
384 1.1.1.2 christos extern int value_entirely_optimized_out (struct value *value);
385 1.1.1.2 christos
386 1.1.1.2 christos /* Mark VALUE's content bytes starting at OFFSET and extending for
387 1.1.1.2 christos LENGTH bytes as optimized out. */
388 1.1.1.2 christos
389 1.1.1.2 christos extern void mark_value_bytes_optimized_out (struct value *value,
390 1.1.1.2 christos int offset, int length);
391 1.1.1.2 christos
392 1.1.1.2 christos /* Mark VALUE's content bits starting at OFFSET and extending for
393 1.1.1.2 christos LENGTH bits as optimized out. */
394 1.1.1.2 christos
395 1.1.1.2 christos extern void mark_value_bits_optimized_out (struct value *value,
396 1.1.1.4 christos LONGEST offset, LONGEST length);
397 1.1 christos
398 1.1 christos /* Set or return field indicating whether a variable is initialized or
399 1.1 christos not, based on debugging information supplied by the compiler.
400 1.1 christos 1 = initialized; 0 = uninitialized. */
401 1.1.1.4 christos extern int value_initialized (const struct value *);
402 1.1 christos extern void set_value_initialized (struct value *, int);
403 1.1 christos
404 1.1 christos /* Set COMPONENT's location as appropriate for a component of WHOLE
405 1.1 christos --- regardless of what kind of lvalue WHOLE is. */
406 1.1 christos extern void set_value_component_location (struct value *component,
407 1.1 christos const struct value *whole);
408 1.1 christos
409 1.1 christos /* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a
410 1.1 christos single value might have multiple LVALs), this hacked interface is
411 1.1 christos limited to just the first PIECE. Expect further change. */
412 1.1 christos /* Type of value; either not an lval, or one of the various different
413 1.1 christos possible kinds of lval. */
414 1.1 christos extern enum lval_type *deprecated_value_lval_hack (struct value *);
415 1.1 christos #define VALUE_LVAL(val) (*deprecated_value_lval_hack (val))
416 1.1 christos
417 1.1 christos /* Like VALUE_LVAL, except the parameter can be const. */
418 1.1 christos extern enum lval_type value_lval_const (const struct value *value);
419 1.1 christos
420 1.1 christos /* If lval == lval_memory, return the address in the inferior. If
421 1.1 christos lval == lval_register, return the byte offset into the registers
422 1.1 christos structure. Otherwise, return 0. The returned address
423 1.1 christos includes the offset, if any. */
424 1.1 christos extern CORE_ADDR value_address (const struct value *);
425 1.1 christos
426 1.1 christos /* Like value_address, except the result does not include value's
427 1.1 christos offset. */
428 1.1.1.4 christos extern CORE_ADDR value_raw_address (const struct value *);
429 1.1 christos
430 1.1 christos /* Set the address of a value. */
431 1.1 christos extern void set_value_address (struct value *, CORE_ADDR);
432 1.1 christos
433 1.1 christos /* Pointer to internal variable. */
434 1.1 christos extern struct internalvar **deprecated_value_internalvar_hack (struct value *);
435 1.1 christos #define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val))
436 1.1 christos
437 1.1 christos /* Frame register value is relative to. This will be described in the
438 1.1 christos lval enum above as "lval_register". */
439 1.1 christos extern struct frame_id *deprecated_value_frame_id_hack (struct value *);
440 1.1 christos #define VALUE_FRAME_ID(val) (*deprecated_value_frame_id_hack (val))
441 1.1 christos
442 1.1 christos /* Register number if the value is from a register. */
443 1.1 christos extern short *deprecated_value_regnum_hack (struct value *);
444 1.1 christos #define VALUE_REGNUM(val) (*deprecated_value_regnum_hack (val))
445 1.1 christos
446 1.1 christos /* Return value after lval_funcs->coerce_ref (after check_typedef). Return
447 1.1 christos NULL if lval_funcs->coerce_ref is not applicable for whatever reason. */
448 1.1 christos
449 1.1 christos extern struct value *coerce_ref_if_computed (const struct value *arg);
450 1.1 christos
451 1.1 christos /* Setup a new value type and enclosing value type for dereferenced value VALUE.
452 1.1 christos ENC_TYPE is the new enclosing type that should be set. ORIGINAL_TYPE and
453 1.1 christos ORIGINAL_VAL are the type and value of the original reference or pointer.
454 1.1 christos
455 1.1 christos Note, that VALUE is modified by this function.
456 1.1 christos
457 1.1 christos It is a common implementation for coerce_ref and value_ind. */
458 1.1 christos
459 1.1 christos extern struct value * readjust_indirect_value_type (struct value *value,
460 1.1 christos struct type *enc_type,
461 1.1.1.4 christos const struct type *original_type,
462 1.1.1.4 christos const struct value *original_val);
463 1.1 christos
464 1.1 christos /* Convert a REF to the object referenced. */
465 1.1 christos
466 1.1 christos extern struct value *coerce_ref (struct value *value);
467 1.1 christos
468 1.1 christos /* If ARG is an array, convert it to a pointer.
469 1.1 christos If ARG is a function, convert it to a function pointer.
470 1.1 christos
471 1.1 christos References are dereferenced. */
472 1.1 christos
473 1.1 christos extern struct value *coerce_array (struct value *value);
474 1.1 christos
475 1.1 christos /* Given a value, determine whether the bits starting at OFFSET and
476 1.1 christos extending for LENGTH bits are a synthetic pointer. */
477 1.1 christos
478 1.1 christos extern int value_bits_synthetic_pointer (const struct value *value,
479 1.1.1.4 christos LONGEST offset, LONGEST length);
480 1.1 christos
481 1.1 christos /* Given a value, determine whether the contents bytes starting at
482 1.1 christos OFFSET and extending for LENGTH bytes are available. This returns
483 1.1 christos nonzero if all bytes in the given range are available, zero if any
484 1.1 christos byte is unavailable. */
485 1.1 christos
486 1.1 christos extern int value_bytes_available (const struct value *value,
487 1.1.1.4 christos LONGEST offset, LONGEST length);
488 1.1 christos
489 1.1 christos /* Given a value, determine whether the contents bits starting at
490 1.1 christos OFFSET and extending for LENGTH bits are available. This returns
491 1.1 christos nonzero if all bits in the given range are available, zero if any
492 1.1 christos bit is unavailable. */
493 1.1 christos
494 1.1 christos extern int value_bits_available (const struct value *value,
495 1.1.1.4 christos LONGEST offset, LONGEST length);
496 1.1 christos
497 1.1 christos /* Like value_bytes_available, but return false if any byte in the
498 1.1 christos whole object is unavailable. */
499 1.1 christos extern int value_entirely_available (struct value *value);
500 1.1 christos
501 1.1 christos /* Like value_entirely_available, but return false if any byte in the
502 1.1 christos whole object is available. */
503 1.1 christos extern int value_entirely_unavailable (struct value *value);
504 1.1 christos
505 1.1 christos /* Mark VALUE's content bytes starting at OFFSET and extending for
506 1.1 christos LENGTH bytes as unavailable. */
507 1.1 christos
508 1.1 christos extern void mark_value_bytes_unavailable (struct value *value,
509 1.1.1.4 christos LONGEST offset, LONGEST length);
510 1.1 christos
511 1.1 christos /* Mark VALUE's content bits starting at OFFSET and extending for
512 1.1 christos LENGTH bits as unavailable. */
513 1.1 christos
514 1.1 christos extern void mark_value_bits_unavailable (struct value *value,
515 1.1.1.4 christos LONGEST offset, LONGEST length);
516 1.1 christos
517 1.1 christos /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with
518 1.1 christos LENGTH bytes of VAL2's contents starting at OFFSET2.
519 1.1 christos
520 1.1 christos Note that "contents" refers to the whole value's contents
521 1.1 christos (value_contents_all), without any embedded offset adjustment. For
522 1.1 christos example, to compare a complete object value with itself, including
523 1.1 christos its enclosing type chunk, you'd do:
524 1.1 christos
525 1.1 christos int len = TYPE_LENGTH (check_typedef (value_enclosing_type (val)));
526 1.1.1.2 christos value_contents_eq (val, 0, val, 0, len);
527 1.1.1.2 christos
528 1.1.1.2 christos Returns true iff the set of available/valid contents match.
529 1.1 christos
530 1.1.1.2 christos Optimized-out contents are equal to optimized-out contents, and are
531 1.1.1.2 christos not equal to non-optimized-out contents.
532 1.1 christos
533 1.1.1.2 christos Unavailable contente are equal to unavailable contents, and are not
534 1.1.1.2 christos equal to non-unavailable contents.
535 1.1.1.2 christos
536 1.1.1.2 christos For example, if 'x's represent an unavailable byte, and 'V' and 'Z'
537 1.1.1.2 christos represent different available/valid bytes, in a value with length
538 1.1.1.2 christos 16:
539 1.1.1.2 christos
540 1.1.1.2 christos offset: 0 4 8 12 16
541 1.1.1.2 christos contents: xxxxVVVVxxxxVVZZ
542 1.1.1.2 christos
543 1.1.1.2 christos then:
544 1.1.1.2 christos
545 1.1.1.2 christos value_contents_eq(val, 0, val, 8, 6) => 1
546 1.1.1.2 christos value_contents_eq(val, 0, val, 4, 4) => 0
547 1.1.1.2 christos value_contents_eq(val, 0, val, 8, 8) => 0
548 1.1.1.2 christos value_contents_eq(val, 4, val, 12, 2) => 1
549 1.1.1.2 christos value_contents_eq(val, 4, val, 12, 4) => 0
550 1.1.1.2 christos value_contents_eq(val, 3, val, 4, 4) => 0
551 1.1.1.2 christos
552 1.1.1.2 christos If 'x's represent an unavailable byte, 'o' represents an optimized
553 1.1.1.2 christos out byte, in a value with length 8:
554 1.1.1.2 christos
555 1.1.1.2 christos offset: 0 4 8
556 1.1.1.2 christos contents: xxxxoooo
557 1.1 christos
558 1.1 christos then:
559 1.1 christos
560 1.1.1.2 christos value_contents_eq(val, 0, val, 2, 2) => 1
561 1.1.1.2 christos value_contents_eq(val, 4, val, 6, 2) => 1
562 1.1.1.2 christos value_contents_eq(val, 0, val, 4, 4) => 0
563 1.1.1.2 christos
564 1.1.1.2 christos We only know whether a value chunk is unavailable or optimized out
565 1.1.1.2 christos if we've tried to read it. As this routine is used by printing
566 1.1.1.2 christos routines, which may be printing values in the value history, long
567 1.1.1.2 christos after the inferior is gone, it works with const values. Therefore,
568 1.1.1.2 christos this routine must not be called with lazy values. */
569 1.1.1.2 christos
570 1.1.1.4 christos extern int value_contents_eq (const struct value *val1, LONGEST offset1,
571 1.1.1.4 christos const struct value *val2, LONGEST offset2,
572 1.1.1.4 christos LONGEST length);
573 1.1 christos
574 1.1.1.4 christos /* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
575 1.1.1.4 christos which is (or will be copied to) VAL's contents buffer offset by
576 1.1 christos EMBEDDED_OFFSET (that is, to &VAL->contents[EMBEDDED_OFFSET]).
577 1.1 christos Marks value contents ranges as unavailable if the corresponding
578 1.1 christos memory is likewise unavailable. STACK indicates whether the memory
579 1.1 christos is known to be stack memory. */
580 1.1 christos
581 1.1.1.4 christos extern void read_value_memory (struct value *val, LONGEST embedded_offset,
582 1.1 christos int stack, CORE_ADDR memaddr,
583 1.1 christos gdb_byte *buffer, size_t length);
584 1.1 christos
585 1.1 christos /* Cast SCALAR_VALUE to the element type of VECTOR_TYPE, then replicate
586 1.1 christos into each element of a new vector value with VECTOR_TYPE. */
587 1.1 christos
588 1.1 christos struct value *value_vector_widen (struct value *scalar_value,
589 1.1 christos struct type *vector_type);
590 1.1 christos
591 1.1 christos
592 1.1 christos
594 1.1 christos #include "symtab.h"
595 1.1 christos #include "gdbtypes.h"
596 1.1 christos #include "expression.h"
597 1.1 christos
598 1.1 christos struct frame_info;
599 1.1 christos struct fn_field;
600 1.1 christos
601 1.1 christos extern int print_address_demangle (const struct value_print_options *,
602 1.1 christos struct gdbarch *, CORE_ADDR,
603 1.1 christos struct ui_file *, int);
604 1.1 christos
605 1.1 christos extern LONGEST value_as_long (struct value *val);
606 1.1 christos extern DOUBLEST value_as_double (struct value *val);
607 1.1 christos extern CORE_ADDR value_as_address (struct value *val);
608 1.1 christos
609 1.1 christos extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
610 1.1 christos extern DOUBLEST unpack_double (struct type *type, const gdb_byte *valaddr,
611 1.1 christos int *invp);
612 1.1 christos extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
613 1.1 christos
614 1.1 christos extern LONGEST unpack_field_as_long (struct type *type,
615 1.1 christos const gdb_byte *valaddr,
616 1.1 christos int fieldno);
617 1.1.1.4 christos extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
618 1.1 christos LONGEST embedded_offset, int fieldno,
619 1.1 christos const struct value *val, LONGEST *result);
620 1.1.1.2 christos
621 1.1.1.4 christos extern void unpack_value_bitfield (struct value *dest_val,
622 1.1.1.4 christos LONGEST bitpos, LONGEST bitsize,
623 1.1.1.4 christos const gdb_byte *valaddr,
624 1.1.1.2 christos LONGEST embedded_offset,
625 1.1.1.2 christos const struct value *val);
626 1.1 christos
627 1.1 christos extern struct value *value_field_bitfield (struct type *type, int fieldno,
628 1.1.1.4 christos const gdb_byte *valaddr,
629 1.1 christos LONGEST embedded_offset,
630 1.1 christos const struct value *val);
631 1.1 christos
632 1.1 christos extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num);
633 1.1 christos
634 1.1 christos extern struct value *value_from_longest (struct type *type, LONGEST num);
635 1.1 christos extern struct value *value_from_ulongest (struct type *type, ULONGEST num);
636 1.1 christos extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
637 1.1 christos extern struct value *value_from_double (struct type *type, DOUBLEST num);
638 1.1 christos extern struct value *value_from_decfloat (struct type *type,
639 1.1.1.2 christos const gdb_byte *decbytes);
640 1.1 christos extern struct value *value_from_history_ref (const char *, const char **);
641 1.1 christos
642 1.1 christos extern struct value *value_at (struct type *type, CORE_ADDR addr);
643 1.1 christos extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr);
644 1.1.1.2 christos
645 1.1.1.2 christos extern struct value *value_from_contents_and_address_unresolved
646 1.1 christos (struct type *, const gdb_byte *, CORE_ADDR);
647 1.1 christos extern struct value *value_from_contents_and_address (struct type *,
648 1.1 christos const gdb_byte *,
649 1.1 christos CORE_ADDR);
650 1.1 christos extern struct value *value_from_contents (struct type *, const gdb_byte *);
651 1.1.1.2 christos
652 1.1.1.2 christos extern struct value *default_value_from_register (struct gdbarch *gdbarch,
653 1.1 christos struct type *type,
654 1.1.1.2 christos int regnum,
655 1.1 christos struct frame_id frame_id);
656 1.1 christos
657 1.1 christos extern void read_frame_register_value (struct value *value,
658 1.1 christos struct frame_info *frame);
659 1.1 christos
660 1.1 christos extern struct value *value_from_register (struct type *type, int regnum,
661 1.1 christos struct frame_info *frame);
662 1.1.1.2 christos
663 1.1 christos extern CORE_ADDR address_from_register (int regnum,
664 1.1 christos struct frame_info *frame);
665 1.1 christos
666 1.1 christos extern struct value *value_of_variable (struct symbol *var,
667 1.1 christos const struct block *b);
668 1.1 christos
669 1.1 christos extern struct value *address_of_variable (struct symbol *var,
670 1.1 christos const struct block *b);
671 1.1 christos
672 1.1 christos extern struct value *value_of_register (int regnum, struct frame_info *frame);
673 1.1 christos
674 1.1 christos struct value *value_of_register_lazy (struct frame_info *frame, int regnum);
675 1.1.1.4 christos
676 1.1.1.4 christos /* Return the symbol's reading requirement. */
677 1.1.1.4 christos
678 1.1.1.4 christos extern enum symbol_needs_kind symbol_read_needs (struct symbol *);
679 1.1.1.4 christos
680 1.1.1.4 christos /* Return true if the symbol needs a frame. This is a wrapper for
681 1.1.1.4 christos symbol_read_needs that simply checks for SYMBOL_NEEDS_FRAME. */
682 1.1 christos
683 1.1 christos extern int symbol_read_needs_frame (struct symbol *);
684 1.1 christos
685 1.1.1.4 christos extern struct value *read_var_value (struct symbol *var,
686 1.1 christos const struct block *var_block,
687 1.1 christos struct frame_info *frame);
688 1.1 christos
689 1.1.1.4 christos extern struct value *default_read_var_value (struct symbol *var,
690 1.1 christos const struct block *var_block,
691 1.1 christos struct frame_info *frame);
692 1.1 christos
693 1.1 christos extern struct value *allocate_value (struct type *type);
694 1.1.1.4 christos extern struct value *allocate_value_lazy (struct type *type);
695 1.1.1.4 christos extern void value_contents_copy (struct value *dst, LONGEST dst_offset,
696 1.1.1.4 christos struct value *src, LONGEST src_offset,
697 1.1.1.4 christos LONGEST length);
698 1.1.1.4 christos extern void value_contents_copy_raw (struct value *dst, LONGEST dst_offset,
699 1.1.1.4 christos struct value *src, LONGEST src_offset,
700 1.1 christos LONGEST length);
701 1.1 christos
702 1.1 christos extern struct value *allocate_repeat_value (struct type *type, int count);
703 1.1 christos
704 1.1 christos extern struct value *value_mark (void);
705 1.1.1.4 christos
706 1.1 christos extern void value_free_to_mark (const struct value *mark);
707 1.1.1.4 christos
708 1.1 christos extern struct value *value_cstring (const char *ptr, ssize_t len,
709 1.1.1.4 christos struct type *char_type);
710 1.1 christos extern struct value *value_string (const char *ptr, ssize_t len,
711 1.1 christos struct type *char_type);
712 1.1 christos
713 1.1 christos extern struct value *value_array (int lowbound, int highbound,
714 1.1 christos struct value **elemvec);
715 1.1 christos
716 1.1 christos extern struct value *value_concat (struct value *arg1, struct value *arg2);
717 1.1 christos
718 1.1 christos extern struct value *value_binop (struct value *arg1, struct value *arg2,
719 1.1 christos enum exp_opcode op);
720 1.1 christos
721 1.1 christos extern struct value *value_ptradd (struct value *arg1, LONGEST arg2);
722 1.1 christos
723 1.1 christos extern LONGEST value_ptrdiff (struct value *arg1, struct value *arg2);
724 1.1 christos
725 1.1 christos extern int value_must_coerce_to_target (struct value *arg1);
726 1.1 christos
727 1.1 christos extern struct value *value_coerce_to_target (struct value *arg1);
728 1.1 christos
729 1.1 christos extern struct value *value_coerce_array (struct value *arg1);
730 1.1 christos
731 1.1 christos extern struct value *value_coerce_function (struct value *arg1);
732 1.1 christos
733 1.1 christos extern struct value *value_ind (struct value *arg1);
734 1.1 christos
735 1.1 christos extern struct value *value_addr (struct value *arg1);
736 1.1 christos
737 1.1 christos extern struct value *value_ref (struct value *arg1);
738 1.1 christos
739 1.1 christos extern struct value *value_assign (struct value *toval,
740 1.1 christos struct value *fromval);
741 1.1 christos
742 1.1 christos extern struct value *value_pos (struct value *arg1);
743 1.1 christos
744 1.1 christos extern struct value *value_neg (struct value *arg1);
745 1.1 christos
746 1.1 christos extern struct value *value_complement (struct value *arg1);
747 1.1 christos
748 1.1 christos extern struct value *value_struct_elt (struct value **argp,
749 1.1 christos struct value **args,
750 1.1 christos const char *name, int *static_memfuncp,
751 1.1 christos const char *err);
752 1.1 christos
753 1.1 christos extern struct value *value_struct_elt_bitpos (struct value **argp,
754 1.1 christos int bitpos,
755 1.1 christos struct type *field_type,
756 1.1 christos const char *err);
757 1.1 christos
758 1.1.1.2 christos extern struct value *value_aggregate_elt (struct type *curtype,
759 1.1 christos const char *name,
760 1.1 christos struct type *expect_type,
761 1.1 christos int want_address,
762 1.1 christos enum noside noside);
763 1.1 christos
764 1.1 christos extern struct value *value_static_field (struct type *type, int fieldno);
765 1.1 christos
766 1.1 christos enum oload_search_type { NON_METHOD, METHOD, BOTH };
767 1.1 christos
768 1.1 christos extern int find_overload_match (struct value **args, int nargs,
769 1.1 christos const char *name,
770 1.1 christos enum oload_search_type method,
771 1.1 christos struct value **objp, struct symbol *fsym,
772 1.1.1.2 christos struct value **valp, struct symbol **symp,
773 1.1.1.2 christos int *staticp, const int no_adl,
774 1.1 christos enum noside noside);
775 1.1 christos
776 1.1 christos extern struct value *value_field (struct value *arg1, int fieldno);
777 1.1.1.4 christos
778 1.1 christos extern struct value *value_primitive_field (struct value *arg1, LONGEST offset,
779 1.1 christos int fieldno,
780 1.1 christos struct type *arg_type);
781 1.1 christos
782 1.1.1.4 christos
783 1.1 christos extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *,
784 1.1 christos int *);
785 1.1 christos
786 1.1 christos extern struct value *value_full_object (struct value *, struct type *, int,
787 1.1 christos int, int);
788 1.1 christos
789 1.1 christos extern struct value *value_cast_pointers (struct type *, struct value *, int);
790 1.1 christos
791 1.1 christos extern struct value *value_cast (struct type *type, struct value *arg2);
792 1.1 christos
793 1.1 christos extern struct value *value_reinterpret_cast (struct type *type,
794 1.1 christos struct value *arg);
795 1.1 christos
796 1.1 christos extern struct value *value_dynamic_cast (struct type *type, struct value *arg);
797 1.1 christos
798 1.1 christos extern struct value *value_zero (struct type *type, enum lval_type lv);
799 1.1 christos
800 1.1 christos extern struct value *value_one (struct type *type);
801 1.1 christos
802 1.1 christos extern struct value *value_repeat (struct value *arg1, int count);
803 1.1 christos
804 1.1 christos extern struct value *value_subscript (struct value *array, LONGEST index);
805 1.1 christos
806 1.1 christos extern struct value *value_bitstring_subscript (struct type *type,
807 1.1 christos struct value *bitstring,
808 1.1 christos LONGEST index);
809 1.1 christos
810 1.1 christos extern struct value *register_value_being_returned (struct type *valtype,
811 1.1 christos struct regcache *retbuf);
812 1.1 christos
813 1.1 christos extern int value_in (struct value *element, struct value *set);
814 1.1 christos
815 1.1 christos extern int value_bit_index (struct type *type, const gdb_byte *addr,
816 1.1 christos int index);
817 1.1 christos
818 1.1 christos extern enum return_value_convention
819 1.1 christos struct_return_convention (struct gdbarch *gdbarch, struct value *function,
820 1.1 christos struct type *value_type);
821 1.1 christos
822 1.1 christos extern int using_struct_return (struct gdbarch *gdbarch,
823 1.1 christos struct value *function,
824 1.1 christos struct type *value_type);
825 1.1 christos
826 1.1 christos extern struct value *evaluate_expression (struct expression *exp);
827 1.1 christos
828 1.1 christos extern struct value *evaluate_type (struct expression *exp);
829 1.1 christos
830 1.1 christos extern struct value *evaluate_subexp (struct type *expect_type,
831 1.1 christos struct expression *exp,
832 1.1 christos int *pos, enum noside noside);
833 1.1 christos
834 1.1 christos extern struct value *evaluate_subexpression_type (struct expression *exp,
835 1.1 christos int subexp);
836 1.1 christos
837 1.1 christos extern void fetch_subexp_value (struct expression *exp, int *pc,
838 1.1 christos struct value **valp, struct value **resultp,
839 1.1 christos struct value **val_chain,
840 1.1 christos int preserve_errors);
841 1.1 christos
842 1.1 christos extern char *extract_field_op (struct expression *exp, int *subexp);
843 1.1 christos
844 1.1 christos extern struct value *evaluate_subexp_with_coercion (struct expression *,
845 1.1 christos int *, enum noside);
846 1.1 christos
847 1.1 christos extern struct value *parse_and_eval (const char *exp);
848 1.1 christos
849 1.1 christos extern struct value *parse_to_comma_and_eval (const char **expp);
850 1.1 christos
851 1.1 christos extern struct type *parse_and_eval_type (char *p, int length);
852 1.1 christos
853 1.1 christos extern CORE_ADDR parse_and_eval_address (const char *exp);
854 1.1 christos
855 1.1 christos extern LONGEST parse_and_eval_long (const char *exp);
856 1.1 christos
857 1.1 christos extern void unop_promote (const struct language_defn *language,
858 1.1 christos struct gdbarch *gdbarch,
859 1.1 christos struct value **arg1);
860 1.1 christos
861 1.1 christos extern void binop_promote (const struct language_defn *language,
862 1.1 christos struct gdbarch *gdbarch,
863 1.1 christos struct value **arg1, struct value **arg2);
864 1.1 christos
865 1.1 christos extern struct value *access_value_history (int num);
866 1.1 christos
867 1.1 christos extern struct value *value_of_internalvar (struct gdbarch *gdbarch,
868 1.1 christos struct internalvar *var);
869 1.1 christos
870 1.1 christos extern int get_internalvar_integer (struct internalvar *var, LONGEST *l);
871 1.1 christos
872 1.1 christos extern void set_internalvar (struct internalvar *var, struct value *val);
873 1.1 christos
874 1.1 christos extern void set_internalvar_integer (struct internalvar *var, LONGEST l);
875 1.1 christos
876 1.1 christos extern void set_internalvar_string (struct internalvar *var,
877 1.1 christos const char *string);
878 1.1 christos
879 1.1 christos extern void clear_internalvar (struct internalvar *var);
880 1.1 christos
881 1.1.1.4 christos extern void set_internalvar_component (struct internalvar *var,
882 1.1.1.4 christos LONGEST offset,
883 1.1 christos LONGEST bitpos, LONGEST bitsize,
884 1.1 christos struct value *newvalue);
885 1.1 christos
886 1.1 christos extern struct internalvar *lookup_only_internalvar (const char *name);
887 1.1 christos
888 1.1 christos extern struct internalvar *create_internalvar (const char *name);
889 1.1 christos
890 1.1 christos extern VEC (char_ptr) *complete_internalvar (const char *name);
891 1.1 christos
892 1.1 christos /* An internalvar can be dynamically computed by supplying a vector of
893 1.1 christos function pointers to perform various operations. */
894 1.1 christos
895 1.1 christos struct internalvar_funcs
896 1.1 christos {
897 1.1 christos /* Compute the value of the variable. The DATA argument passed to
898 1.1 christos the function is the same argument that was passed to
899 1.1 christos `create_internalvar_type_lazy'. */
900 1.1 christos
901 1.1 christos struct value *(*make_value) (struct gdbarch *arch,
902 1.1 christos struct internalvar *var,
903 1.1 christos void *data);
904 1.1 christos
905 1.1 christos /* Update the agent expression EXPR with bytecode to compute the
906 1.1 christos value. VALUE is the agent value we are updating. The DATA
907 1.1 christos argument passed to this function is the same argument that was
908 1.1 christos passed to `create_internalvar_type_lazy'. If this pointer is
909 1.1 christos NULL, then the internalvar cannot be compiled to an agent
910 1.1 christos expression. */
911 1.1 christos
912 1.1 christos void (*compile_to_ax) (struct internalvar *var,
913 1.1 christos struct agent_expr *expr,
914 1.1 christos struct axs_value *value,
915 1.1 christos void *data);
916 1.1 christos
917 1.1 christos /* If non-NULL, this is called to destroy DATA. The DATA argument
918 1.1 christos passed to this function is the same argument that was passed to
919 1.1 christos `create_internalvar_type_lazy'. */
920 1.1 christos
921 1.1 christos void (*destroy) (void *data);
922 1.1 christos };
923 1.1 christos
924 1.1 christos extern struct internalvar *create_internalvar_type_lazy (const char *name,
925 1.1 christos const struct internalvar_funcs *funcs,
926 1.1 christos void *data);
927 1.1 christos
928 1.1 christos /* Compile an internal variable to an agent expression. VAR is the
929 1.1 christos variable to compile; EXPR and VALUE are the agent expression we are
930 1.1 christos updating. This will return 0 if there is no known way to compile
931 1.1 christos VAR, and 1 if VAR was successfully compiled. It may also throw an
932 1.1 christos exception on error. */
933 1.1 christos
934 1.1 christos extern int compile_internalvar_to_ax (struct internalvar *var,
935 1.1 christos struct agent_expr *expr,
936 1.1 christos struct axs_value *value);
937 1.1 christos
938 1.1 christos extern struct internalvar *lookup_internalvar (const char *name);
939 1.1 christos
940 1.1 christos extern int value_equal (struct value *arg1, struct value *arg2);
941 1.1 christos
942 1.1 christos extern int value_equal_contents (struct value *arg1, struct value *arg2);
943 1.1 christos
944 1.1 christos extern int value_less (struct value *arg1, struct value *arg2);
945 1.1 christos
946 1.1 christos extern int value_logical_not (struct value *arg1);
947 1.1 christos
948 1.1 christos /* C++ */
949 1.1 christos
950 1.1 christos extern struct value *value_of_this (const struct language_defn *lang);
951 1.1 christos
952 1.1 christos extern struct value *value_of_this_silent (const struct language_defn *lang);
953 1.1 christos
954 1.1 christos extern struct value *value_x_binop (struct value *arg1, struct value *arg2,
955 1.1 christos enum exp_opcode op,
956 1.1 christos enum exp_opcode otherop,
957 1.1 christos enum noside noside);
958 1.1 christos
959 1.1 christos extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
960 1.1 christos enum noside noside);
961 1.1 christos
962 1.1.1.4 christos extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f,
963 1.1 christos int j, struct type *type, LONGEST offset);
964 1.1 christos
965 1.1 christos extern int binop_types_user_defined_p (enum exp_opcode op,
966 1.1 christos struct type *type1,
967 1.1 christos struct type *type2);
968 1.1 christos
969 1.1 christos extern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
970 1.1 christos struct value *arg2);
971 1.1 christos
972 1.1 christos extern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
973 1.1 christos
974 1.1 christos extern int destructor_name_p (const char *name, struct type *type);
975 1.1 christos
976 1.1 christos extern void value_incref (struct value *val);
977 1.1 christos
978 1.1 christos extern void value_free (struct value *val);
979 1.1 christos
980 1.1 christos extern void free_all_values (void);
981 1.1 christos
982 1.1 christos extern void free_value_chain (struct value *v);
983 1.1 christos
984 1.1 christos extern void release_value (struct value *val);
985 1.1 christos
986 1.1 christos extern void release_value_or_incref (struct value *val);
987 1.1 christos
988 1.1 christos extern int record_latest_value (struct value *val);
989 1.1 christos
990 1.1.1.4 christos extern void modify_field (struct type *type, gdb_byte *addr,
991 1.1 christos LONGEST fieldval, LONGEST bitpos, LONGEST bitsize);
992 1.1 christos
993 1.1 christos extern void type_print (struct type *type, const char *varstring,
994 1.1 christos struct ui_file *stream, int show);
995 1.1 christos
996 1.1 christos extern char *type_to_string (struct type *type);
997 1.1 christos
998 1.1 christos extern gdb_byte *baseclass_addr (struct type *type, int index,
999 1.1 christos gdb_byte *valaddr,
1000 1.1 christos struct value **valuep, int *errp);
1001 1.1 christos
1002 1.1 christos extern void print_longest (struct ui_file *stream, int format,
1003 1.1 christos int use_local, LONGEST val);
1004 1.1 christos
1005 1.1 christos extern void print_floating (const gdb_byte *valaddr, struct type *type,
1006 1.1 christos struct ui_file *stream);
1007 1.1 christos
1008 1.1 christos extern void print_decimal_floating (const gdb_byte *valaddr, struct type *type,
1009 1.1 christos struct ui_file *stream);
1010 1.1 christos
1011 1.1 christos extern void value_print (struct value *val, struct ui_file *stream,
1012 1.1 christos const struct value_print_options *options);
1013 1.1 christos
1014 1.1 christos extern void value_print_array_elements (struct value *val,
1015 1.1 christos struct ui_file *stream, int format,
1016 1.1 christos enum val_prettyformat pretty);
1017 1.1.1.4 christos
1018 1.1 christos extern struct value *value_release_to_mark (const struct value *mark);
1019 1.1 christos
1020 1.1.1.4 christos extern void val_print (struct type *type, const gdb_byte *valaddr,
1021 1.1 christos LONGEST embedded_offset, CORE_ADDR address,
1022 1.1 christos struct ui_file *stream, int recurse,
1023 1.1 christos const struct value *val,
1024 1.1 christos const struct value_print_options *options,
1025 1.1 christos const struct language_defn *language);
1026 1.1 christos
1027 1.1 christos extern void common_val_print (struct value *val,
1028 1.1 christos struct ui_file *stream, int recurse,
1029 1.1 christos const struct value_print_options *options,
1030 1.1 christos const struct language_defn *language);
1031 1.1 christos
1032 1.1 christos extern int val_print_string (struct type *elttype, const char *encoding,
1033 1.1 christos CORE_ADDR addr, int len,
1034 1.1 christos struct ui_file *stream,
1035 1.1 christos const struct value_print_options *options);
1036 1.1 christos
1037 1.1 christos extern void print_variable_and_value (const char *name,
1038 1.1 christos struct symbol *var,
1039 1.1 christos struct frame_info *frame,
1040 1.1 christos struct ui_file *stream,
1041 1.1 christos int indent);
1042 1.1 christos
1043 1.1 christos extern void typedef_print (struct type *type, struct symbol *news,
1044 1.1 christos struct ui_file *stream);
1045 1.1.1.4 christos
1046 1.1 christos extern char *internalvar_name (const struct internalvar *var);
1047 1.1 christos
1048 1.1 christos extern void preserve_values (struct objfile *);
1049 1.1 christos
1050 1.1 christos /* From values.c */
1051 1.1 christos
1052 1.1 christos extern struct value *value_copy (struct value *);
1053 1.1 christos
1054 1.1 christos extern struct value *value_non_lval (struct value *);
1055 1.1.1.2 christos
1056 1.1.1.2 christos extern void value_force_lval (struct value *, CORE_ADDR);
1057 1.1.1.3 christos
1058 1.1.1.3 christos extern struct value *make_cv_value (int, int, struct value *);
1059 1.1 christos
1060 1.1 christos extern void preserve_one_value (struct value *, struct objfile *, htab_t);
1061 1.1 christos
1062 1.1 christos /* From valops.c */
1063 1.1 christos
1064 1.1 christos extern struct value *varying_to_slice (struct value *);
1065 1.1 christos
1066 1.1 christos extern struct value *value_slice (struct value *, int, int);
1067 1.1 christos
1068 1.1 christos extern struct value *value_literal_complex (struct value *, struct value *,
1069 1.1 christos struct type *);
1070 1.1 christos
1071 1.1 christos extern struct value *find_function_in_inferior (const char *,
1072 1.1 christos struct objfile **);
1073 1.1 christos
1074 1.1 christos extern struct value *value_allocate_space_in_inferior (int);
1075 1.1 christos
1076 1.1 christos extern struct value *value_subscripted_rvalue (struct value *array,
1077 1.1 christos LONGEST index, int lowerbound);
1078 1.1 christos
1079 1.1 christos /* User function handler. */
1080 1.1 christos
1081 1.1 christos typedef struct value *(*internal_function_fn) (struct gdbarch *gdbarch,
1082 1.1 christos const struct language_defn *language,
1083 1.1 christos void *cookie,
1084 1.1 christos int argc,
1085 1.1 christos struct value **argv);
1086 1.1 christos
1087 1.1 christos void add_internal_function (const char *name, const char *doc,
1088 1.1 christos internal_function_fn handler,
1089 1.1 christos void *cookie);
1090 1.1 christos
1091 1.1 christos struct value *call_internal_function (struct gdbarch *gdbarch,
1092 1.1 christos const struct language_defn *language,
1093 1.1 christos struct value *function,
1094 1.1 christos int argc, struct value **argv);
1095 1.1 christos
1096 1.1 christos char *value_internal_function_name (struct value *);
1097 1.1.1.2 christos
1098 1.1.1.2 christos extern struct value *value_of_xmethod (struct xmethod_worker *);
1099 1.1.1.2 christos
1100 1.1.1.2 christos extern struct type *result_type_of_xmethod (struct value *method,
1101 1.1.1.2 christos int argc, struct value **argv);
1102 1.1.1.2 christos
1103 1.1.1.2 christos extern struct value *call_xmethod (struct value *method,
1104 1.1.1.2 christos int argc, struct value **argv);
1105 1.1 christos
1106 #endif /* !defined (VALUE_H) */
1107