GDB (xrefs)
Loading...
Searching...
No Matches
value.h
Go to the documentation of this file.
1/* Definitions for values of C expressions, for GDB.
2
3 Copyright (C) 1986-2023 Free Software Foundation, Inc.
4
5 This file is part of GDB.
6
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.
11
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.
16
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/>. */
19
20#if !defined (VALUE_H)
21#define VALUE_H 1
22
23#include "frame.h"
24#include "extension.h"
25#include "gdbsupport/gdb_ref_ptr.h"
26#include "gmp-utils.h"
27
28struct block;
29struct expression;
30struct regcache;
31struct symbol;
32struct type;
33struct ui_file;
34struct language_defn;
36
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.
40
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
45 would be:
46
47 - We're inspecting a traceframe, and the memory or registers the
48 debug information says the value lives on haven't been collected.
49
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).
54
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.
58
59 - Any other similar scenario.
60
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.
65
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:
70
71 (gdb) p/x $rax
72 $1 = <not saved>
73 (gdb) info registers rax
74 rax <not saved>
75
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.
79
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.
83*/
84
85extern bool overload_resolution;
86
87/* Defines an [OFFSET, OFFSET + LENGTH) range. */
88
89struct range
90{
91 /* Lowest offset in the range. */
92 LONGEST offset;
93
94 /* Length of the range. */
95 ULONGEST length;
96
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
100 starting offset. */
101
102 bool operator< (const range &other) const
103 {
104 return offset < other.offset;
105 }
106
107 /* Returns true if THIS is equal to OTHER. */
108 bool operator== (const range &other) const
109 {
110 return offset == other.offset && length == other.length;
111 }
112};
113
114/* A policy class to interface gdb::ref_ptr with struct value. */
115
117{
118 static void incref (struct value *ptr);
119 static void decref (struct value *ptr);
120};
121
122/* A gdb:;ref_ptr pointer to a struct value. */
123
124typedef gdb::ref_ptr<struct value, value_ref_policy> value_ref_ptr;
125
126/* Note that the fields in this structure are arranged to save a bit
127 of memory. */
128
129struct value
130{
131private:
132
133 /* Values can only be created via "static constructors". */
134 explicit value (struct type *type_)
135 : m_modifiable (true),
136 m_lazy (true),
137 m_initialized (true),
138 m_stack (false),
139 m_is_zero (false),
140 m_in_history (false),
141 m_type (type_),
142 m_enclosing_type (type_)
143 {
144 }
145
146 /* Values can only be destroyed via the reference-counting
147 mechanism. */
148 ~value ();
149
151
152public:
153
154 /* Allocate a lazy value for type TYPE. Its actual content is
155 "lazily" allocated too: the content field of the return value is
156 NULL; it will be allocated when it is fetched from the target. */
157 static struct value *allocate_lazy (struct type *type);
158
159 /* Allocate a value and its contents for type TYPE. */
160 static struct value *allocate (struct type *type);
161
162 /* Create a computed lvalue, with type TYPE, function pointers
163 FUNCS, and closure CLOSURE. */
164 static struct value *allocate_computed (struct type *type,
165 const struct lval_funcs *funcs,
166 void *closure);
167
168 /* Allocate NOT_LVAL value for type TYPE being OPTIMIZED_OUT. */
169 static struct value *allocate_optimized_out (struct type *type);
170
171 /* Create a value of type TYPE that is zero, and return it. */
172 static struct value *zero (struct type *type, enum lval_type lv);
173
174 /* Return a copy of the value. It contains the same contents, for
175 the same memory address, but it's a different block of
176 storage. */
177 struct value *copy () const;
178
179 /* Type of the value. */
180 struct type *type () const
181 { return m_type; }
182
183 /* This is being used to change the type of an existing value, that
184 code should instead be creating a new value with the changed type
185 (but possibly shared content). */
187 { m_type = type; }
188
189 /* Return the gdbarch associated with the value. */
190 struct gdbarch *arch () const;
191
192 /* Only used for bitfields; number of bits contained in them. */
193 LONGEST bitsize () const
194 { return m_bitsize; }
195
196 void set_bitsize (LONGEST bit)
197 { m_bitsize = bit; }
198
199 /* Only used for bitfields; position of start of field. For
200 little-endian targets, it is the position of the LSB. For
201 big-endian targets, it is the position of the MSB. */
202 LONGEST bitpos () const
203 { return m_bitpos; }
204
205 void set_bitpos (LONGEST bit)
206 { m_bitpos = bit; }
207
208 /* Only used for bitfields; the containing value. This allows a
209 single read from the target when displaying multiple
210 bitfields. */
211 value *parent () const
212 { return m_parent.get (); }
213
214 void set_parent (struct value *parent)
215 { m_parent = value_ref_ptr::new_reference (parent); }
216
217 /* Describes offset of a value within lval of a structure in bytes.
218 If lval == lval_memory, this is an offset to the address. If
219 lval == lval_register, this is a further offset from
220 location.address within the registers structure. Note also the
221 member embedded_offset below. */
222 LONGEST offset () const
223 { return m_offset; }
224
225 void set_offset (LONGEST offset)
226 { m_offset = offset; }
227
228 /* The comment from "struct value" reads: ``Is it modifiable? Only
229 relevant if lval != not_lval.''. Shouldn't the value instead be
230 not_lval and be done with it? */
232 { return m_modifiable; }
233
234 /* Set or clear the modifiable flag. */
235 void set_modifiable (bool val)
236 { m_modifiable = val; }
237
238 LONGEST pointed_to_offset () const
239 { return m_pointed_to_offset; }
240
241 void set_pointed_to_offset (LONGEST val)
242 { m_pointed_to_offset = val; }
243
244 LONGEST embedded_offset () const
245 { return m_embedded_offset; }
246
247 void set_embedded_offset (LONGEST val)
248 { m_embedded_offset = val; }
249
250 /* If false, contents of this value are in the contents field. If
251 true, contents are in inferior. If the lval field is lval_memory,
252 the contents are in inferior memory at location.address plus offset.
253 The lval field may also be lval_register.
254
255 WARNING: This field is used by the code which handles watchpoints
256 (see breakpoint.c) to decide whether a particular value can be
257 watched by hardware watchpoints. If the lazy flag is set for some
258 member of a value chain, it is assumed that this member of the
259 chain doesn't need to be watched as part of watching the value
260 itself. This is how GDB avoids watching the entire struct or array
261 when the user wants to watch a single struct member or array
262 element. If you ever change the way lazy flag is set and reset, be
263 sure to consider this use as well! */
264
265 bool lazy () const
266 { return m_lazy; }
267
268 void set_lazy (bool val)
269 { m_lazy = val; }
270
271 /* If a value represents a C++ object, then the `type' field gives the
272 object's compile-time type. If the object actually belongs to some
273 class derived from `type', perhaps with other base classes and
274 additional members, then `type' is just a subobject of the real
275 thing, and the full object is probably larger than `type' would
276 suggest.
277
278 If `type' is a dynamic class (i.e. one with a vtable), then GDB can
279 actually determine the object's run-time type by looking at the
280 run-time type information in the vtable. When this information is
281 available, we may elect to read in the entire object, for several
282 reasons:
283
284 - When printing the value, the user would probably rather see the
285 full object, not just the limited portion apparent from the
286 compile-time type.
287
288 - If `type' has virtual base classes, then even printing `type'
289 alone may require reaching outside the `type' portion of the
290 object to wherever the virtual base class has been stored.
291
292 When we store the entire object, `enclosing_type' is the run-time
293 type -- the complete object -- and `embedded_offset' is the offset
294 of `type' within that larger type, in bytes. The contents()
295 method takes `embedded_offset' into account, so most GDB code
296 continues to see the `type' portion of the value, just as the
297 inferior would.
298
299 If `type' is a pointer to an object, then `enclosing_type' is a
300 pointer to the object's run-time type, and `pointed_to_offset' is
301 the offset in bytes from the full object to the pointed-to object
302 -- that is, the value `embedded_offset' would have if we followed
303 the pointer and fetched the complete object. (I don't really see
304 the point. Why not just determine the run-time type when you
305 indirect, and avoid the special case? The contents don't matter
306 until you indirect anyway.)
307
308 If we're not doing anything fancy, `enclosing_type' is equal to
309 `type', and `embedded_offset' is zero, so everything works
310 normally. */
311
312 struct type *enclosing_type () const
313 { return m_enclosing_type; }
314
315 void set_enclosing_type (struct type *new_type);
316
317 bool stack () const
318 { return m_stack; }
319
320 void set_stack (bool val)
321 { m_stack = val; }
322
323 /* If this value is lval_computed, return its lval_funcs
324 structure. */
325 const struct lval_funcs *computed_funcs () const;
326
327 /* If this value is lval_computed, return its closure. The meaning
328 of the returned value depends on the functions this value
329 uses. */
330 void *computed_closure () const;
331
332 enum lval_type lval () const
333 { return m_lval; }
334
335 /* Set the 'lval' of this value. */
337 { m_lval = val; }
338
339 /* Set or return field indicating whether a variable is initialized or
340 not, based on debugging information supplied by the compiler.
341 true = initialized; false = uninitialized. */
342 bool initialized () const
343 { return m_initialized; }
344
346 { m_initialized = value; }
347
348 /* If lval == lval_memory, return the address in the inferior. If
349 lval == lval_register, return the byte offset into the registers
350 structure. Otherwise, return 0. The returned address
351 includes the offset, if any. */
352 CORE_ADDR address () const;
353
354 /* Like address, except the result does not include value's
355 offset. */
356 CORE_ADDR raw_address () const;
357
358 /* Set the address of a value. */
359 void set_address (CORE_ADDR);
360
363
365
367
368 /* contents() and contents_raw() both return the address of the gdb
369 buffer used to hold a copy of the contents of the lval.
370 contents() is used when the contents of the buffer are needed --
371 it uses fetch_lazy() to load the buffer from the process being
372 debugged if it hasn't already been loaded (contents_writeable()
373 is used when a writeable but fetched buffer is required)..
374 contents_raw() is used when data is being stored into the buffer,
375 or when it is certain that the contents of the buffer are valid.
376
377 Note: The contents pointer is adjusted by the offset required to
378 get to the real subobject, if the value happens to represent
379 something embedded in a larger run-time object. */
380 gdb::array_view<gdb_byte> contents_raw ();
381
382 /* Actual contents of the value. For use of this value; setting it
383 uses the stuff above. Not valid if lazy is nonzero. Target
384 byte-order. We force it to be aligned properly for any possible
385 value. Note that a value therefore extends beyond what is
386 declared here. */
387 gdb::array_view<const gdb_byte> contents ();
388
389 /* The ALL variants of the above two methods do not adjust the
390 returned pointer by the embedded_offset value. */
391 gdb::array_view<const gdb_byte> contents_all ();
392 gdb::array_view<gdb_byte> contents_all_raw ();
393
394 gdb::array_view<gdb_byte> contents_writeable ();
395
396 /* Like contents_all, but does not require that the returned bits be
397 valid. This should only be used in situations where you plan to
398 check the validity manually. */
399 gdb::array_view<const gdb_byte> contents_for_printing ();
400
401 /* Like contents_for_printing, but accepts a constant value pointer.
402 Unlike contents_for_printing however, the pointed value must
403 _not_ be lazy. */
404 gdb::array_view<const gdb_byte> contents_for_printing () const;
405
406 /* Load the actual content of a lazy value. Fetch the data from the
407 user's process and clear the lazy flag to indicate that the data in
408 the buffer is valid.
409
410 If the value is zero-length, we avoid calling read_memory, which
411 would abort. We mark the value as fetched anyway -- all 0 bytes of
412 it. */
413 void fetch_lazy ();
414
415 /* Compare LENGTH bytes of this value's contents starting at OFFSET1
416 with LENGTH bytes of VAL2's contents starting at OFFSET2.
417
418 Note that "contents" refers to the whole value's contents
419 (value_contents_all), without any embedded offset adjustment. For
420 example, to compare a complete object value with itself, including
421 its enclosing type chunk, you'd do:
422
423 int len = check_typedef (val->enclosing_type ())->length ();
424 val->contents_eq (0, val, 0, len);
425
426 Returns true iff the set of available/valid contents match.
427
428 Optimized-out contents are equal to optimized-out contents, and are
429 not equal to non-optimized-out contents.
430
431 Unavailable contents are equal to unavailable contents, and are not
432 equal to non-unavailable contents.
433
434 For example, if 'x's represent an unavailable byte, and 'V' and 'Z'
435 represent different available/valid bytes, in a value with length
436 16:
437
438 offset: 0 4 8 12 16
439 contents: xxxxVVVVxxxxVVZZ
440
441 then:
442
443 val->contents_eq(0, val, 8, 6) => true
444 val->contents_eq(0, val, 4, 4) => false
445 val->contents_eq(0, val, 8, 8) => false
446 val->contents_eq(4, val, 12, 2) => true
447 val->contents_eq(4, val, 12, 4) => true
448 val->contents_eq(3, val, 4, 4) => true
449
450 If 'x's represent an unavailable byte, 'o' represents an optimized
451 out byte, in a value with length 8:
452
453 offset: 0 4 8
454 contents: xxxxoooo
455
456 then:
457
458 val->contents_eq(0, val, 2, 2) => true
459 val->contents_eq(4, val, 6, 2) => true
460 val->contents_eq(0, val, 4, 4) => true
461
462 We only know whether a value chunk is unavailable or optimized out
463 if we've tried to read it. As this routine is used by printing
464 routines, which may be printing values in the value history, long
465 after the inferior is gone, it works with const values. Therefore,
466 this routine must not be called with lazy values. */
467
468 bool contents_eq (LONGEST offset1, const struct value *val2, LONGEST offset2,
469 LONGEST length) const;
470
471 /* An overload of contents_eq that compares the entirety of both
472 values. */
473 bool contents_eq (const struct value *val2) const;
474
475 /* Given a value, determine whether the bits starting at OFFSET and
476 extending for LENGTH bits are a synthetic pointer. */
477
478 bool bits_synthetic_pointer (LONGEST offset, LONGEST length) const;
479
480 /* Increase this value's reference count. */
481 void incref ()
482 { ++m_reference_count; }
483
484 /* Decrease this value's reference count. When the reference count
485 drops to 0, it will be freed. */
486 void decref ();
487
488 /* Given a value, determine whether the contents bytes starting at
489 OFFSET and extending for LENGTH bytes are available. This returns
490 true if all bytes in the given range are available, false if any
491 byte is unavailable. */
492 bool bytes_available (LONGEST offset, ULONGEST length) const;
493
494 /* Given a value, determine whether the contents bits starting at
495 OFFSET and extending for LENGTH bits are available. This returns
496 true if all bits in the given range are available, false if any
497 bit is unavailable. */
498 bool bits_available (LONGEST offset, ULONGEST length) const;
499
500 /* Like bytes_available, but return false if any byte in the
501 whole object is unavailable. */
502 bool entirely_available ();
503
504 /* Like entirely_available, but return false if any byte in the
505 whole object is available. */
508
509 /* Mark this value's content bytes starting at OFFSET and extending
510 for LENGTH bytes as unavailable. */
511 void mark_bytes_unavailable (LONGEST offset, ULONGEST length);
512
513 /* Mark this value's content bits starting at OFFSET and extending
514 for LENGTH bits as unavailable. */
515 void mark_bits_unavailable (LONGEST offset, ULONGEST length);
516
517 /* If true, this is the value of a variable which does not actually
518 exist in the program, at least partially. If the value is lazy,
519 this may fetch it now. */
520 bool optimized_out ();
521
522 /* Given a value, return true if any of the contents bits starting at
523 OFFSET and extending for LENGTH bits is optimized out, false
524 otherwise. */
525 bool bits_any_optimized_out (int bit_offset, int bit_length) const;
526
527 /* Like optimized_out, but return true iff the whole value is
528 optimized out. */
533
534 /* Mark this value's content bytes starting at OFFSET and extending
535 for LENGTH bytes as optimized out. */
536 void mark_bytes_optimized_out (int offset, int length);
537
538 /* Mark this value's content bits starting at OFFSET and extending
539 for LENGTH bits as optimized out. */
540 void mark_bits_optimized_out (LONGEST offset, LONGEST length);
541
542 /* Return a version of this that is non-lvalue. */
543 struct value *non_lval ();
544
545 /* Write contents of this value at ADDR and set its lval type to be
546 LVAL_MEMORY. */
547 void force_lval (CORE_ADDR);
548
549 /* Set this values's location as appropriate for a component of
550 WHOLE --- regardless of what kind of lvalue WHOLE is. */
551 void set_component_location (const struct value *whole);
552
553 /* Build a value wrapping and representing WORKER. The value takes
554 ownership of the xmethod_worker object. */
555 static struct value *from_xmethod (xmethod_worker_up &&worker);
556
557 /* Return the type of the result of TYPE_CODE_XMETHOD value METHOD. */
558 struct type *result_type_of_xmethod (gdb::array_view<value *> argv);
559
560 /* Call the xmethod corresponding to the TYPE_CODE_XMETHOD value
561 METHOD. */
562 struct value *call_xmethod (gdb::array_view<value *> argv);
563
564 /* Update this value before discarding OBJFILE. COPIED_TYPES is
565 used to prevent cycles / duplicates. */
566 void preserve (struct objfile *objfile, htab_t copied_types);
567
568 /* Unpack a bitfield of BITSIZE bits found at BITPOS in the object
569 at VALADDR + EMBEDDEDOFFSET that has the type of DEST_VAL and
570 store the contents in DEST_VAL, zero or sign extending if the
571 type of DEST_VAL is wider than BITSIZE. VALADDR points to the
572 contents of this value. If this value's contents required to
573 extract the bitfield from are unavailable/optimized out, DEST_VAL
574 is correspondingly marked unavailable/optimized out. */
575 void unpack_bitfield (struct value *dest_val,
576 LONGEST bitpos, LONGEST bitsize,
577 const gdb_byte *valaddr, LONGEST embedded_offset)
578 const;
579
580 /* Copy LENGTH bytes of this value's (all) contents
581 (value_contents_all) starting at SRC_OFFSET byte, into DST
582 value's (all) contents, starting at DST_OFFSET. If unavailable
583 contents are being copied from this value, the corresponding DST
584 contents are marked unavailable accordingly. DST must not be
585 lazy. If this value is lazy, it will be fetched now.
586
587 It is assumed the contents of DST in the [DST_OFFSET,
588 DST_OFFSET+LENGTH) range are wholly available. */
589 void contents_copy (struct value *dst, LONGEST dst_offset,
590 LONGEST src_offset, LONGEST length);
591
592 /* Given a value (offset by OFFSET bytes)
593 of a struct or union type ARG_TYPE,
594 extract and return the value of one of its (non-static) fields.
595 FIELDNO says which field. */
596 struct value *primitive_field (LONGEST offset, int fieldno,
597 struct type *arg_type);
598
599 /* Create a new value by extracting it from this value. TYPE is the
600 type of the new value. BIT_OFFSET and BIT_LENGTH describe the
601 offset and field width of the value to extract from this value --
602 BIT_LENGTH may differ from TYPE's length in the case where this
603 value's type is packed.
604
605 When the value does come from a non-byte-aligned offset or field
606 width, it will be marked non_lval. */
607 struct value *from_component_bitsize (struct type *type,
608 LONGEST bit_offset,
609 LONGEST bit_length);
610
611 /* Record this value on the value history, and return its location
612 in the history. The value is removed from the value chain. */
613 int record_latest ();
614
615private:
616
617 /* Type of value; either not an lval, or one of the various
618 different possible kinds of lval. */
620
621 /* Is it modifiable? Only relevant if lval != not_lval. */
622 bool m_modifiable : 1;
623
624 /* If false, contents of this value are in the contents field. If
625 true, contents are in inferior. If the lval field is lval_memory,
626 the contents are in inferior memory at location.address plus offset.
627 The lval field may also be lval_register.
628
629 WARNING: This field is used by the code which handles watchpoints
630 (see breakpoint.c) to decide whether a particular value can be
631 watched by hardware watchpoints. If the lazy flag is set for
632 some member of a value chain, it is assumed that this member of
633 the chain doesn't need to be watched as part of watching the
634 value itself. This is how GDB avoids watching the entire struct
635 or array when the user wants to watch a single struct member or
636 array element. If you ever change the way lazy flag is set and
637 reset, be sure to consider this use as well! */
638 bool m_lazy : 1;
639
640 /* If value is a variable, is it initialized or not. */
642
643 /* If value is from the stack. If this is set, read_stack will be
644 used instead of read_memory to enable extra caching. */
645 bool m_stack : 1;
646
647 /* True if this is a zero value, created by 'value::zero'; false
648 otherwise. */
649 bool m_is_zero : 1;
650
651 /* True if this a value recorded in value history; false otherwise. */
652 bool m_in_history : 1;
653
654 /* Location of value (if lval). */
655 union
656 {
657 /* If lval == lval_memory, this is the address in the inferior */
658 CORE_ADDR address;
659
660 /*If lval == lval_register, the value is from a register. */
661 struct
662 {
663 /* Register number. */
665 /* Frame ID of "next" frame to which a register value is relative.
666 If the register value is found relative to frame F, then the
667 frame id of F->next will be stored in next_frame_id. */
670
671 /* Pointer to internal variable. */
673
674 /* Pointer to xmethod worker. */
676
677 /* If lval == lval_computed, this is a set of function pointers
678 to use to access and describe the value, and a closure pointer
679 for them to use. */
680 struct
681 {
682 /* Functions to call. */
683 const struct lval_funcs *funcs;
684
685 /* Closure for those functions to use. */
686 void *closure;
689
690 /* Describes offset of a value within lval of a structure in target
691 addressable memory units. Note also the member embedded_offset
692 below. */
693 LONGEST m_offset = 0;
694
695 /* Only used for bitfields; number of bits contained in them. */
696 LONGEST m_bitsize = 0;
697
698 /* Only used for bitfields; position of start of field. For
699 little-endian targets, it is the position of the LSB. For
700 big-endian targets, it is the position of the MSB. */
701 LONGEST m_bitpos = 0;
702
703 /* The number of references to this value. When a value is created,
704 the value chain holds a reference, so REFERENCE_COUNT is 1. If
705 release_value is called, this value is removed from the chain but
706 the caller of release_value now has a reference to this value.
707 The caller must arrange for a call to value_free later. */
709
710 /* Only used for bitfields; the containing value. This allows a
711 single read from the target when displaying multiple
712 bitfields. */
714
715 /* Type of the value. */
716 struct type *m_type;
717
718 /* If a value represents a C++ object, then the `type' field gives
719 the object's compile-time type. If the object actually belongs
720 to some class derived from `type', perhaps with other base
721 classes and additional members, then `type' is just a subobject
722 of the real thing, and the full object is probably larger than
723 `type' would suggest.
724
725 If `type' is a dynamic class (i.e. one with a vtable), then GDB
726 can actually determine the object's run-time type by looking at
727 the run-time type information in the vtable. When this
728 information is available, we may elect to read in the entire
729 object, for several reasons:
730
731 - When printing the value, the user would probably rather see the
732 full object, not just the limited portion apparent from the
733 compile-time type.
734
735 - If `type' has virtual base classes, then even printing `type'
736 alone may require reaching outside the `type' portion of the
737 object to wherever the virtual base class has been stored.
738
739 When we store the entire object, `enclosing_type' is the run-time
740 type -- the complete object -- and `embedded_offset' is the
741 offset of `type' within that larger type, in target addressable memory
742 units. The contents() method takes `embedded_offset' into account,
743 so most GDB code continues to see the `type' portion of the value, just
744 as the inferior would.
745
746 If `type' is a pointer to an object, then `enclosing_type' is a
747 pointer to the object's run-time type, and `pointed_to_offset' is
748 the offset in target addressable memory units from the full object
749 to the pointed-to object -- that is, the value `embedded_offset' would
750 have if we followed the pointer and fetched the complete object.
751 (I don't really see the point. Why not just determine the
752 run-time type when you indirect, and avoid the special case? The
753 contents don't matter until you indirect anyway.)
754
755 If we're not doing anything fancy, `enclosing_type' is equal to
756 `type', and `embedded_offset' is zero, so everything works
757 normally. */
759 LONGEST m_embedded_offset = 0;
761
762 /* Actual contents of the value. Target byte-order.
763
764 May be nullptr if the value is lazy or is entirely optimized out.
765 Guaranteed to be non-nullptr otherwise. */
766 gdb::unique_xmalloc_ptr<gdb_byte> m_contents;
767
768 /* Unavailable ranges in CONTENTS. We mark unavailable ranges,
769 rather than available, since the common and default case is for a
770 value to be available. This is filled in at value read time.
771 The unavailable ranges are tracked in bits. Note that a contents
772 bit that has been optimized out doesn't really exist in the
773 program, so it can't be marked unavailable either. */
774 std::vector<range> m_unavailable;
775
776 /* Likewise, but for optimized out contents (a chunk of the value of
777 a variable that does not actually exist in the program). If LVAL
778 is lval_register, this is a register ($pc, $sp, etc., never a
779 program variable) that has not been saved in the frame. Not
780 saved registers and optimized-out program variables values are
781 treated pretty much the same, except not-saved registers have a
782 different string representation and related error strings. */
783 std::vector<range> m_optimized_out;
784
785 /* This is only non-zero for values of TYPE_CODE_ARRAY and if the size of
786 the array in inferior memory is greater than max_value_size. If these
787 conditions are met then, when the value is loaded from the inferior
788 GDB will only load a portion of the array into memory, and
789 limited_length will be set to indicate the length in octets that were
790 loaded from the inferior. */
791 ULONGEST m_limited_length = 0;
792
793 /* Allocate a value and its contents for type TYPE. If CHECK_SIZE
794 is true, then apply the usual max-value-size checks. */
795 static struct value *allocate (struct type *type, bool check_size);
796
797 /* Helper for fetch_lazy when the value is a bitfield. */
798 void fetch_lazy_bitfield ();
799
800 /* Helper for fetch_lazy when the value is in memory. */
801 void fetch_lazy_memory ();
802
803 /* Helper for fetch_lazy when the value is in a register. */
804 void fetch_lazy_register ();
805
806 /* Try to limit ourselves to only fetching the limited number of
807 elements. However, if this limited number of elements still
808 puts us over max_value_size, then we still refuse it and
809 return failure here, which will ultimately throw an error. */
811
812 /* Allocate the contents of this value if it has not been allocated
813 yet. If CHECK_SIZE is true, then apply the usual max-value-size
814 checks. */
815 void allocate_contents (bool check_size);
816
817 /* Helper function for value_contents_eq. The only difference is that
818 this function is bit rather than byte based.
819
820 Compare LENGTH bits of this value's contents starting at OFFSET1
821 bits with LENGTH bits of VAL2's contents starting at OFFSET2
822 bits. Return true if the available bits match. */
823 bool contents_bits_eq (int offset1, const struct value *val2, int offset2,
824 int length) const;
825
826 void require_not_optimized_out () const;
827 void require_available () const;
828
829 /* Returns true if this value is entirely covered by RANGES. If the
830 value is lazy, it'll be read now. Note that RANGE is a pointer
831 to pointer because reading the value might change *RANGE. */
832 bool entirely_covered_by_range_vector (const std::vector<range> &ranges);
833
834 /* Copy the ranges metadata from this value that overlaps
835 [SRC_BIT_OFFSET, SRC_BIT_OFFSET+BIT_LENGTH) into DST,
836 adjusted. */
837 void ranges_copy_adjusted (struct value *dst, int dst_bit_offset,
838 int src_bit_offset, int bit_length) const;
839
840 /* Copy LENGTH target addressable memory units of this value's (all)
841 contents (value_contents_all) starting at SRC_OFFSET, into DST
842 value's (all) contents, starting at DST_OFFSET. If unavailable
843 contents are being copied from this, the corresponding DST
844 contents are marked unavailable accordingly. Neither DST nor
845 this value may be lazy values.
846
847 It is assumed the contents of DST in the [DST_OFFSET,
848 DST_OFFSET+LENGTH) range are wholly available. */
849 void contents_copy_raw (struct value *dst, LONGEST dst_offset,
850 LONGEST src_offset, LONGEST length);
851
852 /* A helper for value_from_component_bitsize that copies bits from
853 this value to DEST. */
854 void contents_copy_raw_bitwise (struct value *dst, LONGEST dst_bit_offset,
855 LONGEST src_bit_offset, LONGEST bit_length);
856};
857
858inline void
860{
861 ptr->incref ();
862}
863
864inline void
866{
867 ptr->decref ();
868}
869
870/* Returns value_type or value_enclosing_type depending on
871 value_print_options.objectprint.
872
873 If RESOLVE_SIMPLE_TYPES is 0 the enclosing type will be resolved
874 only for pointers and references, else it will be returned
875 for all the types (e.g. structures). This option is useful
876 to prevent retrieving enclosing type for the base classes fields.
877
878 REAL_TYPE_FOUND is used to inform whether the real type was found
879 (or just static type was used). The NULL may be passed if it is not
880 necessary. */
881
882extern struct type *value_actual_type (struct value *value,
883 int resolve_simple_types,
884 int *real_type_found);
885
886/* For lval_computed values, this structure holds functions used to
887 retrieve and set the value (or portions of the value).
888
889 For each function, 'V' is the 'this' pointer: an lval_funcs
890 function F may always assume that the V it receives is an
891 lval_computed value, and has F in the appropriate slot of its
892 lval_funcs structure. */
893
895{
896 /* Fill in VALUE's contents. This is used to "un-lazy" values. If
897 a problem arises in obtaining VALUE's bits, this function should
898 call 'error'. If it is NULL value_fetch_lazy on "un-lazy"
899 non-optimized-out value is an internal error. */
900 void (*read) (struct value *v);
901
902 /* Handle an assignment TOVAL = FROMVAL by writing the value of
903 FROMVAL to TOVAL's location. The contents of TOVAL have not yet
904 been updated. If a problem arises in doing so, this function
905 should call 'error'. If it is NULL such TOVAL assignment is an error as
906 TOVAL is not considered as an lvalue. */
907 void (*write) (struct value *toval, struct value *fromval);
908
909 /* Return true if any part of V is optimized out, false otherwise.
910 This will only be called for lazy values -- if the value has been
911 fetched, then the value's optimized-out bits are consulted
912 instead. */
913 bool (*is_optimized_out) (struct value *v);
914
915 /* If non-NULL, this is used to implement pointer indirection for
916 this value. This method may return NULL, in which case value_ind
917 will fall back to ordinary indirection. */
918 struct value *(*indirect) (struct value *value);
919
920 /* If non-NULL, this is used to implement reference resolving for
921 this value. This method may return NULL, in which case coerce_ref
922 will fall back to ordinary references resolving. */
923 struct value *(*coerce_ref) (const struct value *value);
924
925 /* If non-NULL, this is used to determine whether the indicated bits
926 of VALUE are a synthetic pointer. */
927 bool (*check_synthetic_pointer) (const struct value *value,
928 LONGEST offset, int length);
929
930 /* Return a duplicate of VALUE's closure, for use in a new value.
931 This may simply return the same closure, if VALUE's is
932 reference-counted or statically allocated.
933
934 This may be NULL, in which case VALUE's closure is re-used in the
935 new value. */
936 void *(*copy_closure) (const struct value *v);
937
938 /* Drop VALUE's reference to its closure. Maybe this frees the
939 closure; maybe this decrements a reference count; maybe the
940 closure is statically allocated and this does nothing.
941
942 This may be NULL, in which case no action is taken to free
943 VALUE's closure. */
944 void (*free_closure) (struct value *v);
945};
946
947/* Throw an error complaining that the value has been optimized
948 out. */
949
950extern void error_value_optimized_out (void);
951
952/* Pointer to internal variable. */
953#define VALUE_INTERNALVAR(val) (*((val)->deprecated_internalvar_hack ()))
954
955/* Frame ID of "next" frame to which a register value is relative. A
956 register value is indicated by VALUE_LVAL being set to lval_register.
957 So, if the register value is found relative to frame F, then the
958 frame id of F->next will be stored in VALUE_NEXT_FRAME_ID. */
959#define VALUE_NEXT_FRAME_ID(val) (*((val)->deprecated_next_frame_id_hack ()))
960
961/* Register number if the value is from a register. */
962#define VALUE_REGNUM(val) (*((val)->deprecated_regnum_hack ()))
963
964/* Return value after lval_funcs->coerce_ref (after check_typedef). Return
965 NULL if lval_funcs->coerce_ref is not applicable for whatever reason. */
966
967extern struct value *coerce_ref_if_computed (const struct value *arg);
968
969/* Setup a new value type and enclosing value type for dereferenced value VALUE.
970 ENC_TYPE is the new enclosing type that should be set. ORIGINAL_TYPE and
971 ORIGINAL_VAL are the type and value of the original reference or
972 pointer. ORIGINAL_VALUE_ADDRESS is the address within VALUE, that is
973 the address that was dereferenced.
974
975 Note, that VALUE is modified by this function.
976
977 It is a common implementation for coerce_ref and value_ind. */
978
979extern struct value * readjust_indirect_value_type (struct value *value,
980 struct type *enc_type,
981 const struct type *original_type,
982 struct value *original_val,
983 CORE_ADDR original_value_address);
984
985/* Convert a REF to the object referenced. */
986
987extern struct value *coerce_ref (struct value *value);
988
989/* If ARG is an array, convert it to a pointer.
990 If ARG is a function, convert it to a function pointer.
991
992 References are dereferenced. */
993
994extern struct value *coerce_array (struct value *value);
995
996/* Read LENGTH addressable memory units starting at MEMADDR into BUFFER,
997 which is (or will be copied to) VAL's contents buffer offset by
998 BIT_OFFSET bits. Marks value contents ranges as unavailable if
999 the corresponding memory is likewise unavailable. STACK indicates
1000 whether the memory is known to be stack memory. */
1001
1002extern void read_value_memory (struct value *val, LONGEST bit_offset,
1003 bool stack, CORE_ADDR memaddr,
1004 gdb_byte *buffer, size_t length);
1005
1006/* Cast SCALAR_VALUE to the element type of VECTOR_TYPE, then replicate
1007 into each element of a new vector value with VECTOR_TYPE. */
1008
1009struct value *value_vector_widen (struct value *scalar_value,
1010 struct type *vector_type);
1011
1012
1013
1014#include "symtab.h"
1015#include "gdbtypes.h"
1016#include "expression.h"
1017
1018class frame_info_ptr;
1019struct fn_field;
1020
1021extern int print_address_demangle (const struct value_print_options *,
1022 struct gdbarch *, CORE_ADDR,
1023 struct ui_file *, int);
1024
1025/* Returns true if VAL is of floating-point type. In addition,
1026 throws an error if the value is an invalid floating-point value. */
1027extern bool is_floating_value (struct value *val);
1028
1029extern LONGEST value_as_long (struct value *val);
1030extern CORE_ADDR value_as_address (struct value *val);
1031
1032/* Extract the value from VAL as a MPZ. This coerces arrays and
1033 handles various integer-like types as well. */
1034
1035extern gdb_mpz value_as_mpz (struct value *val);
1036
1037extern LONGEST unpack_long (struct type *type, const gdb_byte *valaddr);
1038extern CORE_ADDR unpack_pointer (struct type *type, const gdb_byte *valaddr);
1039
1040extern LONGEST unpack_field_as_long (struct type *type,
1041 const gdb_byte *valaddr,
1042 int fieldno);
1043
1044/* Unpack a bitfield of the specified FIELD_TYPE, from the object at
1045 VALADDR, and store the result in *RESULT.
1046 The bitfield starts at BITPOS bits and contains BITSIZE bits; if
1047 BITSIZE is zero, then the length is taken from FIELD_TYPE.
1048
1049 Extracting bits depends on endianness of the machine. Compute the
1050 number of least significant bits to discard. For big endian machines,
1051 we compute the total number of bits in the anonymous object, subtract
1052 off the bit count from the MSB of the object to the MSB of the
1053 bitfield, then the size of the bitfield, which leaves the LSB discard
1054 count. For little endian machines, the discard count is simply the
1055 number of bits from the LSB of the anonymous object to the LSB of the
1056 bitfield.
1057
1058 If the field is signed, we also do sign extension. */
1059
1060extern LONGEST unpack_bits_as_long (struct type *field_type,
1061 const gdb_byte *valaddr,
1062 LONGEST bitpos, LONGEST bitsize);
1063
1064extern int unpack_value_field_as_long (struct type *type, const gdb_byte *valaddr,
1065 LONGEST embedded_offset, int fieldno,
1066 const struct value *val, LONGEST *result);
1067
1068extern struct value *value_field_bitfield (struct type *type, int fieldno,
1069 const gdb_byte *valaddr,
1070 LONGEST embedded_offset,
1071 const struct value *val);
1072
1073extern void pack_long (gdb_byte *buf, struct type *type, LONGEST num);
1074
1075extern struct value *value_from_longest (struct type *type, LONGEST num);
1076extern struct value *value_from_ulongest (struct type *type, ULONGEST num);
1077extern struct value *value_from_pointer (struct type *type, CORE_ADDR addr);
1078extern struct value *value_from_host_double (struct type *type, double d);
1079extern struct value *value_from_history_ref (const char *, const char **);
1080extern struct value *value_from_component (struct value *, struct type *,
1081 LONGEST);
1082
1083/* Convert the value V into a newly allocated value. */
1084extern struct value *value_from_mpz (struct type *type, const gdb_mpz &v);
1085
1086extern struct value *value_at (struct type *type, CORE_ADDR addr);
1087
1088/* Return a new value given a type and an address. The new value is
1089 lazy. If FRAME is given, it is used when resolving dynamic
1090 properties. */
1091
1092extern struct value *value_at_lazy (struct type *type, CORE_ADDR addr,
1093 frame_info_ptr frame = nullptr);
1094
1095/* Like value_at, but ensures that the result is marked not_lval.
1096 This can be important if the memory is "volatile". */
1097extern struct value *value_at_non_lval (struct type *type, CORE_ADDR addr);
1098
1100 (struct type *, const gdb_byte *, CORE_ADDR);
1102 (struct type *, const gdb_byte *, CORE_ADDR,
1103 frame_info_ptr frame = nullptr);
1104extern struct value *value_from_contents (struct type *, const gdb_byte *);
1105
1106extern struct value *default_value_from_register (struct gdbarch *gdbarch,
1107 struct type *type,
1108 int regnum,
1109 struct frame_id frame_id);
1110
1111extern void read_frame_register_value (struct value *value,
1112 frame_info_ptr frame);
1113
1114extern struct value *value_from_register (struct type *type, int regnum,
1115 frame_info_ptr frame);
1116
1117extern CORE_ADDR address_from_register (int regnum,
1118 frame_info_ptr frame);
1119
1120extern struct value *value_of_variable (struct symbol *var,
1121 const struct block *b);
1122
1123extern struct value *address_of_variable (struct symbol *var,
1124 const struct block *b);
1125
1126extern struct value *value_of_register (int regnum, frame_info_ptr frame);
1127
1129
1130/* Return the symbol's reading requirement. */
1131
1132extern enum symbol_needs_kind symbol_read_needs (struct symbol *);
1133
1134/* Return true if the symbol needs a frame. This is a wrapper for
1135 symbol_read_needs that simply checks for SYMBOL_NEEDS_FRAME. */
1136
1137extern int symbol_read_needs_frame (struct symbol *);
1138
1139extern struct value *read_var_value (struct symbol *var,
1140 const struct block *var_block,
1141 frame_info_ptr frame);
1142
1143extern struct value *allocate_repeat_value (struct type *type, int count);
1144
1145extern struct value *value_mark (void);
1146
1147extern void value_free_to_mark (const struct value *mark);
1148
1149/* A helper class that uses value_mark at construction time and calls
1150 value_free_to_mark in the destructor. This is used to clear out
1151 temporary values created during the lifetime of this object. */
1153{
1154 public:
1155
1157 : m_value (value_mark ())
1158 {
1159 }
1160
1162 {
1163 free_to_mark ();
1164 }
1165
1167
1169
1170 /* Free the values currently on the value stack. */
1172 {
1173 if (!m_freed)
1174 {
1176 m_freed = true;
1177 }
1178 }
1179
1180 private:
1181
1182 const struct value *m_value;
1183 bool m_freed = false;
1184};
1185
1186/* Create not_lval value representing a NULL-terminated C string. The
1187 resulting value has type TYPE_CODE_ARRAY. The string passed in should
1188 not include embedded null characters.
1189
1190 PTR points to the string data; COUNT is number of characters (does
1191 not include the NULL terminator) pointed to by PTR, each character is of
1192 type (and size of) CHAR_TYPE. */
1193
1194extern struct value *value_cstring (const gdb_byte *ptr, ssize_t count,
1195 struct type *char_type);
1196
1197/* Specialisation of value_cstring above. In this case PTR points to
1198 single byte characters. CHAR_TYPE must have a length of 1. */
1199inline struct value *value_cstring (const char *ptr, ssize_t count,
1200 struct type *char_type)
1201{
1202 gdb_assert (char_type->length () == 1);
1203 return value_cstring ((const gdb_byte *) ptr, count, char_type);
1204}
1205
1206/* Create a not_lval value with type TYPE_CODE_STRING, the resulting value
1207 has type TYPE_CODE_STRING.
1208
1209 PTR points to the string data; COUNT is number of characters pointed to
1210 by PTR, each character has the type (and size of) CHAR_TYPE.
1211
1212 Note that string types are like array of char types with a lower bound
1213 defined by the language (usually zero or one). Also the string may
1214 contain embedded null characters. */
1215
1216extern struct value *value_string (const gdb_byte *ptr, ssize_t count,
1217 struct type *char_type);
1218
1219/* Specialisation of value_string above. In this case PTR points to
1220 single byte characters. CHAR_TYPE must have a length of 1. */
1221inline struct value *value_string (const char *ptr, ssize_t count,
1222 struct type *char_type)
1223{
1224 gdb_assert (char_type->length () == 1);
1225 return value_string ((const gdb_byte *) ptr, count, char_type);
1226}
1227
1228extern struct value *value_array (int lowbound,
1229 gdb::array_view<struct value *> elemvec);
1230
1231extern struct value *value_concat (struct value *arg1, struct value *arg2);
1232
1233extern struct value *value_binop (struct value *arg1, struct value *arg2,
1234 enum exp_opcode op);
1235
1236extern struct value *value_ptradd (struct value *arg1, LONGEST arg2);
1237
1238extern LONGEST value_ptrdiff (struct value *arg1, struct value *arg2);
1239
1240/* Return true if VAL does not live in target memory, but should in order
1241 to operate on it. Otherwise return false. */
1242
1243extern bool value_must_coerce_to_target (struct value *arg1);
1244
1245extern struct value *value_coerce_to_target (struct value *arg1);
1246
1247extern struct value *value_coerce_array (struct value *arg1);
1248
1249extern struct value *value_coerce_function (struct value *arg1);
1250
1251extern struct value *value_ind (struct value *arg1);
1252
1253extern struct value *value_addr (struct value *arg1);
1254
1255extern struct value *value_ref (struct value *arg1, enum type_code refcode);
1256
1257extern struct value *value_assign (struct value *toval,
1258 struct value *fromval);
1259
1260/* The unary + operation. */
1261extern struct value *value_pos (struct value *arg1);
1262
1263/* The unary - operation. */
1264extern struct value *value_neg (struct value *arg1);
1265
1266/* The unary ~ operation -- but note that it also implements the GCC
1267 extension, where ~ of a complex number is the complex
1268 conjugate. */
1269extern struct value *value_complement (struct value *arg1);
1270
1271extern struct value *value_struct_elt (struct value **argp,
1272 gdb::optional<gdb::array_view <value *>> args,
1273 const char *name, int *static_memfuncp,
1274 const char *err);
1275
1276extern struct value *value_struct_elt_bitpos (struct value **argp,
1277 int bitpos,
1278 struct type *field_type,
1279 const char *err);
1280
1281extern struct value *value_aggregate_elt (struct type *curtype,
1282 const char *name,
1283 struct type *expect_type,
1284 int want_address,
1285 enum noside noside);
1286
1287extern struct value *value_static_field (struct type *type, int fieldno);
1288
1290
1291extern int find_overload_match (gdb::array_view<value *> args,
1292 const char *name,
1293 enum oload_search_type method,
1294 struct value **objp, struct symbol *fsym,
1295 struct value **valp, struct symbol **symp,
1296 int *staticp, const int no_adl,
1297 enum noside noside);
1298
1299extern struct value *value_field (struct value *arg1, int fieldno);
1300
1301extern struct type *value_rtti_indirect_type (struct value *, int *, LONGEST *,
1302 int *);
1303
1304extern struct value *value_full_object (struct value *, struct type *, int,
1305 int, int);
1306
1307extern struct value *value_cast_pointers (struct type *, struct value *, int);
1308
1309extern struct value *value_cast (struct type *type, struct value *arg2);
1310
1311extern struct value *value_reinterpret_cast (struct type *type,
1312 struct value *arg);
1313
1314extern struct value *value_dynamic_cast (struct type *type, struct value *arg);
1315
1316extern struct value *value_one (struct type *type);
1317
1318extern struct value *value_repeat (struct value *arg1, int count);
1319
1320extern struct value *value_subscript (struct value *array, LONGEST index);
1321
1322/* Assuming VAL is array-like (see type::is_array_like), return an
1323 array form of VAL. */
1324extern struct value *value_to_array (struct value *val);
1325
1327 struct value *bitstring,
1328 LONGEST index);
1329
1330extern struct value *register_value_being_returned (struct type *valtype,
1331 struct regcache *retbuf);
1332
1333extern int value_bit_index (struct type *type, const gdb_byte *addr,
1334 int index);
1335
1336extern enum return_value_convention
1337struct_return_convention (struct gdbarch *gdbarch, struct value *function,
1338 struct type *value_type);
1339
1340extern int using_struct_return (struct gdbarch *gdbarch,
1341 struct value *function,
1342 struct type *value_type);
1343
1344extern value *evaluate_var_value (enum noside noside, const block *blk,
1345 symbol *var);
1346
1348 struct objfile *objfile,
1349 minimal_symbol *msymbol);
1350
1351namespace expr { class operation; };
1352extern void fetch_subexp_value (struct expression *exp,
1353 expr::operation *op,
1354 struct value **valp, struct value **resultp,
1355 std::vector<value_ref_ptr> *val_chain,
1356 bool preserve_errors);
1357
1358extern struct value *parse_and_eval (const char *exp, parser_flags flags = 0);
1359
1360extern struct value *parse_to_comma_and_eval (const char **expp);
1361
1362extern struct type *parse_and_eval_type (const char *p, int length);
1363
1364extern CORE_ADDR parse_and_eval_address (const char *exp);
1365
1366extern LONGEST parse_and_eval_long (const char *exp);
1367
1368extern void unop_promote (const struct language_defn *language,
1369 struct gdbarch *gdbarch,
1370 struct value **arg1);
1371
1372extern void binop_promote (const struct language_defn *language,
1373 struct gdbarch *gdbarch,
1374 struct value **arg1, struct value **arg2);
1375
1376extern struct value *access_value_history (int num);
1377
1378/* Return the number of items in the value history. */
1379
1380extern ULONGEST value_history_count ();
1381
1382extern struct value *value_of_internalvar (struct gdbarch *gdbarch,
1383 struct internalvar *var);
1384
1385extern int get_internalvar_integer (struct internalvar *var, LONGEST *l);
1386
1387extern void set_internalvar (struct internalvar *var, struct value *val);
1388
1389extern void set_internalvar_integer (struct internalvar *var, LONGEST l);
1390
1391extern void set_internalvar_string (struct internalvar *var,
1392 const char *string);
1393
1394extern void clear_internalvar (struct internalvar *var);
1395
1396extern void set_internalvar_component (struct internalvar *var,
1397 LONGEST offset,
1398 LONGEST bitpos, LONGEST bitsize,
1399 struct value *newvalue);
1400
1401extern struct internalvar *lookup_only_internalvar (const char *name);
1402
1403extern struct internalvar *create_internalvar (const char *name);
1404
1405extern void complete_internalvar (completion_tracker &tracker,
1406 const char *name);
1407
1408/* An internalvar can be dynamically computed by supplying a vector of
1409 function pointers to perform various operations. */
1410
1412{
1413 /* Compute the value of the variable. The DATA argument passed to
1414 the function is the same argument that was passed to
1415 `create_internalvar_type_lazy'. */
1416
1417 struct value *(*make_value) (struct gdbarch *arch,
1418 struct internalvar *var,
1419 void *data);
1420
1421 /* Update the agent expression EXPR with bytecode to compute the
1422 value. VALUE is the agent value we are updating. The DATA
1423 argument passed to this function is the same argument that was
1424 passed to `create_internalvar_type_lazy'. If this pointer is
1425 NULL, then the internalvar cannot be compiled to an agent
1426 expression. */
1427
1428 void (*compile_to_ax) (struct internalvar *var,
1429 struct agent_expr *expr,
1430 struct axs_value *value,
1431 void *data);
1432};
1433
1434extern struct internalvar *create_internalvar_type_lazy (const char *name,
1435 const struct internalvar_funcs *funcs,
1436 void *data);
1437
1438/* Compile an internal variable to an agent expression. VAR is the
1439 variable to compile; EXPR and VALUE are the agent expression we are
1440 updating. This will return 0 if there is no known way to compile
1441 VAR, and 1 if VAR was successfully compiled. It may also throw an
1442 exception on error. */
1443
1444extern int compile_internalvar_to_ax (struct internalvar *var,
1445 struct agent_expr *expr,
1446 struct axs_value *value);
1447
1448extern struct internalvar *lookup_internalvar (const char *name);
1449
1450extern int value_equal (struct value *arg1, struct value *arg2);
1451
1452extern int value_equal_contents (struct value *arg1, struct value *arg2);
1453
1454extern int value_less (struct value *arg1, struct value *arg2);
1455
1456/* Simulate the C operator ! -- return true if ARG1 contains zero. */
1457extern bool value_logical_not (struct value *arg1);
1458
1459/* Returns true if the value VAL represents a true value. */
1460static inline bool
1461value_true (struct value *val)
1462{
1463 return !value_logical_not (val);
1464}
1465
1466/* C++ */
1467
1468extern struct value *value_of_this (const struct language_defn *lang);
1469
1470extern struct value *value_of_this_silent (const struct language_defn *lang);
1471
1472extern struct value *value_x_binop (struct value *arg1, struct value *arg2,
1473 enum exp_opcode op,
1474 enum exp_opcode otherop,
1475 enum noside noside);
1476
1477extern struct value *value_x_unop (struct value *arg1, enum exp_opcode op,
1478 enum noside noside);
1479
1480extern struct value *value_fn_field (struct value **arg1p, struct fn_field *f,
1481 int j, struct type *type, LONGEST offset);
1482
1483extern int binop_types_user_defined_p (enum exp_opcode op,
1484 struct type *type1,
1485 struct type *type2);
1486
1487extern int binop_user_defined_p (enum exp_opcode op, struct value *arg1,
1488 struct value *arg2);
1489
1490extern int unop_user_defined_p (enum exp_opcode op, struct value *arg1);
1491
1492extern int destructor_name_p (const char *name, struct type *type);
1493
1494extern value_ref_ptr release_value (struct value *val);
1495
1496extern void modify_field (struct type *type, gdb_byte *addr,
1497 LONGEST fieldval, LONGEST bitpos, LONGEST bitsize);
1498
1499extern void type_print (struct type *type, const char *varstring,
1500 struct ui_file *stream, int show);
1501
1502extern std::string type_to_string (struct type *type);
1503
1504extern gdb_byte *baseclass_addr (struct type *type, int index,
1505 gdb_byte *valaddr,
1506 struct value **valuep, int *errp);
1507
1508extern void print_longest (struct ui_file *stream, int format,
1509 int use_local, LONGEST val);
1510
1511extern void print_floating (const gdb_byte *valaddr, struct type *type,
1512 struct ui_file *stream);
1513
1514extern void value_print (struct value *val, struct ui_file *stream,
1515 const struct value_print_options *options);
1516
1517/* Release values from the value chain and return them. Values
1518 created after MARK are released. If MARK is nullptr, or if MARK is
1519 not found on the value chain, then all values are released. Values
1520 are returned in reverse order of creation; that is, newest
1521 first. */
1522
1523extern std::vector<value_ref_ptr> value_release_to_mark
1524 (const struct value *mark);
1525
1526extern void common_val_print (struct value *val,
1527 struct ui_file *stream, int recurse,
1528 const struct value_print_options *options,
1529 const struct language_defn *language);
1530
1531extern int val_print_string (struct type *elttype, const char *encoding,
1532 CORE_ADDR addr, int len,
1533 struct ui_file *stream,
1534 const struct value_print_options *options);
1535
1536extern void print_variable_and_value (const char *name,
1537 struct symbol *var,
1538 frame_info_ptr frame,
1539 struct ui_file *stream,
1540 int indent);
1541
1542extern void typedef_print (struct type *type, struct symbol *news,
1543 struct ui_file *stream);
1544
1545extern const char *internalvar_name (const struct internalvar *var);
1546
1547extern void preserve_values (struct objfile *);
1548
1549/* From values.c */
1550
1551extern struct value *make_cv_value (int, int, struct value *);
1552
1553/* From valops.c */
1554
1555extern struct value *varying_to_slice (struct value *);
1556
1557extern struct value *value_slice (struct value *, int, int);
1558
1559/* Create a complex number. The type is the complex type; the values
1560 are cast to the underlying scalar type before the complex number is
1561 created. */
1562
1563extern struct value *value_literal_complex (struct value *, struct value *,
1564 struct type *);
1565
1566/* Return the real part of a complex value. */
1567
1568extern struct value *value_real_part (struct value *value);
1569
1570/* Return the imaginary part of a complex value. */
1571
1572extern struct value *value_imaginary_part (struct value *value);
1573
1574extern struct value *find_function_in_inferior (const char *,
1575 struct objfile **);
1576
1578
1579/* User function handler. */
1580
1581typedef struct value *(*internal_function_fn) (struct gdbarch *gdbarch,
1582 const struct language_defn *language,
1583 void *cookie,
1584 int argc,
1585 struct value **argv);
1586
1587/* Add a new internal function. NAME is the name of the function; DOC
1588 is a documentation string describing the function. HANDLER is
1589 called when the function is invoked. COOKIE is an arbitrary
1590 pointer which is passed to HANDLER and is intended for "user
1591 data". */
1592
1593extern void add_internal_function (const char *name, const char *doc,
1594 internal_function_fn handler,
1595 void *cookie);
1596
1597/* This overload takes an allocated documentation string. */
1598
1599extern void add_internal_function (gdb::unique_xmalloc_ptr<char> &&name,
1600 gdb::unique_xmalloc_ptr<char> &&doc,
1601 internal_function_fn handler,
1602 void *cookie);
1603
1605 const struct language_defn *language,
1606 struct value *function,
1607 int argc, struct value **argv);
1608
1609const char *value_internal_function_name (struct value *);
1610
1611/* Destroy the values currently allocated. This is called when GDB is
1612 exiting (e.g., on quit_force). */
1613extern void finalize_values ();
1614
1615/* Convert VALUE to a gdb_mpq. The caller must ensure that VALUE is
1616 of floating-point, fixed-point, or integer type. */
1617extern gdb_mpq value_to_gdb_mpq (struct value *value);
1618
1619/* Return true if LEN (in bytes) exceeds the max-value-size setting,
1620 otherwise, return false. If the user has disabled (set to unlimited)
1621 the max-value-size setting then this function will always return false. */
1622extern bool exceeds_max_value_size (ULONGEST length);
1623
1624/* While an instance of this class is live, and array values that are
1625 created, that are larger than max_value_size, will be restricted in size
1626 to a particular number of elements. */
1627
1629{
1630 /* Limit any large array values to only contain ELEMENTS elements. */
1631 scoped_array_length_limiting (int elements);
1632
1633 /* Restore the previous array value limit. */
1635
1636private:
1637 /* Used to hold the previous array value element limit. */
1638 gdb::optional<int> m_old_value;
1639};
1640
1641#endif /* !defined (VALUE_H) */
#define bit(obj, st)
int regnum
const char *const name
void f()
Definition 1.cc:36
const struct value * m_value
Definition value.h:1182
DISABLE_COPY_AND_ASSIGN(scoped_value_mark)
scoped_value_mark(scoped_value_mark &&other)=default
void free_to_mark()
Definition value.h:1171
language
Definition defs.h:211
lval_type
Definition defs.h:359
@ not_lval
Definition defs.h:361
symbol_needs_kind
Definition defs.h:448
return_value_convention
Definition defs.h:257
exp_opcode
Definition expression.h:45
noside
Definition expression.h:56
std::unique_ptr< xmethod_worker > xmethod_worker_up
Definition extension.h:229
type_code
Definition gdbtypes.h:82
mach_port_t mach_port_t name mach_port_t mach_port_t name kern_return_t err
Definition gnu-nat.c:1789
mach_port_t kern_return_t mach_port_t mach_msg_type_name_t msgportsPoly mach_port_t kern_return_t pid_t pid mach_port_t kern_return_t mach_port_t task mach_port_t kern_return_t int flags
Definition gnu-nat.c:1861
unsigned short offset1
Definition go32-nat.c:7
static struct type * new_type(char *)
Definition ada-exp.h:87
int value
Definition py-param.c:79
Definition block.h:109
void(* compile_to_ax)(struct internalvar *var, struct agent_expr *expr, struct axs_value *value, void *data)
Definition value.h:1428
internalvar(std::string name)
Definition value.c:1852
void(* write)(struct value *toval, struct value *fromval)
Definition value.h:907
void(* read)(struct value *v)
Definition value.h:900
bool(* is_optimized_out)(struct value *v)
Definition value.h:913
void(* free_closure)(struct value *v)
Definition value.h:944
bool(* check_synthetic_pointer)(const struct value *value, LONGEST offset, int length)
Definition value.h:927
Definition value.h:90
bool operator==(const range &other) const
Definition value.h:108
LONGEST offset
Definition value.h:92
bool operator<(const range &other) const
Definition value.h:102
ULONGEST length
Definition value.h:95
scoped_array_length_limiting(int elements)
Definition value.c:832
gdb::optional< int > m_old_value
Definition value.h:1638
ULONGEST length() const
Definition gdbtypes.h:983
static void decref(struct value *ptr)
Definition value.h:865
static void incref(struct value *ptr)
Definition value.h:859
Definition value.h:130
static struct value * from_xmethod(xmethod_worker_up &&worker)
Definition value.c:2514
void unpack_bitfield(struct value *dest_val, LONGEST bitpos, LONGEST bitsize, const gdb_byte *valaddr, LONGEST embedded_offset) const
Definition value.c:3215
std::vector< range > m_optimized_out
Definition value.h:783
static struct value * zero(struct type *type, enum lval_type lv)
Definition value.c:3426
void set_parent(struct value *parent)
Definition value.h:214
void set_initialized(bool value)
Definition value.h:345
bool m_initialized
Definition value.h:641
struct value * primitive_field(LONGEST offset, int fieldno, struct type *arg_type)
Definition value.c:2932
static struct value * allocate_optimized_out(struct type *type)
Definition value.c:997
gdb::array_view< const gdb_byte > contents_all()
Definition value.c:1119
const struct lval_funcs * funcs
Definition value.h:683
CORE_ADDR address() const
std::vector< range > m_unavailable
Definition value.h:774
struct type * m_type
Definition value.h:716
void contents_copy(struct value *dst, LONGEST dst_offset, LONGEST src_offset, LONGEST length)
Definition value.c:1252
bool bits_any_optimized_out(int bit_offset, int bit_length) const
Definition value.c:201
void set_bitpos(LONGEST bit)
Definition value.h:205
LONGEST bitsize() const
Definition value.h:193
struct frame_id next_frame_id
Definition value.h:668
void preserve(struct objfile *objfile, htab_t copied_types)
Definition value.c:2385
void set_modifiable(bool val)
Definition value.h:235
void force_lval(CORE_ADDR)
Definition value.c:1589
int regnum
Definition value.h:664
bool m_is_zero
Definition value.h:649
struct value * non_lval()
Definition value.c:1570
void mark_bits_optimized_out(LONGEST offset, LONGEST length)
Definition value.c:1333
bool m_modifiable
Definition value.h:622
bool m_lazy
Definition value.h:638
gdb::unique_xmalloc_ptr< gdb_byte > m_contents
Definition value.h:766
bool deprecated_modifiable() const
Definition value.h:231
LONGEST m_pointed_to_offset
Definition value.h:760
struct value * copy() const
Definition value.c:1494
struct value::@203::@205 computed
static struct value * allocate_computed(struct type *type, const struct lval_funcs *funcs, void *closure)
Definition value.c:981
int m_reference_count
Definition value.h:708
void contents_copy_raw(struct value *dst, LONGEST dst_offset, LONGEST src_offset, LONGEST length)
Definition value.c:1167
void ranges_copy_adjusted(struct value *dst, int dst_bit_offset, int src_bit_offset, int bit_length) const
Definition value.c:1153
struct gdbarch * arch() const
Definition value.c:167
ULONGEST m_limited_length
Definition value.h:791
void mark_bytes_optimized_out(int offset, int length)
Definition value.c:1324
bool lazy() const
Definition value.h:265
gdb::array_view< gdb_byte > contents_writeable()
Definition value.c:1271
void contents_copy_raw_bitwise(struct value *dst, LONGEST dst_bit_offset, LONGEST src_bit_offset, LONGEST bit_length)
Definition value.c:1212
static struct value * allocate(struct type *type)
Definition value.c:957
bool bytes_available(LONGEST offset, ULONGEST length) const
Definition value.c:187
struct frame_id * deprecated_next_frame_id_hack()
Definition value.c:1396
LONGEST m_embedded_offset
Definition value.h:759
struct internalvar * internalvar
Definition value.h:672
void set_enclosing_type(struct type *new_type)
Definition value.c:2917
void set_embedded_offset(LONGEST val)
Definition value.h:247
bool initialized() const
Definition value.h:342
void set_stack(bool val)
Definition value.h:320
struct value * from_component_bitsize(struct type *type, LONGEST bit_offset, LONGEST bit_length)
Definition value.c:3679
struct xmethod_worker * xm_worker
Definition value.h:675
LONGEST bitpos() const
Definition value.h:202
struct type * enclosing_type() const
Definition value.h:312
void set_lval(lval_type val)
Definition value.h:336
bool m_in_history
Definition value.h:652
bool entirely_unavailable()
Definition value.h:506
void set_bitsize(LONGEST bit)
Definition value.h:196
const struct lval_funcs * computed_funcs() const
Definition value.c:1349
void mark_bytes_unavailable(LONGEST offset, ULONGEST length)
Definition value.c:419
LONGEST embedded_offset() const
Definition value.h:244
gdb::array_view< const gdb_byte > contents()
Definition value.c:1262
LONGEST pointed_to_offset() const
Definition value.h:238
void require_available() const
Definition value.c:1093
void set_address(CORE_ADDR)
Definition value.c:1389
void allocate_contents(bool check_size)
Definition value.c:914
void set_lazy(bool val)
Definition value.h:268
bool m_stack
Definition value.h:645
void fetch_lazy_memory()
Definition value.c:3856
struct internalvar ** deprecated_internalvar_hack()
Definition value.h:361
void set_component_location(const struct value *whole)
Definition value.c:1599
bool entirely_available()
Definition value.c:209
bool contents_bits_eq(int offset1, const struct value *val2, int offset2, int length) const
Definition value.c:630
struct type * result_type_of_xmethod(gdb::array_view< value * > argv)
Definition value.c:2529
gdb::array_view< gdb_byte > contents_raw()
Definition value.c:1009
LONGEST m_bitpos
Definition value.h:701
struct type * type() const
Definition value.h:180
value * parent() const
Definition value.h:211
struct value * call_xmethod(gdb::array_view< value * > argv)
Definition value.c:2540
~value()
Definition value.c:151
void set_offset(LONGEST offset)
Definition value.h:225
bool bits_available(LONGEST offset, ULONGEST length) const
Definition value.c:173
CORE_ADDR raw_address() const
Definition value.c:1381
int record_latest()
Definition value.c:1666
bool entirely_optimized_out()
Definition value.h:529
void * closure
Definition value.h:686
void decref()
Definition value.c:1426
bool contents_eq(LONGEST offset1, const struct value *val2, LONGEST offset2, LONGEST length) const
Definition value.c:693
void incref()
Definition value.h:481
void set_pointed_to_offset(LONGEST val)
Definition value.h:241
void fetch_lazy_register()
Definition value.c:3885
LONGEST m_offset
Definition value.h:693
void require_not_optimized_out() const
Definition value.c:1080
void fetch_lazy_bitfield()
Definition value.c:3834
union value::@203 m_location
LONGEST m_bitsize
Definition value.h:696
DISABLE_COPY_AND_ASSIGN(value)
void * computed_closure() const
Definition value.c:1357
enum lval_type m_lval
Definition value.h:619
int * deprecated_regnum_hack()
Definition value.c:1403
bool set_limited_array_length()
Definition value.c:894
value(struct type *type_)
Definition value.h:134
void mark_bits_unavailable(LONGEST offset, ULONGEST length)
Definition value.c:413
bool entirely_covered_by_range_vector(const std::vector< range > &ranges)
Definition value.c:224
LONGEST offset() const
Definition value.h:222
enum lval_type lval() const
Definition value.h:332
struct type * m_enclosing_type
Definition value.h:758
void fetch_lazy()
Definition value.c:4001
struct value::@203::@204 reg
CORE_ADDR address
Definition value.h:658
gdb::array_view< gdb_byte > contents_all_raw()
Definition value.c:1021
void deprecated_set_type(struct type *type)
Definition value.h:186
static struct value * allocate_lazy(struct type *type)
Definition value.c:729
bool optimized_out()
Definition value.c:1279
value_ref_ptr m_parent
Definition value.h:713
bool bits_synthetic_pointer(LONGEST offset, LONGEST length) const
Definition value.c:1339
gdb::array_view< const gdb_byte > contents_for_printing()
Definition value.c:1100
bool stack() const
Definition value.h:317
enum return_value_convention struct_return_convention(struct gdbarch *gdbarch, struct value *function, struct type *value_type)
Definition value.c:3801
value * evaluate_var_value(enum noside noside, const block *blk, symbol *var)
Definition eval.c:520
struct value * value_from_register(struct type *type, int regnum, frame_info_ptr frame)
Definition findvar.c:833
void read_value_memory(struct value *val, LONGEST bit_offset, bool stack, CORE_ADDR memaddr, gdb_byte *buffer, size_t length)
Definition valops.c:1042
void set_internalvar_string(struct internalvar *var, const char *string)
Definition value.c:2243
struct value * value_from_contents(struct type *, const gdb_byte *)
Definition value.c:3581
struct value * value_of_internalvar(struct gdbarch *gdbarch, struct internalvar *var)
Definition value.c:2016
int symbol_read_needs_frame(struct symbol *)
Definition findvar.c:388
struct value * value_coerce_to_target(struct value *arg1)
Definition valops.c:1477
struct value * readjust_indirect_value_type(struct value *value, struct type *enc_type, const struct type *original_type, struct value *original_val, CORE_ADDR original_value_address)
Definition value.c:3727
int value_equal_contents(struct value *arg1, struct value *arg2)
Definition valarith.c:1630
bool value_logical_not(struct value *arg1)
Definition valarith.c:1501
struct value * varying_to_slice(struct value *)
bool overload_resolution
Definition valops.c:101
struct value * value_subscript(struct value *array, LONGEST index)
Definition valarith.c:141
struct value * value_at(struct type *type, CORE_ADDR addr)
Definition valops.c:1015
bool is_floating_value(struct value *val)
Definition value.c:2851
void value_print(struct value *val, struct ui_file *stream, const struct value_print_options *options)
Definition valprint.c:1191
struct value * coerce_ref_if_computed(const struct value *arg)
Definition value.c:3707
void clear_internalvar(struct internalvar *var)
Definition value.c:2265
struct value * value_struct_elt_bitpos(struct value **argp, int bitpos, struct type *field_type, const char *err)
Definition valops.c:2433
struct value * value_x_binop(struct value *arg1, struct value *arg2, enum exp_opcode op, enum exp_opcode otherop, enum noside noside)
Definition valarith.c:396
struct value * value_field(struct value *arg1, int fieldno)
Definition value.c:3052
struct value * default_value_from_register(struct gdbarch *gdbarch, struct type *type, int regnum, struct frame_id frame_id)
Definition findvar.c:752
struct value * value_neg(struct value *arg1)
Definition valarith.c:1722
CORE_ADDR unpack_pointer(struct type *type, const gdb_byte *valaddr)
Definition value.c:2843
CORE_ADDR value_as_address(struct value *val)
Definition value.c:2636
int compile_internalvar_to_ax(struct internalvar *var, struct agent_expr *expr, struct axs_value *value)
Definition value.c:1981
struct value * value_from_contents_and_address_unresolved(struct type *, const gdb_byte *, CORE_ADDR)
Definition value.c:3531
void finalize_values()
Definition value.c:4327
const char * internalvar_name(const struct internalvar *var)
Definition value.c:2287
void common_val_print(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
Definition valprint.c:1033
value * evaluate_var_msym_value(enum noside noside, struct objfile *objfile, minimal_symbol *msymbol)
Definition eval.c:569
struct value * value_allocate_space_in_inferior(int)
Definition valops.c:175
struct value * value_aggregate_elt(struct type *curtype, const char *name, struct type *expect_type, int want_address, enum noside noside)
Definition valops.c:3430
struct internalvar * create_internalvar(const char *name)
Definition value.c:1950
struct value * value_of_this_silent(const struct language_defn *lang)
Definition valops.c:4010
struct value * parse_to_comma_and_eval(const char **expp)
Definition eval.c:82
gdb_byte * baseclass_addr(struct type *type, int index, gdb_byte *valaddr, struct value **valuep, int *errp)
struct value * value_at_non_lval(struct type *type, CORE_ADDR addr)
Definition valops.c:1023
int value_bit_index(struct type *type, const gdb_byte *addr, int index)
Definition valarith.c:1825
struct value * value_from_ulongest(struct type *type, ULONGEST num)
Definition value.c:3450
struct value * value_of_register_lazy(frame_info_ptr frame, int regnum)
Definition findvar.c:273
struct value * value_slice(struct value *, int, int)
Definition valops.c:4030
const char * value_internal_function_name(struct value *)
Definition value.c:2305
struct value * value_of_register(int regnum, frame_info_ptr frame)
Definition findvar.c:253
void error_value_optimized_out(void)
Definition value.c:1074
int get_internalvar_integer(struct internalvar *var, LONGEST *l)
Definition value.c:2103
struct value * value_static_field(struct type *type, int fieldno)
Definition value.c:2870
struct internalvar * create_internalvar_type_lazy(const char *name, const struct internalvar_funcs *funcs, void *data)
Definition value.c:1966
struct value * value_one(struct type *type)
Definition valops.c:937
struct value * value_full_object(struct value *, struct type *, int, int, int)
Definition valops.c:3915
struct internalvar * lookup_only_internalvar(const char *name)
Definition value.c:1918
ULONGEST value_history_count()
Definition value.c:1736
std::string type_to_string(struct type *type)
Definition typeprint.c:399
void binop_promote(const struct language_defn *language, struct gdbarch *gdbarch, struct value **arg1, struct value **arg2)
Definition eval.c:255
int unpack_value_field_as_long(struct type *type, const gdb_byte *valaddr, LONGEST embedded_offset, int fieldno, const struct value *val, LONGEST *result)
Definition value.c:3178
struct value * value_from_longest(struct type *type, LONGEST num)
Definition value.c:3438
struct value * value_x_unop(struct value *arg1, enum exp_opcode op, enum noside noside)
Definition valarith.c:572
struct value * value_from_history_ref(const char *, const char **)
Definition value.c:3595
struct value * find_function_in_inferior(const char *, struct objfile **)
Definition valops.c:117
struct value * make_cv_value(int, int, struct value *)
Definition value.c:1555
CORE_ADDR address_from_register(int regnum, frame_info_ptr frame)
Definition findvar.c:883
struct value * value_literal_complex(struct value *, struct value *, struct type *)
Definition valops.c:4092
struct value * value_coerce_array(struct value *arg1)
Definition valops.c:1515
static bool value_true(struct value *val)
Definition value.h:1461
LONGEST parse_and_eval_long(const char *exp)
Definition eval.c:62
void add_internal_function(const char *name, const char *doc, internal_function_fn handler, void *cookie)
Definition value.c:2360
void set_internalvar(struct internalvar *var, struct value *val)
Definition value.c:2171
struct value * value_cast_pointers(struct type *, struct value *, int)
Definition valops.c:296
void typedef_print(struct type *type, struct symbol *news, struct ui_file *stream)
Definition typeprint.c:375
void complete_internalvar(completion_tracker &tracker, const char *name)
Definition value.c:1931
struct value * value_complement(struct value *arg1)
Definition valarith.c:1770
struct value * value_bitstring_subscript(struct type *type, struct value *bitstring, LONGEST index)
int val_print_string(struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
Definition valprint.c:2643
struct value * value_struct_elt(struct value **argp, gdb::optional< gdb::array_view< value * > > args, const char *name, int *static_memfuncp, const char *err)
Definition valops.c:2334
void preserve_values(struct objfile *)
Definition value.c:2441
bool value_must_coerce_to_target(struct value *arg1)
Definition valops.c:1449
struct value * value_of_variable(struct symbol *var, const struct block *b)
Definition valops.c:1386
struct value * value_addr(struct value *arg1)
Definition valops.c:1551
struct value * value_at_lazy(struct type *type, CORE_ADDR addr, frame_info_ptr frame=nullptr)
Definition valops.c:1036
struct value * value_repeat(struct value *arg1, int count)
Definition valops.c:1364
struct internalvar * lookup_internalvar(const char *name)
Definition value.c:2001
struct value * value_to_array(struct value *val)
Definition valarith.c:257
struct value * value_fn_field(struct value **arg1p, struct fn_field *f, int j, struct type *type, LONGEST offset)
Definition value.c:3065
LONGEST value_as_long(struct value *val)
Definition value.c:2554
struct value * value_pos(struct value *arg1)
Definition valarith.c:1704
struct value * value_array(int lowbound, gdb::array_view< struct value * > elemvec)
Definition valops.c:1695
void unop_promote(const struct language_defn *language, struct gdbarch *gdbarch, struct value **arg1)
Definition eval.c:222
void read_frame_register_value(struct value *value, frame_info_ptr frame)
Definition findvar.c:793
struct value * value_cast(struct type *type, struct value *arg2)
Definition valops.c:403
void modify_field(struct type *type, gdb_byte *addr, LONGEST fieldval, LONGEST bitpos, LONGEST bitsize)
Definition value.c:3280
struct value * value_vector_widen(struct value *scalar_value, struct type *vector_type)
Definition valarith.c:1373
void print_longest(struct ui_file *stream, int format, int use_local, LONGEST val)
Definition valprint.c:1335
int binop_user_defined_p(enum exp_opcode op, struct value *arg1, struct value *arg2)
Definition valarith.c:304
struct value * coerce_ref(struct value *value)
Definition value.c:3752
struct value * value_assign(struct value *toval, struct value *fromval)
Definition valops.c:1085
struct type * parse_and_eval_type(const char *p, int length)
Definition eval.c:2877
gdb_mpz value_as_mpz(struct value *val)
Definition value.c:2566
struct value * value_from_mpz(struct type *type, const gdb_mpz &v)
Definition value.c:3462
void print_floating(const gdb_byte *valaddr, struct type *type, struct ui_file *stream)
Definition valprint.c:1392
enum symbol_needs_kind symbol_read_needs(struct symbol *)
Definition findvar.c:347
void pack_long(gdb_byte *buf, struct type *type, LONGEST num)
Definition value.c:3327
void set_internalvar_integer(struct internalvar *var, LONGEST l)
Definition value.c:2232
int value_equal(struct value *arg1, struct value *arg2)
Definition valarith.c:1559
struct type * value_rtti_indirect_type(struct value *, int *, LONGEST *, int *)
Definition valops.c:3849
int print_address_demangle(const struct value_print_options *, struct gdbarch *, CORE_ADDR, struct ui_file *, int)
Definition printcmd.c:769
struct value * read_var_value(struct symbol *var, const struct block *var_block, frame_info_ptr frame)
Definition findvar.c:739
int binop_types_user_defined_p(enum exp_opcode op, struct type *type1, struct type *type2)
Definition valarith.c:279
struct value * value_real_part(struct value *value)
Definition valops.c:4116
bool exceeds_max_value_size(ULONGEST length)
Definition value.c:821
struct value * call_internal_function(struct gdbarch *gdbarch, const struct language_defn *language, struct value *function, int argc, struct value **argv)
Definition value.c:2318
struct value * value_from_host_double(struct type *type, double d)
Definition value.c:3514
struct value * value_field_bitfield(struct type *type, int fieldno, const gdb_byte *valaddr, LONGEST embedded_offset, const struct value *val)
Definition value.c:3259
int value_less(struct value *arg1, struct value *arg2)
Definition valarith.c:1648
struct value * value_coerce_function(struct value *arg1)
Definition valops.c:1535
std::vector< value_ref_ptr > value_release_to_mark(const struct value *mark)
Definition value.c:1475
void print_variable_and_value(const char *name, struct symbol *var, frame_info_ptr frame, struct ui_file *stream, int indent)
Definition printcmd.c:2397
struct value * value_from_pointer(struct type *type, CORE_ADDR addr)
Definition value.c:3500
struct type * value_actual_type(struct value *value, int resolve_simple_types, int *real_type_found)
Definition value.c:1032
struct value * value_ind(struct value *arg1)
Definition valops.c:1630
void type_print(struct type *type, const char *varstring, struct ui_file *stream, int show)
Definition typeprint.c:388
void fetch_subexp_value(struct expression *exp, expr::operation *op, struct value **valp, struct value **resultp, std::vector< value_ref_ptr > *val_chain, bool preserve_errors)
Definition eval.c:143
struct value * value_mark(void)
Definition value.c:1414
CORE_ADDR parse_and_eval_address(const char *exp)
Definition eval.c:52
struct value * value_from_contents_and_address(struct type *, const gdb_byte *, CORE_ADDR, frame_info_ptr frame=nullptr)
Definition value.c:3552
struct value * access_value_history(int num)
Definition value.c:1709
struct value * value_cstring(const gdb_byte *ptr, ssize_t count, struct type *char_type)
Definition valops.c:1738
void value_free_to_mark(const struct value *mark)
Definition value.c:1437
LONGEST unpack_bits_as_long(struct type *field_type, const gdb_byte *valaddr, LONGEST bitpos, LONGEST bitsize)
Definition value.c:3119
value_ref_ptr release_value(struct value *val)
Definition value.c:1450
int find_overload_match(gdb::array_view< value * > args, const char *name, enum oload_search_type method, struct value **objp, struct symbol *fsym, struct value **valp, struct symbol **symp, int *staticp, const int no_adl, enum noside noside)
Definition valops.c:2710
struct value * value_concat(struct value *arg1, struct value *arg2)
Definition valarith.c:684
struct value * value_ptradd(struct value *arg1, LONGEST arg2)
Definition valarith.c:79
struct value * value_from_component(struct value *, struct type *, LONGEST)
Definition value.c:3657
struct value *(* internal_function_fn)(struct gdbarch *gdbarch, const struct language_defn *language, void *cookie, int argc, struct value **argv)
Definition value.h:1581
struct value * value_ref(struct value *arg1, enum type_code refcode)
Definition valops.c:1609
LONGEST value_ptrdiff(struct value *arg1, struct value *arg2)
Definition valarith.c:100
struct value * coerce_array(struct value *value)
Definition value.c:3776
int using_struct_return(struct gdbarch *gdbarch, struct value *function, struct type *value_type)
Definition value.c:3819
oload_search_type
Definition value.h:1289
@ BOTH
Definition value.h:1289
@ METHOD
Definition value.h:1289
@ NON_METHOD
Definition value.h:1289
struct value * value_dynamic_cast(struct type *type, struct value *arg)
Definition valops.c:814
struct value * parse_and_eval(const char *exp, parser_flags flags=0)
Definition eval.c:70
struct value * address_of_variable(struct symbol *var, const struct block *b)
Definition valops.c:1397
gdb_mpq value_to_gdb_mpq(struct value *value)
Definition valops.c:338
struct value * allocate_repeat_value(struct type *type, int count)
Definition value.c:966
gdb::ref_ptr< struct value, value_ref_policy > value_ref_ptr
Definition value.h:124
struct value * value_binop(struct value *arg1, struct value *arg2, enum exp_opcode op)
Definition valarith.c:1464
void set_internalvar_component(struct internalvar *var, LONGEST offset, LONGEST bitpos, LONGEST bitsize, struct value *newvalue)
Definition value.c:2141
struct value * value_of_this(const struct language_defn *lang)
Definition valops.c:3985
struct value * value_imaginary_part(struct value *value)
Definition valops.c:4128
int destructor_name_p(const char *name, struct type *type)
Definition valops.c:3366
int unop_user_defined_p(enum exp_opcode op, struct value *arg1)
Definition valarith.c:317
struct value * value_reinterpret_cast(struct type *type, struct value *arg)
Definition valops.c:667
LONGEST unpack_field_as_long(struct type *type, const gdb_byte *valaddr, int fieldno)
Definition value.c:3203
LONGEST unpack_long(struct type *type, const gdb_byte *valaddr)
Definition value.c:2753
struct value * value_string(const gdb_byte *ptr, ssize_t count, struct type *char_type)
Definition valops.c:1757
struct value * register_value_being_returned(struct type *valtype, struct regcache *retbuf)