1 /* Definitions for values of C expressions, for GDB.
3 Copyright (C) 1986-2023 Free Software Foundation, Inc.
5 This file is part of GDB.
7 This program is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3 of the License, or
10 (at your option) any later version.
12 This program is distributed in the hope that it will be useful,
13 but WITHOUT ANY WARRANTY; without even the implied warranty of
14 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 GNU General Public License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program. If not, see <http://www.gnu.org/licenses/>. */
20 #if !defined (VALUE_H)
23 #include "frame.h" /* For struct frame_id. */
24 #include "extension.h"
25 #include "gdbsupport/gdb_ref_ptr.h"
26 #include "gmp-utils.h"
35 struct value_print_options
;
37 /* Values can be partially 'optimized out' and/or 'unavailable'.
38 These are distinct states and have different string representations
39 and related error strings.
41 'unavailable' has a specific meaning in this context. It means the
42 value exists in the program (at the machine level), but GDB has no
43 means to get to it. Such a value is normally printed as
44 <unavailable>. Examples of how to end up with an unavailable value
47 - We're inspecting a traceframe, and the memory or registers the
48 debug information says the value lives on haven't been collected.
50 - We're inspecting a core dump, the memory or registers the debug
51 information says the value lives aren't present in the dump
52 (that is, we have a partial/trimmed core dump, or we don't fully
53 understand/handle the core dump's format).
55 - We're doing live debugging, but the debug API has no means to
56 get at where the value lives in the machine, like e.g., ptrace
57 not having access to some register or register set.
59 - Any other similar scenario.
61 OTOH, "optimized out" is about what the compiler decided to generate
62 (or not generate). A chunk of a value that was optimized out does
63 not actually exist in the program. There's no way to get at it
64 short of compiling the program differently.
66 A register that has not been saved in a frame is likewise considered
67 optimized out, except not-saved registers have a different string
68 representation and related error strings. E.g., we'll print them as
69 <not-saved> instead of <optimized out>, as in:
73 (gdb) info registers rax
76 If the debug info describes a variable as being in such a register,
77 we'll still print the variable as <optimized out>. IOW, <not saved>
78 is reserved for inspecting registers at the machine level.
80 When comparing value contents, optimized out chunks, unavailable
81 chunks, and valid contents data are all considered different. See
82 value_contents_eq for more info.
85 extern bool overload_resolution
;
87 /* Defines an [OFFSET, OFFSET + LENGTH) range. */
91 /* Lowest offset in the range. */
94 /* Length of the range. */
97 /* Returns true if THIS is strictly less than OTHER, useful for
98 searching. We keep ranges sorted by offset and coalesce
99 overlapping and contiguous ranges, so this just compares the
102 bool operator< (const range
&other
) const
104 return offset
< other
.offset
;
107 /* Returns true if THIS is equal to OTHER. */
108 bool operator== (const range
&other
) const
110 return offset
== other
.offset
&& length
== other
.length
;
114 /* Increase VAL's reference count. */
116 extern void value_incref (struct value
*val
);
118 /* Decrease VAL's reference count. When the reference count drops to
119 0, VAL will be freed. */
121 extern void value_decref (struct value
*val
);
123 /* A policy class to interface gdb::ref_ptr with struct value. */
125 struct value_ref_policy
127 static void incref (struct value
*ptr
)
132 static void decref (struct value
*ptr
)
138 /* A gdb:;ref_ptr pointer to a struct value. */
140 typedef gdb::ref_ptr
<struct value
, value_ref_policy
> value_ref_ptr
;
142 /* Note that the fields in this structure are arranged to save a bit
147 explicit value (struct type
*type_
)
153 m_in_history (false),
155 m_enclosing_type (type_
)
161 DISABLE_COPY_AND_ASSIGN (value
);
163 /* Type of the value. */
164 struct type
*type () const
167 /* This is being used to change the type of an existing value, that
168 code should instead be creating a new value with the changed type
169 (but possibly shared content). */
170 void deprecated_set_type (struct type
*type
)
173 /* Return the gdbarch associated with the value. */
174 struct gdbarch
*arch () const;
176 /* Only used for bitfields; number of bits contained in them. */
177 LONGEST
bitsize () const
178 { return m_bitsize
; }
180 void set_bitsize (LONGEST bit
)
184 /* Type of value; either not an lval, or one of the various
185 different possible kinds of lval. */
186 enum lval_type m_lval
= not_lval
;
188 /* Is it modifiable? Only relevant if lval != not_lval. */
189 unsigned int m_modifiable
: 1;
191 /* If zero, contents of this value are in the contents field. If
192 nonzero, contents are in inferior. If the lval field is lval_memory,
193 the contents are in inferior memory at location.address plus offset.
194 The lval field may also be lval_register.
196 WARNING: This field is used by the code which handles watchpoints
197 (see breakpoint.c) to decide whether a particular value can be
198 watched by hardware watchpoints. If the lazy flag is set for
199 some member of a value chain, it is assumed that this member of
200 the chain doesn't need to be watched as part of watching the
201 value itself. This is how GDB avoids watching the entire struct
202 or array when the user wants to watch a single struct member or
203 array element. If you ever change the way lazy flag is set and
204 reset, be sure to consider this use as well! */
205 unsigned int m_lazy
: 1;
207 /* If value is a variable, is it initialized or not. */
208 unsigned int m_initialized
: 1;
210 /* If value is from the stack. If this is set, read_stack will be
211 used instead of read_memory to enable extra caching. */
212 unsigned int m_stack
: 1;
214 /* True if this is a zero value, created by 'value_zero'; false
218 /* True if this a value recorded in value history; false otherwise. */
219 bool m_in_history
: 1;
221 /* Location of value (if lval). */
224 /* If lval == lval_memory, this is the address in the inferior */
227 /*If lval == lval_register, the value is from a register. */
230 /* Register number. */
232 /* Frame ID of "next" frame to which a register value is relative.
233 If the register value is found relative to frame F, then the
234 frame id of F->next will be stored in next_frame_id. */
235 struct frame_id next_frame_id
;
238 /* Pointer to internal variable. */
239 struct internalvar
*internalvar
;
241 /* Pointer to xmethod worker. */
242 struct xmethod_worker
*xm_worker
;
244 /* If lval == lval_computed, this is a set of function pointers
245 to use to access and describe the value, and a closure pointer
249 /* Functions to call. */
250 const struct lval_funcs
*funcs
;
252 /* Closure for those functions to use. */
257 /* Describes offset of a value within lval of a structure in target
258 addressable memory units. Note also the member embedded_offset
260 LONGEST m_offset
= 0;
262 /* Only used for bitfields; number of bits contained in them. */
263 LONGEST m_bitsize
= 0;
265 /* Only used for bitfields; position of start of field. For
266 little-endian targets, it is the position of the LSB. For
267 big-endian targets, it is the position of the MSB. */
268 LONGEST m_bitpos
= 0;
270 /* The number of references to this value. When a value is created,
271 the value chain holds a reference, so REFERENCE_COUNT is 1. If
272 release_value is called, this value is removed from the chain but
273 the caller of release_value now has a reference to this value.
274 The caller must arrange for a call to value_free later. */
275 int m_reference_count
= 1;
277 /* Only used for bitfields; the containing value. This allows a
278 single read from the target when displaying multiple
280 value_ref_ptr m_parent
;
282 /* Type of the value. */
285 /* If a value represents a C++ object, then the `type' field gives
286 the object's compile-time type. If the object actually belongs
287 to some class derived from `type', perhaps with other base
288 classes and additional members, then `type' is just a subobject
289 of the real thing, and the full object is probably larger than
290 `type' would suggest.
292 If `type' is a dynamic class (i.e. one with a vtable), then GDB
293 can actually determine the object's run-time type by looking at
294 the run-time type information in the vtable. When this
295 information is available, we may elect to read in the entire
296 object, for several reasons:
298 - When printing the value, the user would probably rather see the
299 full object, not just the limited portion apparent from the
302 - If `type' has virtual base classes, then even printing `type'
303 alone may require reaching outside the `type' portion of the
304 object to wherever the virtual base class has been stored.
306 When we store the entire object, `enclosing_type' is the run-time
307 type -- the complete object -- and `embedded_offset' is the
308 offset of `type' within that larger type, in target addressable memory
309 units. The value_contents() macro takes `embedded_offset' into account,
310 so most GDB code continues to see the `type' portion of the value, just
311 as the inferior would.
313 If `type' is a pointer to an object, then `enclosing_type' is a
314 pointer to the object's run-time type, and `pointed_to_offset' is
315 the offset in target addressable memory units from the full object
316 to the pointed-to object -- that is, the value `embedded_offset' would
317 have if we followed the pointer and fetched the complete object.
318 (I don't really see the point. Why not just determine the
319 run-time type when you indirect, and avoid the special case? The
320 contents don't matter until you indirect anyway.)
322 If we're not doing anything fancy, `enclosing_type' is equal to
323 `type', and `embedded_offset' is zero, so everything works
325 struct type
*m_enclosing_type
;
326 LONGEST m_embedded_offset
= 0;
327 LONGEST m_pointed_to_offset
= 0;
329 /* Actual contents of the value. Target byte-order.
331 May be nullptr if the value is lazy or is entirely optimized out.
332 Guaranteed to be non-nullptr otherwise. */
333 gdb::unique_xmalloc_ptr
<gdb_byte
> m_contents
;
335 /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
336 rather than available, since the common and default case is for a
337 value to be available. This is filled in at value read time.
338 The unavailable ranges are tracked in bits. Note that a contents
339 bit that has been optimized out doesn't really exist in the
340 program, so it can't be marked unavailable either. */
341 std::vector
<range
> m_unavailable
;
343 /* Likewise, but for optimized out contents (a chunk of the value of
344 a variable that does not actually exist in the program). If LVAL
345 is lval_register, this is a register ($pc, $sp, etc., never a
346 program variable) that has not been saved in the frame. Not
347 saved registers and optimized-out program variables values are
348 treated pretty much the same, except not-saved registers have a
349 different string representation and related error strings. */
350 std::vector
<range
> m_optimized_out
;
352 /* This is only non-zero for values of TYPE_CODE_ARRAY and if the size of
353 the array in inferior memory is greater than max_value_size. If these
354 conditions are met then, when the value is loaded from the inferior
355 GDB will only load a portion of the array into memory, and
356 limited_length will be set to indicate the length in octets that were
357 loaded from the inferior. */
358 ULONGEST m_limited_length
= 0;
361 /* Only used for bitfields; position of start of field. For
362 little-endian targets, it is the position of the LSB. For
363 big-endian targets, it is the position of the MSB. */
365 extern LONGEST
value_bitpos (const struct value
*);
366 extern void set_value_bitpos (struct value
*, LONGEST bit
);
368 /* Only used for bitfields; the containing value. This allows a
369 single read from the target when displaying multiple
372 struct value
*value_parent (const struct value
*);
373 extern void set_value_parent (struct value
*value
, struct value
*parent
);
375 /* Describes offset of a value within lval of a structure in bytes.
376 If lval == lval_memory, this is an offset to the address. If lval
377 == lval_register, this is a further offset from location.address
378 within the registers structure. Note also the member
379 embedded_offset below. */
381 extern LONGEST
value_offset (const struct value
*);
382 extern void set_value_offset (struct value
*, LONGEST offset
);
384 /* The comment from "struct value" reads: ``Is it modifiable? Only
385 relevant if lval != not_lval.''. Shouldn't the value instead be
386 not_lval and be done with it? */
388 extern int deprecated_value_modifiable (const struct value
*value
);
390 /* If a value represents a C++ object, then the `type' field gives the
391 object's compile-time type. If the object actually belongs to some
392 class derived from `type', perhaps with other base classes and
393 additional members, then `type' is just a subobject of the real
394 thing, and the full object is probably larger than `type' would
397 If `type' is a dynamic class (i.e. one with a vtable), then GDB can
398 actually determine the object's run-time type by looking at the
399 run-time type information in the vtable. When this information is
400 available, we may elect to read in the entire object, for several
403 - When printing the value, the user would probably rather see the
404 full object, not just the limited portion apparent from the
407 - If `type' has virtual base classes, then even printing `type'
408 alone may require reaching outside the `type' portion of the
409 object to wherever the virtual base class has been stored.
411 When we store the entire object, `enclosing_type' is the run-time
412 type -- the complete object -- and `embedded_offset' is the offset
413 of `type' within that larger type, in bytes. The value_contents()
414 macro takes `embedded_offset' into account, so most GDB code
415 continues to see the `type' portion of the value, just as the
418 If `type' is a pointer to an object, then `enclosing_type' is a
419 pointer to the object's run-time type, and `pointed_to_offset' is
420 the offset in bytes from the full object to the pointed-to object
421 -- that is, the value `embedded_offset' would have if we followed
422 the pointer and fetched the complete object. (I don't really see
423 the point. Why not just determine the run-time type when you
424 indirect, and avoid the special case? The contents don't matter
425 until you indirect anyway.)
427 If we're not doing anything fancy, `enclosing_type' is equal to
428 `type', and `embedded_offset' is zero, so everything works
431 extern struct type
*value_enclosing_type (const struct value
*);
432 extern void set_value_enclosing_type (struct value
*val
,
433 struct type
*new_type
);
435 /* Returns value_type or value_enclosing_type depending on
436 value_print_options.objectprint.
438 If RESOLVE_SIMPLE_TYPES is 0 the enclosing type will be resolved
439 only for pointers and references, else it will be returned
440 for all the types (e.g. structures). This option is useful
441 to prevent retrieving enclosing type for the base classes fields.
443 REAL_TYPE_FOUND is used to inform whether the real type was found
444 (or just static type was used). The NULL may be passed if it is not
447 extern struct type
*value_actual_type (struct value
*value
,
448 int resolve_simple_types
,
449 int *real_type_found
);
451 extern LONGEST
value_pointed_to_offset (const struct value
*value
);
452 extern void set_value_pointed_to_offset (struct value
*value
, LONGEST val
);
453 extern LONGEST
value_embedded_offset (const struct value
*value
);
454 extern void set_value_embedded_offset (struct value
*value
, LONGEST val
);
456 /* For lval_computed values, this structure holds functions used to
457 retrieve and set the value (or portions of the value).
459 For each function, 'V' is the 'this' pointer: an lval_funcs
460 function F may always assume that the V it receives is an
461 lval_computed value, and has F in the appropriate slot of its
462 lval_funcs structure. */
466 /* Fill in VALUE's contents. This is used to "un-lazy" values. If
467 a problem arises in obtaining VALUE's bits, this function should
468 call 'error'. If it is NULL value_fetch_lazy on "un-lazy"
469 non-optimized-out value is an internal error. */
470 void (*read
) (struct value
*v
);
472 /* Handle an assignment TOVAL = FROMVAL by writing the value of
473 FROMVAL to TOVAL's location. The contents of TOVAL have not yet
474 been updated. If a problem arises in doing so, this function
475 should call 'error'. If it is NULL such TOVAL assignment is an error as
476 TOVAL is not considered as an lvalue. */
477 void (*write
) (struct value
*toval
, struct value
*fromval
);
479 /* Return true if any part of V is optimized out, false otherwise.
480 This will only be called for lazy values -- if the value has been
481 fetched, then the value's optimized-out bits are consulted
483 bool (*is_optimized_out
) (struct value
*v
);
485 /* If non-NULL, this is used to implement pointer indirection for
486 this value. This method may return NULL, in which case value_ind
487 will fall back to ordinary indirection. */
488 struct value
*(*indirect
) (struct value
*value
);
490 /* If non-NULL, this is used to implement reference resolving for
491 this value. This method may return NULL, in which case coerce_ref
492 will fall back to ordinary references resolving. */
493 struct value
*(*coerce_ref
) (const struct value
*value
);
495 /* If non-NULL, this is used to determine whether the indicated bits
496 of VALUE are a synthetic pointer. */
497 int (*check_synthetic_pointer
) (const struct value
*value
,
498 LONGEST offset
, int length
);
500 /* Return a duplicate of VALUE's closure, for use in a new value.
501 This may simply return the same closure, if VALUE's is
502 reference-counted or statically allocated.
504 This may be NULL, in which case VALUE's closure is re-used in the
506 void *(*copy_closure
) (const struct value
*v
);
508 /* Drop VALUE's reference to its closure. Maybe this frees the
509 closure; maybe this decrements a reference count; maybe the
510 closure is statically allocated and this does nothing.
512 This may be NULL, in which case no action is taken to free
514 void (*free_closure
) (struct value
*v
);
517 /* Create a computed lvalue, with type TYPE, function pointers FUNCS,
518 and closure CLOSURE. */
520 extern struct value
*allocate_computed_value (struct type
*type
,
521 const struct lval_funcs
*funcs
,
524 extern struct value
*allocate_optimized_out_value (struct type
*type
);
526 /* If VALUE is lval_computed, return its lval_funcs structure. */
528 extern const struct lval_funcs
*value_computed_funcs (const struct value
*);
530 /* If VALUE is lval_computed, return its closure. The meaning of the
531 returned value depends on the functions VALUE uses. */
533 extern void *value_computed_closure (const struct value
*value
);
535 /* If zero, contents of this value are in the contents field. If
536 nonzero, contents are in inferior. If the lval field is lval_memory,
537 the contents are in inferior memory at location.address plus offset.
538 The lval field may also be lval_register.
540 WARNING: This field is used by the code which handles watchpoints
541 (see breakpoint.c) to decide whether a particular value can be
542 watched by hardware watchpoints. If the lazy flag is set for some
543 member of a value chain, it is assumed that this member of the
544 chain doesn't need to be watched as part of watching the value
545 itself. This is how GDB avoids watching the entire struct or array
546 when the user wants to watch a single struct member or array
547 element. If you ever change the way lazy flag is set and reset, be
548 sure to consider this use as well! */
550 extern int value_lazy (const struct value
*);
551 extern void set_value_lazy (struct value
*value
, int val
);
553 extern int value_stack (const struct value
*);
554 extern void set_value_stack (struct value
*value
, int val
);
556 /* Throw an error complaining that the value has been optimized
559 extern void error_value_optimized_out (void);
561 /* value_contents() and value_contents_raw() both return the address
562 of the gdb buffer used to hold a copy of the contents of the lval.
563 value_contents() is used when the contents of the buffer are needed
564 -- it uses value_fetch_lazy() to load the buffer from the process
565 being debugged if it hasn't already been loaded
566 (value_contents_writeable() is used when a writeable but fetched
567 buffer is required).. value_contents_raw() is used when data is
568 being stored into the buffer, or when it is certain that the
569 contents of the buffer are valid.
571 Note: The contents pointer is adjusted by the offset required to
572 get to the real subobject, if the value happens to represent
573 something embedded in a larger run-time object. */
575 extern gdb::array_view
<gdb_byte
> value_contents_raw (struct value
*);
577 /* Actual contents of the value. For use of this value; setting it
578 uses the stuff above. Not valid if lazy is nonzero. Target
579 byte-order. We force it to be aligned properly for any possible
580 value. Note that a value therefore extends beyond what is
583 extern gdb::array_view
<const gdb_byte
> value_contents (struct value
*);
584 extern gdb::array_view
<gdb_byte
> value_contents_writeable (struct value
*);
586 /* The ALL variants of the above two macros do not adjust the returned
587 pointer by the embedded_offset value. */
589 extern gdb::array_view
<gdb_byte
> value_contents_all_raw (struct value
*);
590 extern gdb::array_view
<const gdb_byte
> value_contents_all (struct value
*);
592 /* Like value_contents_all, but does not require that the returned
593 bits be valid. This should only be used in situations where you
594 plan to check the validity manually. */
595 extern gdb::array_view
<const gdb_byte
> value_contents_for_printing (struct value
*value
);
597 /* Like value_contents_for_printing, but accepts a constant value
598 pointer. Unlike value_contents_for_printing however, the pointed
599 value must _not_ be lazy. */
600 extern gdb::array_view
<const gdb_byte
>
601 value_contents_for_printing_const (const struct value
*value
);
603 extern void value_fetch_lazy (struct value
*val
);
605 /* If nonzero, this is the value of a variable which does not actually
606 exist in the program, at least partially. If the value is lazy,
607 this may fetch it now. */
608 extern int value_optimized_out (struct value
*value
);
610 /* Given a value, return true if any of the contents bits starting at
611 OFFSET and extending for LENGTH bits is optimized out, false
614 extern int value_bits_any_optimized_out (const struct value
*value
,
615 int bit_offset
, int bit_length
);
617 /* Like value_optimized_out, but return true iff the whole value is
619 extern int value_entirely_optimized_out (struct value
*value
);
621 /* Mark VALUE's content bytes starting at OFFSET and extending for
622 LENGTH bytes as optimized out. */
624 extern void mark_value_bytes_optimized_out (struct value
*value
,
625 int offset
, int length
);
627 /* Mark VALUE's content bits starting at OFFSET and extending for
628 LENGTH bits as optimized out. */
630 extern void mark_value_bits_optimized_out (struct value
*value
,
631 LONGEST offset
, LONGEST length
);
633 /* Set or return field indicating whether a variable is initialized or
634 not, based on debugging information supplied by the compiler.
635 1 = initialized; 0 = uninitialized. */
636 extern int value_initialized (const struct value
*);
637 extern void set_value_initialized (struct value
*, int);
639 /* Set COMPONENT's location as appropriate for a component of WHOLE
640 --- regardless of what kind of lvalue WHOLE is. */
641 extern void set_value_component_location (struct value
*component
,
642 const struct value
*whole
);
644 /* While the following fields are per- VALUE .CONTENT .PIECE (i.e., a
645 single value might have multiple LVALs), this hacked interface is
646 limited to just the first PIECE. Expect further change. */
647 /* Type of value; either not an lval, or one of the various different
648 possible kinds of lval. */
649 extern enum lval_type
*deprecated_value_lval_hack (struct value
*);
650 #define VALUE_LVAL(val) (*deprecated_value_lval_hack (val))
652 /* Like VALUE_LVAL, except the parameter can be const. */
653 extern enum lval_type
value_lval_const (const struct value
*value
);
655 /* If lval == lval_memory, return the address in the inferior. If
656 lval == lval_register, return the byte offset into the registers
657 structure. Otherwise, return 0. The returned address
658 includes the offset, if any. */
659 extern CORE_ADDR
value_address (const struct value
*);
661 /* Like value_address, except the result does not include value's
663 extern CORE_ADDR
value_raw_address (const struct value
*);
665 /* Set the address of a value. */
666 extern void set_value_address (struct value
*, CORE_ADDR
);
668 /* Pointer to internal variable. */
669 extern struct internalvar
**deprecated_value_internalvar_hack (struct value
*);
670 #define VALUE_INTERNALVAR(val) (*deprecated_value_internalvar_hack (val))
672 /* Frame ID of "next" frame to which a register value is relative. A
673 register value is indicated by VALUE_LVAL being set to lval_register.
674 So, if the register value is found relative to frame F, then the
675 frame id of F->next will be stored in VALUE_NEXT_FRAME_ID. */
676 extern struct frame_id
*deprecated_value_next_frame_id_hack (struct value
*);
677 #define VALUE_NEXT_FRAME_ID(val) (*deprecated_value_next_frame_id_hack (val))
679 /* Register number if the value is from a register. */
680 extern int *deprecated_value_regnum_hack (struct value
*);
681 #define VALUE_REGNUM(val) (*deprecated_value_regnum_hack (val))
683 /* Return value after lval_funcs->coerce_ref (after check_typedef). Return
684 NULL if lval_funcs->coerce_ref is not applicable for whatever reason. */
686 extern struct value
*coerce_ref_if_computed (const struct value
*arg
);
688 /* Setup a new value type and enclosing value type for dereferenced value VALUE.
689 ENC_TYPE is the new enclosing type that should be set. ORIGINAL_TYPE and
690 ORIGINAL_VAL are the type and value of the original reference or
691 pointer. ORIGINAL_VALUE_ADDRESS is the address within VALUE, that is
692 the address that was dereferenced.
694 Note, that VALUE is modified by this function.
696 It is a common implementation for coerce_ref and value_ind. */
698 extern struct value
* readjust_indirect_value_type (struct value
*value
,
699 struct type
*enc_type
,
700 const struct type
*original_type
,
701 struct value
*original_val
,
702 CORE_ADDR original_value_address
);
704 /* Convert a REF to the object referenced. */
706 extern struct value
*coerce_ref (struct value
*value
);
708 /* If ARG is an array, convert it to a pointer.
709 If ARG is a function, convert it to a function pointer.
711 References are dereferenced. */
713 extern struct value
*coerce_array (struct value
*value
);
715 /* Given a value, determine whether the bits starting at OFFSET and
716 extending for LENGTH bits are a synthetic pointer. */
718 extern int value_bits_synthetic_pointer (const struct value
*value
,
719 LONGEST offset
, LONGEST length
);
721 /* Given a value, determine whether the contents bytes starting at
722 OFFSET and extending for LENGTH bytes are available. This returns
723 nonzero if all bytes in the given range are available, zero if any
724 byte is unavailable. */
726 extern int value_bytes_available (const struct value
*value
,
727 LONGEST offset
, ULONGEST length
);
729 /* Given a value, determine whether the contents bits starting at
730 OFFSET and extending for LENGTH bits are available. This returns
731 nonzero if all bits in the given range are available, zero if any
732 bit is unavailable. */
734 extern int value_bits_available (const struct value
*value
,
735 LONGEST offset
, ULONGEST length
);
737 /* Like value_bytes_available, but return false if any byte in the
738 whole object is unavailable. */
739 extern int value_entirely_available (struct value
*value
);
741 /* Like value_entirely_available, but return false if any byte in the
742 whole object is available. */
743 extern int value_entirely_unavailable (struct value
*value
);
745 /* Mark VALUE's content bytes starting at OFFSET and extending for
746 LENGTH bytes as unavailable. */
748 extern void mark_value_bytes_unavailable (struct value
*value
,
749 LONGEST offset
, ULONGEST length
);
751 /* Mark VALUE's content bits starting at OFFSET and extending for
752 LENGTH bits as unavailable. */
754 extern void mark_value_bits_unavailable (struct value
*value
,
755 LONGEST offset
, ULONGEST length
);
757 /* Compare LENGTH bytes of VAL1's contents starting at OFFSET1 with
758 LENGTH bytes of VAL2's contents starting at OFFSET2.
760 Note that "contents" refers to the whole value's contents
761 (value_contents_all), without any embedded offset adjustment. For
762 example, to compare a complete object value with itself, including
763 its enclosing type chunk, you'd do:
765 int len = check_typedef (value_enclosing_type (val))->length ();
766 value_contents_eq (val, 0, val, 0, len);
768 Returns true iff the set of available/valid contents match.
770 Optimized-out contents are equal to optimized-out contents, and are
771 not equal to non-optimized-out contents.
773 Unavailable contents are equal to unavailable contents, and are not
774 equal to non-unavailable contents.
776 For example, if 'x's represent an unavailable byte, and 'V' and 'Z'
777 represent different available/valid bytes, in a value with length
781 contents: xxxxVVVVxxxxVVZZ
785 value_contents_eq(val, 0, val, 8, 6) => true
786 value_contents_eq(val, 0, val, 4, 4) => false
787 value_contents_eq(val, 0, val, 8, 8) => false
788 value_contents_eq(val, 4, val, 12, 2) => true
789 value_contents_eq(val, 4, val, 12, 4) => true
790 value_contents_eq(val, 3, val, 4, 4) => true
792 If 'x's represent an unavailable byte, 'o' represents an optimized
793 out byte, in a value with length 8:
800 value_contents_eq(val, 0, val, 2, 2) => true
801 value_contents_eq(val, 4, val, 6, 2) => true
802 value_contents_eq(val, 0, val, 4, 4) => true
804 We only know whether a value chunk is unavailable or optimized out
805 if we've tried to read it. As this routine is used by printing
806 routines, which may be printing values in the value history, long
807 after the inferior is gone, it works with const values. Therefore,
808 this routine must not be called with lazy values. */
810 extern bool value_contents_eq (const struct value
*val1
, LONGEST offset1
,
811 const struct value
*val2
, LONGEST offset2
,
814 /* An overload of value_contents_eq that compares the entirety of both
817 extern bool value_contents_eq (const struct value
*val1
,
818 const struct value
*val2
);
820 /* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
821 which is (or will be copied to) VAL's contents buffer offset by
822 BIT_OFFSET bits. Marks value contents ranges as unavailable if
823 the corresponding memory is likewise unavailable. STACK indicates
824 whether the memory is known to be stack memory. */
826 extern void read_value_memory (struct value
*val
, LONGEST bit_offset
,
827 int stack
, CORE_ADDR memaddr
,
828 gdb_byte
*buffer
, size_t length
);
830 /* Cast SCALAR_VALUE to the element type of VECTOR_TYPE, then replicate
831 into each element of a new vector value with VECTOR_TYPE. */
833 struct value
*value_vector_widen (struct value
*scalar_value
,
834 struct type
*vector_type
);
839 #include "gdbtypes.h"
840 #include "expression.h"
842 class frame_info_ptr
;
845 extern int print_address_demangle (const struct value_print_options
*,
846 struct gdbarch
*, CORE_ADDR
,
847 struct ui_file
*, int);
849 /* Returns true if VAL is of floating-point type. In addition,
850 throws an error if the value is an invalid floating-point value. */
851 extern bool is_floating_value (struct value
*val
);
853 extern LONGEST
value_as_long (struct value
*val
);
854 extern CORE_ADDR
value_as_address (struct value
*val
);
856 extern LONGEST
unpack_long (struct type
*type
, const gdb_byte
*valaddr
);
857 extern CORE_ADDR
unpack_pointer (struct type
*type
, const gdb_byte
*valaddr
);
859 extern LONGEST
unpack_field_as_long (struct type
*type
,
860 const gdb_byte
*valaddr
,
863 /* Unpack a bitfield of the specified FIELD_TYPE, from the object at
864 VALADDR, and store the result in *RESULT.
865 The bitfield starts at BITPOS bits and contains BITSIZE bits; if
866 BITSIZE is zero, then the length is taken from FIELD_TYPE.
868 Extracting bits depends on endianness of the machine. Compute the
869 number of least significant bits to discard. For big endian machines,
870 we compute the total number of bits in the anonymous object, subtract
871 off the bit count from the MSB of the object to the MSB of the
872 bitfield, then the size of the bitfield, which leaves the LSB discard
873 count. For little endian machines, the discard count is simply the
874 number of bits from the LSB of the anonymous object to the LSB of the
877 If the field is signed, we also do sign extension. */
879 extern LONGEST
unpack_bits_as_long (struct type
*field_type
,
880 const gdb_byte
*valaddr
,
881 LONGEST bitpos
, LONGEST bitsize
);
883 extern int unpack_value_field_as_long (struct type
*type
, const gdb_byte
*valaddr
,
884 LONGEST embedded_offset
, int fieldno
,
885 const struct value
*val
, LONGEST
*result
);
887 extern void unpack_value_bitfield (struct value
*dest_val
,
888 LONGEST bitpos
, LONGEST bitsize
,
889 const gdb_byte
*valaddr
,
890 LONGEST embedded_offset
,
891 const struct value
*val
);
893 extern struct value
*value_field_bitfield (struct type
*type
, int fieldno
,
894 const gdb_byte
*valaddr
,
895 LONGEST embedded_offset
,
896 const struct value
*val
);
898 extern void pack_long (gdb_byte
*buf
, struct type
*type
, LONGEST num
);
900 extern struct value
*value_from_longest (struct type
*type
, LONGEST num
);
901 extern struct value
*value_from_ulongest (struct type
*type
, ULONGEST num
);
902 extern struct value
*value_from_pointer (struct type
*type
, CORE_ADDR addr
);
903 extern struct value
*value_from_host_double (struct type
*type
, double d
);
904 extern struct value
*value_from_history_ref (const char *, const char **);
905 extern struct value
*value_from_component (struct value
*, struct type
*,
909 /* Create a new value by extracting it from WHOLE. TYPE is the type
910 of the new value. BIT_OFFSET and BIT_LENGTH describe the offset
911 and field width of the value to extract from WHOLE -- BIT_LENGTH
912 may differ from TYPE's length in the case where WHOLE's type is
915 When the value does come from a non-byte-aligned offset or field
916 width, it will be marked non_lval. */
918 extern struct value
*value_from_component_bitsize (struct value
*whole
,
923 extern struct value
*value_at (struct type
*type
, CORE_ADDR addr
);
924 extern struct value
*value_at_lazy (struct type
*type
, CORE_ADDR addr
);
926 /* Like value_at, but ensures that the result is marked not_lval.
927 This can be important if the memory is "volatile". */
928 extern struct value
*value_at_non_lval (struct type
*type
, CORE_ADDR addr
);
930 extern struct value
*value_from_contents_and_address_unresolved
931 (struct type
*, const gdb_byte
*, CORE_ADDR
);
932 extern struct value
*value_from_contents_and_address (struct type
*,
935 extern struct value
*value_from_contents (struct type
*, const gdb_byte
*);
937 extern struct value
*default_value_from_register (struct gdbarch
*gdbarch
,
940 struct frame_id frame_id
);
942 extern void read_frame_register_value (struct value
*value
,
943 frame_info_ptr frame
);
945 extern struct value
*value_from_register (struct type
*type
, int regnum
,
946 frame_info_ptr frame
);
948 extern CORE_ADDR
address_from_register (int regnum
,
949 frame_info_ptr frame
);
951 extern struct value
*value_of_variable (struct symbol
*var
,
952 const struct block
*b
);
954 extern struct value
*address_of_variable (struct symbol
*var
,
955 const struct block
*b
);
957 extern struct value
*value_of_register (int regnum
, frame_info_ptr frame
);
959 struct value
*value_of_register_lazy (frame_info_ptr frame
, int regnum
);
961 /* Return the symbol's reading requirement. */
963 extern enum symbol_needs_kind
symbol_read_needs (struct symbol
*);
965 /* Return true if the symbol needs a frame. This is a wrapper for
966 symbol_read_needs that simply checks for SYMBOL_NEEDS_FRAME. */
968 extern int symbol_read_needs_frame (struct symbol
*);
970 extern struct value
*read_var_value (struct symbol
*var
,
971 const struct block
*var_block
,
972 frame_info_ptr frame
);
974 extern struct value
*allocate_value (struct type
*type
);
975 extern struct value
*allocate_value_lazy (struct type
*type
);
976 extern void value_contents_copy (struct value
*dst
, LONGEST dst_offset
,
977 struct value
*src
, LONGEST src_offset
,
980 extern struct value
*allocate_repeat_value (struct type
*type
, int count
);
982 extern struct value
*value_mark (void);
984 extern void value_free_to_mark (const struct value
*mark
);
986 /* A helper class that uses value_mark at construction time and calls
987 value_free_to_mark in the destructor. This is used to clear out
988 temporary values created during the lifetime of this object. */
989 class scoped_value_mark
994 : m_value (value_mark ())
998 ~scoped_value_mark ()
1003 scoped_value_mark (scoped_value_mark
&&other
) = default;
1005 DISABLE_COPY_AND_ASSIGN (scoped_value_mark
);
1007 /* Free the values currently on the value stack. */
1008 void free_to_mark ()
1010 if (m_value
!= NULL
)
1012 value_free_to_mark (m_value
);
1019 const struct value
*m_value
;
1022 extern struct value
*value_cstring (const char *ptr
, ssize_t len
,
1023 struct type
*char_type
);
1024 extern struct value
*value_string (const char *ptr
, ssize_t len
,
1025 struct type
*char_type
);
1027 extern struct value
*value_array (int lowbound
, int highbound
,
1028 struct value
**elemvec
);
1030 extern struct value
*value_concat (struct value
*arg1
, struct value
*arg2
);
1032 extern struct value
*value_binop (struct value
*arg1
, struct value
*arg2
,
1033 enum exp_opcode op
);
1035 extern struct value
*value_ptradd (struct value
*arg1
, LONGEST arg2
);
1037 extern LONGEST
value_ptrdiff (struct value
*arg1
, struct value
*arg2
);
1039 /* Return true if VAL does not live in target memory, but should in order
1040 to operate on it. Otherwise return false. */
1042 extern bool value_must_coerce_to_target (struct value
*arg1
);
1044 extern struct value
*value_coerce_to_target (struct value
*arg1
);
1046 extern struct value
*value_coerce_array (struct value
*arg1
);
1048 extern struct value
*value_coerce_function (struct value
*arg1
);
1050 extern struct value
*value_ind (struct value
*arg1
);
1052 extern struct value
*value_addr (struct value
*arg1
);
1054 extern struct value
*value_ref (struct value
*arg1
, enum type_code refcode
);
1056 extern struct value
*value_assign (struct value
*toval
,
1057 struct value
*fromval
);
1059 extern struct value
*value_pos (struct value
*arg1
);
1061 extern struct value
*value_neg (struct value
*arg1
);
1063 extern struct value
*value_complement (struct value
*arg1
);
1065 extern struct value
*value_struct_elt (struct value
**argp
,
1066 gdb::optional
<gdb::array_view
<value
*>> args
,
1067 const char *name
, int *static_memfuncp
,
1070 extern struct value
*value_struct_elt_bitpos (struct value
**argp
,
1072 struct type
*field_type
,
1075 extern struct value
*value_aggregate_elt (struct type
*curtype
,
1077 struct type
*expect_type
,
1079 enum noside noside
);
1081 extern struct value
*value_static_field (struct type
*type
, int fieldno
);
1083 enum oload_search_type
{ NON_METHOD
, METHOD
, BOTH
};
1085 extern int find_overload_match (gdb::array_view
<value
*> args
,
1087 enum oload_search_type method
,
1088 struct value
**objp
, struct symbol
*fsym
,
1089 struct value
**valp
, struct symbol
**symp
,
1090 int *staticp
, const int no_adl
,
1091 enum noside noside
);
1093 extern struct value
*value_field (struct value
*arg1
, int fieldno
);
1095 extern struct value
*value_primitive_field (struct value
*arg1
, LONGEST offset
,
1097 struct type
*arg_type
);
1100 extern struct type
*value_rtti_indirect_type (struct value
*, int *, LONGEST
*,
1103 extern struct value
*value_full_object (struct value
*, struct type
*, int,
1106 extern struct value
*value_cast_pointers (struct type
*, struct value
*, int);
1108 extern struct value
*value_cast (struct type
*type
, struct value
*arg2
);
1110 extern struct value
*value_reinterpret_cast (struct type
*type
,
1113 extern struct value
*value_dynamic_cast (struct type
*type
, struct value
*arg
);
1115 extern struct value
*value_zero (struct type
*type
, enum lval_type lv
);
1117 extern struct value
*value_one (struct type
*type
);
1119 extern struct value
*value_repeat (struct value
*arg1
, int count
);
1121 extern struct value
*value_subscript (struct value
*array
, LONGEST index
);
1123 extern struct value
*value_bitstring_subscript (struct type
*type
,
1124 struct value
*bitstring
,
1127 extern struct value
*register_value_being_returned (struct type
*valtype
,
1128 struct regcache
*retbuf
);
1130 extern int value_in (struct value
*element
, struct value
*set
);
1132 extern int value_bit_index (struct type
*type
, const gdb_byte
*addr
,
1135 extern enum return_value_convention
1136 struct_return_convention (struct gdbarch
*gdbarch
, struct value
*function
,
1137 struct type
*value_type
);
1139 extern int using_struct_return (struct gdbarch
*gdbarch
,
1140 struct value
*function
,
1141 struct type
*value_type
);
1143 /* Evaluate the expression EXP. If set, EXPECT_TYPE is passed to the
1144 outermost operation's evaluation. This is ignored by most
1145 operations, but may be used, e.g., to determine the type of an
1146 otherwise untyped symbol. The caller should not assume that the
1147 returned value has this type. */
1149 extern struct value
*evaluate_expression (struct expression
*exp
,
1150 struct type
*expect_type
= nullptr);
1152 extern struct value
*evaluate_type (struct expression
*exp
);
1154 extern value
*evaluate_var_value (enum noside noside
, const block
*blk
,
1157 extern value
*evaluate_var_msym_value (enum noside noside
,
1158 struct objfile
*objfile
,
1159 minimal_symbol
*msymbol
);
1161 namespace expr
{ class operation
; };
1162 extern void fetch_subexp_value (struct expression
*exp
,
1163 expr::operation
*op
,
1164 struct value
**valp
, struct value
**resultp
,
1165 std::vector
<value_ref_ptr
> *val_chain
,
1166 bool preserve_errors
);
1168 extern struct value
*parse_and_eval (const char *exp
);
1170 extern struct value
*parse_to_comma_and_eval (const char **expp
);
1172 extern struct type
*parse_and_eval_type (const char *p
, int length
);
1174 extern CORE_ADDR
parse_and_eval_address (const char *exp
);
1176 extern LONGEST
parse_and_eval_long (const char *exp
);
1178 extern void unop_promote (const struct language_defn
*language
,
1179 struct gdbarch
*gdbarch
,
1180 struct value
**arg1
);
1182 extern void binop_promote (const struct language_defn
*language
,
1183 struct gdbarch
*gdbarch
,
1184 struct value
**arg1
, struct value
**arg2
);
1186 extern struct value
*access_value_history (int num
);
1188 /* Return the number of items in the value history. */
1190 extern ULONGEST
value_history_count ();
1192 extern struct value
*value_of_internalvar (struct gdbarch
*gdbarch
,
1193 struct internalvar
*var
);
1195 extern int get_internalvar_integer (struct internalvar
*var
, LONGEST
*l
);
1197 extern void set_internalvar (struct internalvar
*var
, struct value
*val
);
1199 extern void set_internalvar_integer (struct internalvar
*var
, LONGEST l
);
1201 extern void set_internalvar_string (struct internalvar
*var
,
1202 const char *string
);
1204 extern void clear_internalvar (struct internalvar
*var
);
1206 extern void set_internalvar_component (struct internalvar
*var
,
1208 LONGEST bitpos
, LONGEST bitsize
,
1209 struct value
*newvalue
);
1211 extern struct internalvar
*lookup_only_internalvar (const char *name
);
1213 extern struct internalvar
*create_internalvar (const char *name
);
1215 extern void complete_internalvar (completion_tracker
&tracker
,
1218 /* An internalvar can be dynamically computed by supplying a vector of
1219 function pointers to perform various operations. */
1221 struct internalvar_funcs
1223 /* Compute the value of the variable. The DATA argument passed to
1224 the function is the same argument that was passed to
1225 `create_internalvar_type_lazy'. */
1227 struct value
*(*make_value
) (struct gdbarch
*arch
,
1228 struct internalvar
*var
,
1231 /* Update the agent expression EXPR with bytecode to compute the
1232 value. VALUE is the agent value we are updating. The DATA
1233 argument passed to this function is the same argument that was
1234 passed to `create_internalvar_type_lazy'. If this pointer is
1235 NULL, then the internalvar cannot be compiled to an agent
1238 void (*compile_to_ax
) (struct internalvar
*var
,
1239 struct agent_expr
*expr
,
1240 struct axs_value
*value
,
1244 extern struct internalvar
*create_internalvar_type_lazy (const char *name
,
1245 const struct internalvar_funcs
*funcs
,
1248 /* Compile an internal variable to an agent expression. VAR is the
1249 variable to compile; EXPR and VALUE are the agent expression we are
1250 updating. This will return 0 if there is no known way to compile
1251 VAR, and 1 if VAR was successfully compiled. It may also throw an
1252 exception on error. */
1254 extern int compile_internalvar_to_ax (struct internalvar
*var
,
1255 struct agent_expr
*expr
,
1256 struct axs_value
*value
);
1258 extern struct internalvar
*lookup_internalvar (const char *name
);
1260 extern int value_equal (struct value
*arg1
, struct value
*arg2
);
1262 extern int value_equal_contents (struct value
*arg1
, struct value
*arg2
);
1264 extern int value_less (struct value
*arg1
, struct value
*arg2
);
1266 /* Simulate the C operator ! -- return true if ARG1 contains zero. */
1267 extern bool value_logical_not (struct value
*arg1
);
1269 /* Returns true if the value VAL represents a true value. */
1271 value_true (struct value
*val
)
1273 return !value_logical_not (val
);
1278 extern struct value
*value_of_this (const struct language_defn
*lang
);
1280 extern struct value
*value_of_this_silent (const struct language_defn
*lang
);
1282 extern struct value
*value_x_binop (struct value
*arg1
, struct value
*arg2
,
1284 enum exp_opcode otherop
,
1285 enum noside noside
);
1287 extern struct value
*value_x_unop (struct value
*arg1
, enum exp_opcode op
,
1288 enum noside noside
);
1290 extern struct value
*value_fn_field (struct value
**arg1p
, struct fn_field
*f
,
1291 int j
, struct type
*type
, LONGEST offset
);
1293 extern int binop_types_user_defined_p (enum exp_opcode op
,
1295 struct type
*type2
);
1297 extern int binop_user_defined_p (enum exp_opcode op
, struct value
*arg1
,
1298 struct value
*arg2
);
1300 extern int unop_user_defined_p (enum exp_opcode op
, struct value
*arg1
);
1302 extern int destructor_name_p (const char *name
, struct type
*type
);
1304 extern value_ref_ptr
release_value (struct value
*val
);
1306 extern int record_latest_value (struct value
*val
);
1308 extern void modify_field (struct type
*type
, gdb_byte
*addr
,
1309 LONGEST fieldval
, LONGEST bitpos
, LONGEST bitsize
);
1311 extern void type_print (struct type
*type
, const char *varstring
,
1312 struct ui_file
*stream
, int show
);
1314 extern std::string
type_to_string (struct type
*type
);
1316 extern gdb_byte
*baseclass_addr (struct type
*type
, int index
,
1318 struct value
**valuep
, int *errp
);
1320 extern void print_longest (struct ui_file
*stream
, int format
,
1321 int use_local
, LONGEST val
);
1323 extern void print_floating (const gdb_byte
*valaddr
, struct type
*type
,
1324 struct ui_file
*stream
);
1326 extern void value_print (struct value
*val
, struct ui_file
*stream
,
1327 const struct value_print_options
*options
);
1329 /* Release values from the value chain and return them. Values
1330 created after MARK are released. If MARK is nullptr, or if MARK is
1331 not found on the value chain, then all values are released. Values
1332 are returned in reverse order of creation; that is, newest
1335 extern std::vector
<value_ref_ptr
> value_release_to_mark
1336 (const struct value
*mark
);
1338 extern void common_val_print (struct value
*val
,
1339 struct ui_file
*stream
, int recurse
,
1340 const struct value_print_options
*options
,
1341 const struct language_defn
*language
);
1343 extern int val_print_string (struct type
*elttype
, const char *encoding
,
1344 CORE_ADDR addr
, int len
,
1345 struct ui_file
*stream
,
1346 const struct value_print_options
*options
);
1348 extern void print_variable_and_value (const char *name
,
1350 frame_info_ptr frame
,
1351 struct ui_file
*stream
,
1354 extern void typedef_print (struct type
*type
, struct symbol
*news
,
1355 struct ui_file
*stream
);
1357 extern const char *internalvar_name (const struct internalvar
*var
);
1359 extern void preserve_values (struct objfile
*);
1363 extern struct value
*value_copy (const value
*);
1365 extern struct value
*value_non_lval (struct value
*);
1367 extern void value_force_lval (struct value
*, CORE_ADDR
);
1369 extern struct value
*make_cv_value (int, int, struct value
*);
1371 extern void preserve_one_value (struct value
*, struct objfile
*, htab_t
);
1375 extern struct value
*varying_to_slice (struct value
*);
1377 extern struct value
*value_slice (struct value
*, int, int);
1379 /* Create a complex number. The type is the complex type; the values
1380 are cast to the underlying scalar type before the complex number is
1383 extern struct value
*value_literal_complex (struct value
*, struct value
*,
1386 /* Return the real part of a complex value. */
1388 extern struct value
*value_real_part (struct value
*value
);
1390 /* Return the imaginary part of a complex value. */
1392 extern struct value
*value_imaginary_part (struct value
*value
);
1394 extern struct value
*find_function_in_inferior (const char *,
1397 extern struct value
*value_allocate_space_in_inferior (int);
1399 /* User function handler. */
1401 typedef struct value
*(*internal_function_fn
) (struct gdbarch
*gdbarch
,
1402 const struct language_defn
*language
,
1405 struct value
**argv
);
1407 /* Add a new internal function. NAME is the name of the function; DOC
1408 is a documentation string describing the function. HANDLER is
1409 called when the function is invoked. COOKIE is an arbitrary
1410 pointer which is passed to HANDLER and is intended for "user
1413 extern void add_internal_function (const char *name
, const char *doc
,
1414 internal_function_fn handler
,
1417 /* This overload takes an allocated documentation string. */
1419 extern void add_internal_function (gdb::unique_xmalloc_ptr
<char> &&name
,
1420 gdb::unique_xmalloc_ptr
<char> &&doc
,
1421 internal_function_fn handler
,
1424 struct value
*call_internal_function (struct gdbarch
*gdbarch
,
1425 const struct language_defn
*language
,
1426 struct value
*function
,
1427 int argc
, struct value
**argv
);
1429 const char *value_internal_function_name (struct value
*);
1431 /* Build a value wrapping and representing WORKER. The value takes ownership
1432 of the xmethod_worker object. */
1434 extern struct value
*value_from_xmethod (xmethod_worker_up
&&worker
);
1436 extern struct type
*result_type_of_xmethod (struct value
*method
,
1437 gdb::array_view
<value
*> argv
);
1439 extern struct value
*call_xmethod (struct value
*method
,
1440 gdb::array_view
<value
*> argv
);
1442 /* Destroy the values currently allocated. This is called when GDB is
1443 exiting (e.g., on quit_force). */
1444 extern void finalize_values ();
1446 /* Convert VALUE to a gdb_mpq. The caller must ensure that VALUE is
1447 of floating-point, fixed-point, or integer type. */
1448 extern gdb_mpq
value_to_gdb_mpq (struct value
*value
);
1450 /* While an instance of this class is live, and array values that are
1451 created, that are larger than max_value_size, will be restricted in size
1452 to a particular number of elements. */
1454 struct scoped_array_length_limiting
1456 /* Limit any large array values to only contain ELEMENTS elements. */
1457 scoped_array_length_limiting (int elements
);
1459 /* Restore the previous array value limit. */
1460 ~scoped_array_length_limiting ();
1463 /* Used to hold the previous array value element limit. */
1464 gdb::optional
<int> m_old_value
;
1467 #endif /* !defined (VALUE_H) */