GDB (xrefs)
Loading...
Searching...
No Matches
cp-valprint.c
Go to the documentation of this file.
1/* Support for printing C++ values for GDB, the GNU debugger.
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#include "defs.h"
21#include "gdbsupport/gdb_obstack.h"
22#include "symtab.h"
23#include "gdbtypes.h"
24#include "expression.h"
25#include "value.h"
26#include "command.h"
27#include "gdbcmd.h"
28#include "demangle.h"
29#include "annotate.h"
30#include "c-lang.h"
31#include "target.h"
32#include "cp-abi.h"
33#include "valprint.h"
34#include "cp-support.h"
35#include "language.h"
36#include "extension.h"
37#include "typeprint.h"
38#include "gdbsupport/byte-vector.h"
39#include "gdbarch.h"
40#include "cli/cli-style.h"
41#include "gdbsupport/selftest.h"
42#include "selftest-arch.h"
43
44static struct obstack dont_print_vb_obstack;
45static struct obstack dont_print_statmem_obstack;
46static struct obstack dont_print_stat_array_obstack;
47
48static void cp_print_static_field (struct type *, struct value *,
49 struct ui_file *, int,
50 const struct value_print_options *);
51
52static void cp_print_value (struct value *, struct ui_file *,
53 int, const struct value_print_options *,
54 struct type **);
55
56
57/* GCC versions after 2.4.5 use this. */
58const char vtbl_ptr_name[] = "__vtbl_ptr_type";
59
60/* Return truth value for assertion that TYPE is of the type
61 "pointer to virtual function". */
62
63int
65{
66 const char *type_name = type->name ();
67
68 return (type_name != NULL && !strcmp (type_name, vtbl_ptr_name));
69}
70
71/* Return truth value for the assertion that TYPE is of the type
72 "pointer to virtual function table". */
73
74int
76{
77 /* With older versions of g++, the vtbl field pointed to an array of
78 structures. Nowadays it points directly to the structure. */
79 if (type->code () == TYPE_CODE_PTR)
80 {
81 type = type->target_type ();
82 if (type->code () == TYPE_CODE_ARRAY)
83 {
84 type = type->target_type ();
85 if (type->code () == TYPE_CODE_STRUCT /* if not using thunks */
86 || type->code () == TYPE_CODE_PTR) /* if using thunks */
87 {
88 /* Virtual functions tables are full of pointers
89 to virtual functions. */
91 }
92 }
93 else if (type->code () == TYPE_CODE_STRUCT) /* if not using thunks */
94 {
96 }
97 else if (type->code () == TYPE_CODE_PTR) /* if using thunks */
98 {
99 /* The type name of the thunk pointer is NULL when using
100 dwarf2. We could test for a pointer to a function, but
101 there is no type info for the virtual table either, so it
102 wont help. */
103 return cp_is_vtbl_ptr_type (type);
104 }
105 }
106 return 0;
107}
108
109/* Mutually recursive subroutines of cp_print_value and c_val_print to
110 print out a structure's fields: cp_print_value_fields and
111 cp_print_value.
112
113 TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the same
114 meanings as in cp_print_value and c_val_print.
115
116 2nd argument REAL_TYPE is used to carry over the type of the
117 derived class across the recursion to base classes.
118
119 DONT_PRINT is an array of baseclass types that we should not print,
120 or zero if called from top level. */
121
122void
123cp_print_value_fields (struct value *val, struct ui_file *stream,
124 int recurse, const struct value_print_options *options,
125 struct type **dont_print_vb,
126 int dont_print_statmem)
127{
128 int i, len, n_baseclasses;
129 int fields_seen = 0;
130 static int last_set_recurse = -1;
131
132 struct type *type = check_typedef (value_type (val));
133
134 if (recurse == 0)
135 {
136 /* Any object can be left on obstacks only during an unexpected
137 error. */
138
139 if (obstack_object_size (&dont_print_statmem_obstack) > 0)
140 {
141 obstack_free (&dont_print_statmem_obstack, NULL);
142 obstack_begin (&dont_print_statmem_obstack,
143 32 * sizeof (CORE_ADDR));
144 }
145 if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
146 {
147 obstack_free (&dont_print_stat_array_obstack, NULL);
148 obstack_begin (&dont_print_stat_array_obstack,
149 32 * sizeof (struct type *));
150 }
151 }
152
153 gdb_printf (stream, "{");
154 len = type->num_fields ();
155 n_baseclasses = TYPE_N_BASECLASSES (type);
156
157 /* First, print out baseclasses such that we don't print
158 duplicates of virtual baseclasses. */
159
160 if (n_baseclasses > 0)
161 cp_print_value (val, stream, recurse + 1, options, dont_print_vb);
162
163 /* Second, print out data fields */
164
165 /* If there are no data fields, skip this part */
166 if (len == n_baseclasses || !len)
167 fprintf_styled (stream, metadata_style.style (), "<No data fields>");
168 else
169 {
170 size_t statmem_obstack_initial_size = 0;
171 size_t stat_array_obstack_initial_size = 0;
172 struct type *vptr_basetype = NULL;
173 int vptr_fieldno;
174
175 if (dont_print_statmem == 0)
176 {
177 statmem_obstack_initial_size =
178 obstack_object_size (&dont_print_statmem_obstack);
179
180 if (last_set_recurse != recurse)
181 {
182 stat_array_obstack_initial_size =
183 obstack_object_size (&dont_print_stat_array_obstack);
184
185 last_set_recurse = recurse;
186 }
187 }
188
189 vptr_fieldno = get_vptr_fieldno (type, &vptr_basetype);
190 for (i = n_baseclasses; i < len; i++)
191 {
192 const gdb_byte *valaddr = value_contents_for_printing (val).data ();
193
194 /* If requested, skip printing of static fields. */
195 if (!options->static_field_print
196 && field_is_static (&type->field (i)))
197 continue;
198
199 if (fields_seen)
200 {
201 gdb_puts (",", stream);
202 if (!options->prettyformat)
203 gdb_puts (" ", stream);
204 }
205 else if (n_baseclasses > 0)
206 {
207 if (options->prettyformat)
208 {
209 gdb_printf (stream, "\n");
210 print_spaces (2 + 2 * recurse, stream);
211 gdb_puts ("members of ", stream);
212 gdb_puts (type->name (), stream);
213 gdb_puts (":", stream);
214 }
215 }
216 fields_seen = 1;
217
218 if (options->prettyformat)
219 {
220 gdb_printf (stream, "\n");
221 print_spaces (2 + 2 * recurse, stream);
222 }
223 else
224 {
225 stream->wrap_here (2 + 2 * recurse);
226 }
227
229
230 if (field_is_static (&type->field (i)))
231 {
232 gdb_puts ("static ", stream);
233 fprintf_symbol (stream,
234 type->field (i).name (),
236 DMGL_PARAMS | DMGL_ANSI);
237 }
238 else
239 fputs_styled (type->field (i).name (),
240 variable_name_style.style (), stream);
242
243 /* We tweak various options in a few cases below. */
244 value_print_options options_copy = *options;
245 value_print_options *opts = &options_copy;
246
247 /* Do not print leading '=' in case of anonymous
248 unions. */
249 if (strcmp (type->field (i).name (), ""))
250 gdb_puts (" = ", stream);
251 else
252 {
253 /* If this is an anonymous field then we want to consider it
254 as though it is at its parent's depth when it comes to the
255 max print depth. */
256 if (opts->max_depth != -1 && opts->max_depth < INT_MAX)
257 ++opts->max_depth;
258 }
260
261 if (!field_is_static (&type->field (i))
262 && TYPE_FIELD_PACKED (type, i))
263 {
264 struct value *v;
265
266 /* Bitfields require special handling, especially due to
267 byte order problems. */
268 if (TYPE_FIELD_IGNORE (type, i))
269 {
270 fputs_styled ("<optimized out or zero length>",
271 metadata_style.style (), stream);
272 }
274 (val, type->field (i).loc_bitpos (),
276 {
277 fputs_styled (_("<synthetic pointer>"),
278 metadata_style.style (), stream);
279 }
280 else
281 {
282 opts->deref_ref = 0;
283
284 v = value_field_bitfield (type, i, valaddr,
285 value_embedded_offset (val), val);
286
287 common_val_print (v, stream, recurse + 1,
288 opts, current_language);
289 }
290 }
291 else
292 {
293 if (TYPE_FIELD_IGNORE (type, i))
294 {
295 fputs_styled ("<optimized out or zero length>",
296 metadata_style.style (), stream);
297 }
298 else if (field_is_static (&type->field (i)))
299 {
300 try
301 {
302 struct value *v = value_static_field (type, i);
303
305 v, stream, recurse + 1,
306 opts);
307 }
308 catch (const gdb_exception_error &ex)
309 {
311 _("<error reading variable: %s>"),
312 ex.what ());
313 }
314 }
315 else if (i == vptr_fieldno && type == vptr_basetype)
316 {
317 int i_offset = type->field (i).loc_bitpos () / 8;
318 struct type *i_type = type->field (i).type ();
319
320 if (valprint_check_validity (stream, i_type, i_offset, val))
321 {
322 CORE_ADDR addr;
323
324 i_offset += value_embedded_offset (val);
325 addr = extract_typed_address (valaddr + i_offset, i_type);
327 type->arch (),
328 addr, stream);
329 }
330 }
331 else
332 {
333 struct value *v = value_primitive_field (val, 0, i, type);
334 opts->deref_ref = 0;
335 common_val_print (v, stream, recurse + 1, opts,
337 }
338 }
340 }
341
342 if (dont_print_statmem == 0)
343 {
344 size_t obstack_final_size =
345 obstack_object_size (&dont_print_statmem_obstack);
346
347 if (obstack_final_size > statmem_obstack_initial_size)
348 {
349 /* In effect, a pop of the printed-statics stack. */
350 size_t shrink_bytes
351 = statmem_obstack_initial_size - obstack_final_size;
352 obstack_blank_fast (&dont_print_statmem_obstack, shrink_bytes);
353 }
354
355 if (last_set_recurse != recurse)
356 {
357 obstack_final_size =
358 obstack_object_size (&dont_print_stat_array_obstack);
359
360 if (obstack_final_size > stat_array_obstack_initial_size)
361 {
362 void *free_to_ptr =
363 (char *) obstack_next_free (&dont_print_stat_array_obstack)
364 - (obstack_final_size
365 - stat_array_obstack_initial_size);
366
367 obstack_free (&dont_print_stat_array_obstack,
368 free_to_ptr);
369 }
370 last_set_recurse = -1;
371 }
372 }
373
374 if (options->prettyformat)
375 {
376 gdb_printf (stream, "\n");
377 print_spaces (2 * recurse, stream);
378 }
379 } /* if there are data fields */
380
381 gdb_printf (stream, "}");
382}
383
384/* Special val_print routine to avoid printing multiple copies of
385 virtual baseclasses. */
386
387static void
388cp_print_value (struct value *val, struct ui_file *stream,
389 int recurse, const struct value_print_options *options,
390 struct type **dont_print_vb)
391{
392 struct type *type = check_typedef (value_type (val));
393 CORE_ADDR address = value_address (val);
394 struct type **last_dont_print
395 = (struct type **) obstack_next_free (&dont_print_vb_obstack);
396 struct obstack tmp_obstack = dont_print_vb_obstack;
397 int i, n_baseclasses = TYPE_N_BASECLASSES (type);
398 const gdb_byte *valaddr = value_contents_for_printing (val).data ();
399
400 if (dont_print_vb == 0)
401 {
402 /* If we're at top level, carve out a completely fresh chunk of
403 the obstack and use that until this particular invocation
404 returns. */
405 /* Bump up the high-water mark. Now alpha is omega. */
406 obstack_finish (&dont_print_vb_obstack);
407 }
408
409 for (i = 0; i < n_baseclasses; i++)
410 {
411 LONGEST boffset = 0;
412 int skip = 0;
413 struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
414 const char *basename = baseclass->name ();
415 struct value *base_val = NULL;
416
417 if (BASETYPE_VIA_VIRTUAL (type, i))
418 {
419 struct type **first_dont_print
420 = (struct type **) obstack_base (&dont_print_vb_obstack);
421
422 int j = (struct type **)
423 obstack_next_free (&dont_print_vb_obstack) - first_dont_print;
424
425 while (--j >= 0)
426 if (baseclass == first_dont_print[j])
427 goto flush_it;
428
429 obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
430 }
431
432 try
433 {
434 boffset = baseclass_offset (type, i, valaddr,
436 address, val);
437 }
438 catch (const gdb_exception_error &ex)
439 {
440 if (ex.error == NOT_AVAILABLE_ERROR)
441 skip = -1;
442 else
443 skip = 1;
444 }
445
446 if (skip == 0)
447 {
448 if (BASETYPE_VIA_VIRTUAL (type, i))
449 {
450 /* The virtual base class pointer might have been
451 clobbered by the user program. Make sure that it
452 still points to a valid memory location. */
453
454 if (boffset < 0 || boffset >= type->length ())
455 {
456 gdb::byte_vector buf (baseclass->length ());
457
458 if (target_read_memory (address + boffset, buf.data (),
459 baseclass->length ()) != 0)
460 skip = 1;
461 base_val = value_from_contents_and_address (baseclass,
462 buf.data (),
463 address + boffset);
464 baseclass = value_type (base_val);
465 boffset = 0;
466 }
467 else
468 {
469 base_val = val;
470 }
471 }
472 else
473 {
474 base_val = val;
475 }
476 }
477
478 /* Now do the printing. */
479 if (options->prettyformat)
480 {
481 gdb_printf (stream, "\n");
482 print_spaces (2 * recurse, stream);
483 }
484 gdb_puts ("<", stream);
485 /* Not sure what the best notation is in the case where there is
486 no baseclass name. */
487 gdb_puts (basename ? basename : "", stream);
488 gdb_puts ("> = ", stream);
489
490 if (skip < 0)
491 val_print_unavailable (stream);
492 else if (skip > 0)
494 else
495 {
496 int result = 0;
497
498 if (!val_print_check_max_depth (stream, recurse, options,
500 {
501 struct value *baseclass_val = value_primitive_field (val, 0,
502 i, type);
503
504 /* Attempt to run an extension language pretty-printer on the
505 baseclass if possible. */
506 if (!options->raw)
507 result
508 = apply_ext_lang_val_pretty_printer (baseclass_val, stream,
509 recurse, options,
511
512 if (!result)
513 cp_print_value_fields (baseclass_val, stream, recurse, options,
514 ((struct type **)
515 obstack_base (&dont_print_vb_obstack)),
516 0);
517 }
518 }
519 gdb_puts (", ", stream);
520
521 flush_it:
522 ;
523 }
524
525 if (dont_print_vb == 0)
526 {
527 /* Free the space used to deal with the printing
528 of this type from top level. */
529 obstack_free (&dont_print_vb_obstack, last_dont_print);
530 /* Reset watermark so that we can continue protecting
531 ourselves from whatever we were protecting ourselves. */
532 dont_print_vb_obstack = tmp_obstack;
533 }
534}
535
536/* Print value of a static member. To avoid infinite recursion when
537 printing a class that contains a static instance of the class, we
538 keep the addresses of all printed static member classes in an
539 obstack and refuse to print them more than once.
540
541 VAL contains the value to print, TYPE, STREAM, RECURSE, and OPTIONS
542 have the same meanings as in c_val_print. */
543
544static void
546 struct value *val,
547 struct ui_file *stream,
548 int recurse,
549 const struct value_print_options *options)
550{
551 struct value_print_options opts;
552
554 {
555 val_print_optimized_out (val, stream);
556 return;
557 }
558
559 struct type *real_type = check_typedef (type);
560 if (real_type->code () == TYPE_CODE_STRUCT)
561 {
562 CORE_ADDR *first_dont_print;
563 CORE_ADDR addr = value_address (val);
564 int i;
565
566 first_dont_print
567 = (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
568 i = obstack_object_size (&dont_print_statmem_obstack)
569 / sizeof (CORE_ADDR);
570
571 while (--i >= 0)
572 {
573 if (addr == first_dont_print[i])
574 {
575 fputs_styled (_("<same as static member of an already"
576 " seen type>"),
577 metadata_style.style (), stream);
578 return;
579 }
580 }
581
582 obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
583 sizeof (CORE_ADDR));
584 cp_print_value_fields (val, stream, recurse, options, NULL, 1);
585 return;
586 }
587
588 if (real_type->code () == TYPE_CODE_ARRAY)
589 {
590 struct type **first_dont_print;
591 int i;
592 struct type *target_type = type->target_type ();
593
594 first_dont_print
595 = (struct type **) obstack_base (&dont_print_stat_array_obstack);
596 i = obstack_object_size (&dont_print_stat_array_obstack)
597 / sizeof (struct type *);
598
599 while (--i >= 0)
600 {
601 if (target_type == first_dont_print[i])
602 {
603 fputs_styled (_("<same as static member of an already"
604 " seen type>"),
605 metadata_style.style (), stream);
606 return;
607 }
608 }
609
610 obstack_grow (&dont_print_stat_array_obstack,
611 (char *) &target_type,
612 sizeof (struct type *));
613 }
614
615 opts = *options;
616 opts.deref_ref = 0;
617 common_val_print (val, stream, recurse, &opts, current_language);
618}
619
620/* Find the field in *SELF, or its non-virtual base classes, with
621 bit offset OFFSET. Set *SELF to the containing type and *FIELDNO
622 to the containing field number. If OFFSET is not exactly at the
623 start of some field, set *SELF to NULL. */
624
625static void
626cp_find_class_member (struct type **self_p, int *fieldno,
627 LONGEST offset)
628{
629 struct type *self;
630 unsigned int i;
631 unsigned len;
632
633 *self_p = check_typedef (*self_p);
634 self = *self_p;
635 len = self->num_fields ();
636
637 for (i = TYPE_N_BASECLASSES (self); i < len; i++)
638 {
639 field &f = self->field (i);
640 if (field_is_static (&f))
641 continue;
642 LONGEST bitpos = f.loc_bitpos ();
643
644 QUIT;
645 if (offset == bitpos)
646 {
647 *fieldno = i;
648 return;
649 }
650 }
651
652 for (i = 0; i < TYPE_N_BASECLASSES (self); i++)
653 {
654 LONGEST bitpos = self->field (i).loc_bitpos ();
655 LONGEST bitsize = 8 * self->field (i).type ()->length ();
656
657 if (offset >= bitpos && offset < bitpos + bitsize)
658 {
659 *self_p = self->field (i).type ();
660 cp_find_class_member (self_p, fieldno, offset - bitpos);
661 return;
662 }
663 }
664
665 *self_p = NULL;
666}
667
668void
669cp_print_class_member (const gdb_byte *valaddr, struct type *type,
670 struct ui_file *stream, const char *prefix)
671{
672 enum bfd_endian byte_order = type_byte_order (type);
673
674 /* VAL is a byte offset into the structure type SELF_TYPE.
675 Find the name of the field for that offset and
676 print it. */
677 struct type *self_type = TYPE_SELF_TYPE (type);
678 LONGEST val;
679 int fieldno;
680
681 val = extract_signed_integer (valaddr,
682 type->length (),
683 byte_order);
684
685 /* Pointers to data members are usually byte offsets into an object.
686 Because a data member can have offset zero, and a NULL pointer to
687 member must be distinct from any valid non-NULL pointer to
688 member, either the value is biased or the NULL value has a
689 special representation; both are permitted by ISO C++. HP aCC
690 used a bias of 0x20000000; HP cfront used a bias of 1; g++ 3.x
691 and other compilers which use the Itanium ABI use -1 as the NULL
692 value. GDB only supports that last form; to add support for
693 another form, make this into a cp-abi hook. */
694
695 if (val == -1)
696 {
697 gdb_printf (stream, "NULL");
698 return;
699 }
700
701 cp_find_class_member (&self_type, &fieldno, val << 3);
702
703 if (self_type != NULL)
704 {
705 const char *name;
706
707 gdb_puts (prefix, stream);
708 name = self_type->name ();
709 if (name)
710 gdb_puts (name, stream);
711 else
712 c_type_print_base (self_type, stream, 0, 0, &type_print_raw_options);
713 gdb_printf (stream, "::");
714 fputs_styled (self_type->field (fieldno).name (),
715 variable_name_style.style (), stream);
716 }
717 else
718 gdb_printf (stream, "%ld", (long) val);
719}
720
721#if GDB_SELF_TEST
722
723/* Test printing of TYPE_CODE_STRUCT values. */
724
725static void
726test_print_fields (gdbarch *arch)
727{
728 struct field *f;
729 type *uint8_type = builtin_type (arch)->builtin_uint8;
730 type *bool_type = builtin_type (arch)->builtin_bool;
731 type *the_struct = arch_composite_type (arch, NULL, TYPE_CODE_STRUCT);
732 the_struct->set_length (4);
733
734 /* Value: 1110 1001
735 Fields: C-BB B-A- */
736 if (gdbarch_byte_order (arch) == BFD_ENDIAN_LITTLE)
737 {
738 f = append_composite_type_field_raw (the_struct, "A", bool_type);
739 f->set_loc_bitpos (1);
740 FIELD_BITSIZE (*f) = 1;
741 f = append_composite_type_field_raw (the_struct, "B", uint8_type);
742 f->set_loc_bitpos (3);
743 FIELD_BITSIZE (*f) = 3;
744 f = append_composite_type_field_raw (the_struct, "C", bool_type);
745 f->set_loc_bitpos (7);
746 FIELD_BITSIZE (*f) = 1;
747 }
748 /* According to the logic commented in "make_gdb_type_struct ()" of
749 * target-descriptions.c, bit positions are numbered differently for
750 * little and big endians. */
751 else
752 {
753 f = append_composite_type_field_raw (the_struct, "A", bool_type);
754 f->set_loc_bitpos (30);
755 FIELD_BITSIZE (*f) = 1;
756 f = append_composite_type_field_raw (the_struct, "B", uint8_type);
757 f->set_loc_bitpos (26);
758 FIELD_BITSIZE (*f) = 3;
759 f = append_composite_type_field_raw (the_struct, "C", bool_type);
760 f->set_loc_bitpos (24);
761 FIELD_BITSIZE (*f) = 1;
762 }
763
764 value *val = allocate_value (the_struct);
765 gdb_byte *contents = value_contents_writeable (val).data ();
766 store_unsigned_integer (contents, value_enclosing_type (val)->length (),
767 gdbarch_byte_order (arch), 0xe9);
768
769 string_file out;
772 cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
773 SELF_CHECK (out.string () == "{A = false, B = 5, C = true}");
774
775 out.clear();
776 opts.format = 'x';
777 cp_print_value_fields(val, &out, 0, &opts, NULL, 0);
778 SELF_CHECK (out.string () == "{A = 0x0, B = 0x5, C = 0x1}");
779}
780
781#endif
782
783
785void
787{
788#if GDB_SELF_TEST
789 selftests::register_test_foreach_arch ("print-fields", test_print_fields);
790#endif
791
792 obstack_begin (&dont_print_stat_array_obstack,
793 32 * sizeof (struct type *));
794 obstack_begin (&dont_print_statmem_obstack,
795 32 * sizeof (CORE_ADDR));
796 obstack_begin (&dont_print_vb_obstack,
797 32 * sizeof (struct type *));
798}
const char *const name
void annotate_field_value(void)
Definition annotate.c:265
void annotate_field_begin(struct type *type)
Definition annotate.c:247
void annotate_field_name_end(void)
Definition annotate.c:258
void annotate_field_end(void)
Definition annotate.c:272
void f()
Definition 1.cc:36
void c_type_print_base(struct type *, struct ui_file *, int, int, const struct type_print_options *)
ui_file_style style() const
Definition cli-style.c:169
const std::string & string()
Definition ui-file.h:194
void clear()
Definition ui-file.h:221
virtual void wrap_here(int indent)
Definition ui-file.h:117
cli_style_option variable_name_style
cli_style_option metadata_style
int baseclass_offset(struct type *type, int index, const gdb_byte *valaddr, LONGEST embedded_offset, CORE_ADDR address, const struct value *val)
Definition cp-abi.c:68
static void cp_find_class_member(struct type **self_p, int *fieldno, LONGEST offset)
static struct obstack dont_print_vb_obstack
Definition cp-valprint.c:44
static void cp_print_value(struct value *, struct ui_file *, int, const struct value_print_options *, struct type **)
static struct obstack dont_print_statmem_obstack
Definition cp-valprint.c:45
void _initialize_cp_valprint()
int cp_is_vtbl_ptr_type(struct type *type)
Definition cp-valprint.c:64
static void cp_print_static_field(struct type *, struct value *, struct ui_file *, int, const struct value_print_options *)
int cp_is_vtbl_member(struct type *type)
Definition cp-valprint.c:75
void cp_print_class_member(const gdb_byte *valaddr, struct type *type, struct ui_file *stream, const char *prefix)
static struct obstack dont_print_stat_array_obstack
Definition cp-valprint.c:46
const char vtbl_ptr_name[]
Definition cp-valprint.c:58
void cp_print_value_fields(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, struct type **dont_print_vb, int dont_print_statmem)
static void store_unsigned_integer(gdb_byte *addr, int len, enum bfd_endian byte_order, ULONGEST val)
Definition defs.h:561
CORE_ADDR extract_typed_address(const gdb_byte *buf, struct type *type)
Definition findvar.c:153
#define INT_MAX
Definition defs.h:457
static LONGEST extract_signed_integer(gdb::array_view< const gdb_byte > buf, enum bfd_endian byte_order)
Definition defs.h:511
#define QUIT
Definition defs.h:186
int apply_ext_lang_val_pretty_printer(struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
Definition extension.c:477
enum bfd_endian gdbarch_byte_order(struct gdbarch *gdbarch)
Definition gdbarch.c:1370
enum bfd_endian type_byte_order(const struct type *type)
Definition gdbtypes.c:4018
int field_is_static(struct field *f)
Definition gdbtypes.c:5048
struct type * arch_composite_type(struct gdbarch *gdbarch, const char *name, enum type_code code)
Definition gdbtypes.c:5989
struct field * append_composite_type_field_raw(struct type *t, const char *name, struct type *field)
Definition gdbtypes.c:6006
int get_vptr_fieldno(struct type *type, struct type **basetypep)
Definition gdbtypes.c:2024
struct type * check_typedef(struct type *type)
Definition gdbtypes.c:3010
#define TYPE_SELF_TYPE(thistype)
Definition gdbtypes.h:2074
#define TYPE_BASECLASS(thistype, index)
Definition gdbtypes.h:2107
#define TYPE_FIELD_IGNORE(thistype, n)
Definition gdbtypes.h:2148
#define TYPE_FIELD_BITSIZE(thistype, n)
Definition gdbtypes.h:2123
#define TYPE_FIELD_PACKED(thistype, n)
Definition gdbtypes.h:2124
#define BASETYPE_VIA_VIRTUAL(thistype, index)
Definition gdbtypes.h:2115
#define TYPE_N_BASECLASSES(thistype)
Definition gdbtypes.h:2108
#define FIELD_BITSIZE(thisfld)
Definition gdbtypes.h:2120
const struct language_defn * current_language
Definition language.c:83
void register_test_foreach_arch(const std::string &name, self_test_foreach_arch_function *function)
#define prefix(a, b, R, do)
Definition ppc64-tdep.c:52
struct type * builtin_bool
Definition gdbtypes.h:2263
struct type * builtin_uint8
Definition gdbtypes.h:2282
LONGEST loc_bitpos() const
Definition gdbtypes.h:586
const char * name() const
Definition gdbtypes.h:569
struct type * type() const
Definition gdbtypes.h:559
enum language la_language
Definition language.h:275
struct type * target_type() const
Definition gdbtypes.h:1000
type_code code() const
Definition gdbtypes.h:927
ULONGEST length() const
Definition gdbtypes.h:954
struct field & field(int idx) const
Definition gdbtypes.h:983
int num_fields() const
Definition gdbtypes.h:965
gdbarch * arch() const
Definition gdbtypes.c:245
void set_length(ULONGEST length)
Definition gdbtypes.h:959
const char * name() const
Definition gdbtypes.h:939
enum val_prettyformat prettyformat
Definition valprint.h:30
Definition value.c:181
int target_read_memory(CORE_ADDR memaddr, gdb_byte *myaddr, ssize_t len)
Definition target.c:1771
const struct type_print_options type_print_raw_options
Definition typeprint.c:41
void print_spaces(int n, struct ui_file *stream)
Definition utils.c:1947
void fprintf_styled(struct ui_file *stream, const ui_file_style &style, const char *format,...)
Definition utils.c:1877
void gdb_printf(struct ui_file *stream, const char *format,...)
Definition utils.c:1865
void fputs_styled(const char *linebuffer, const ui_file_style &style, struct ui_file *stream)
Definition utils.c:1796
void fprintf_symbol(struct ui_file *stream, const char *name, enum language lang, int arg_mode)
Definition utils.c:1960
void gdb_puts(const char *linebuffer, struct ui_file *stream)
Definition utils.c:1788
void get_no_prettyformat_print_options(struct value_print_options *opts)
Definition valprint.c:136
void val_print_unavailable(struct ui_file *stream)
Definition valprint.c:411
int valprint_check_validity(struct ui_file *stream, struct type *type, LONGEST embedded_offset, const struct value *val)
Definition valprint.c:332
void val_print_optimized_out(const struct value *val, struct ui_file *stream)
Definition valprint.c:396
bool val_print_check_max_depth(struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
Definition valprint.c:1085
void val_print_invalid_address(struct ui_file *stream)
Definition valprint.c:417
void common_val_print(struct value *value, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
Definition valprint.c:1014
void print_function_pointer_address(const struct value_print_options *options, struct gdbarch *gdbarch, CORE_ADDR address, struct ui_file *stream)
Definition valprint.c:1885
struct type * value_type(const struct value *value)
Definition value.c:1109
int value_entirely_optimized_out(struct value *value)
Definition value.c:453
LONGEST value_embedded_offset(const struct value *value)
Definition value.c:1555
struct value * allocate_value(struct type *type)
Definition value.c:1053
struct value * value_primitive_field(struct value *arg1, LONGEST offset, int fieldno, struct type *arg_type)
Definition value.c:3105
struct value * value_static_field(struct type *type, int fieldno)
Definition value.c:3039
CORE_ADDR value_address(const struct value *value)
Definition value.c:1607
gdb::array_view< gdb_byte > value_contents_writeable(struct value *value)
Definition value.c:1473
gdb::array_view< const gdb_byte > value_contents_for_printing(struct value *value)
Definition value.c:1265
struct value * value_field_bitfield(struct type *type, int fieldno, const gdb_byte *valaddr, LONGEST embedded_offset, const struct value *val)
Definition value.c:3444
struct type * value_enclosing_type(const struct value *value)
Definition value.c:1189
int value_bits_synthetic_pointer(const struct value *value, LONGEST offset, LONGEST length)
Definition value.c:1543
struct value * value_from_contents_and_address(struct type *type, const gdb_byte *valaddr, CORE_ADDR address)
Definition value.c:3703