PR 10867
[platform/upstream/binutils.git] / gdb / cp-valprint.c
1 /* Support for printing C++ values for GDB, the GNU debugger.
2
3    Copyright (C) 1986, 1988, 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997,
4    2000, 2001, 2002, 2003, 2005, 2006, 2007, 2008, 2009, 2010
5    Free Software Foundation, Inc.
6
7    This file is part of GDB.
8
9    This program is free software; you can redistribute it and/or modify
10    it under the terms of the GNU General Public License as published by
11    the Free Software Foundation; either version 3 of the License, or
12    (at your option) any later version.
13
14    This program is distributed in the hope that it will be useful,
15    but WITHOUT ANY WARRANTY; without even the implied warranty of
16    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
17    GNU General Public License for more details.
18
19    You should have received a copy of the GNU General Public License
20    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
21
22 #include "defs.h"
23 #include "gdb_obstack.h"
24 #include "symtab.h"
25 #include "gdbtypes.h"
26 #include "expression.h"
27 #include "value.h"
28 #include "command.h"
29 #include "gdbcmd.h"
30 #include "demangle.h"
31 #include "annotate.h"
32 #include "gdb_string.h"
33 #include "c-lang.h"
34 #include "target.h"
35 #include "cp-abi.h"
36 #include "valprint.h"
37 #include "cp-support.h"
38 #include "language.h"
39 #include "python/python.h"
40
41 /* Controls printing of vtbl's */
42 static void
43 show_vtblprint (struct ui_file *file, int from_tty,
44                 struct cmd_list_element *c, const char *value)
45 {
46   fprintf_filtered (file, _("\
47 Printing of C++ virtual function tables is %s.\n"),
48                     value);
49 }
50
51 /* Controls looking up an object's derived type using what we find in
52    its vtables.  */
53 static void
54 show_objectprint (struct ui_file *file, int from_tty,
55                   struct cmd_list_element *c,
56                   const char *value)
57 {
58   fprintf_filtered (file, _("\
59 Printing of object's derived type based on vtable info is %s.\n"),
60                     value);
61 }
62
63 static void
64 show_static_field_print (struct ui_file *file, int from_tty,
65                          struct cmd_list_element *c, const char *value)
66 {
67   fprintf_filtered (file, _("Printing of C++ static members is %s.\n"),
68                     value);
69 }
70
71
72 static struct obstack dont_print_vb_obstack;
73 static struct obstack dont_print_statmem_obstack;
74 static struct obstack dont_print_stat_array_obstack;
75
76 extern void _initialize_cp_valprint (void);
77
78 static void cp_print_static_field (struct type *, struct value *,
79                                    struct ui_file *, int,
80                                    const struct value_print_options *);
81
82 static void cp_print_value (struct type *, struct type *, const gdb_byte *,
83                             int, CORE_ADDR, struct ui_file *, int,
84                             const struct value_print_options *, struct type **);
85
86
87 /* GCC versions after 2.4.5 use this.  */
88 const char vtbl_ptr_name[] = "__vtbl_ptr_type";
89
90 /* Return truth value for assertion that TYPE is of the type
91    "pointer to virtual function".  */
92
93 int
94 cp_is_vtbl_ptr_type (struct type *type)
95 {
96   char *typename = type_name_no_tag (type);
97
98   return (typename != NULL && !strcmp (typename, vtbl_ptr_name));
99 }
100
101 /* Return truth value for the assertion that TYPE is of the type
102    "pointer to virtual function table".  */
103
104 int
105 cp_is_vtbl_member (struct type *type)
106 {
107   /* With older versions of g++, the vtbl field pointed to an array
108      of structures.  Nowadays it points directly to the structure. */
109   if (TYPE_CODE (type) == TYPE_CODE_PTR)
110     {
111       type = TYPE_TARGET_TYPE (type);
112       if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
113         {
114           type = TYPE_TARGET_TYPE (type);
115           if (TYPE_CODE (type) == TYPE_CODE_STRUCT      /* if not using thunks */
116               || TYPE_CODE (type) == TYPE_CODE_PTR)     /* if using thunks */
117             {
118               /* Virtual functions tables are full of pointers
119                  to virtual functions. */
120               return cp_is_vtbl_ptr_type (type);
121             }
122         }
123       else if (TYPE_CODE (type) == TYPE_CODE_STRUCT)  /* if not using thunks */
124         {
125           return cp_is_vtbl_ptr_type (type);
126         }
127       else if (TYPE_CODE (type) == TYPE_CODE_PTR)     /* if using thunks */
128         {
129           /* The type name of the thunk pointer is NULL when using dwarf2.
130              We could test for a pointer to a function, but there is
131              no type info for the virtual table either, so it wont help.  */
132           return cp_is_vtbl_ptr_type (type);
133         }
134     }
135   return 0;
136 }
137
138 /* Mutually recursive subroutines of cp_print_value and c_val_print to
139    print out a structure's fields: cp_print_value_fields and cp_print_value.
140
141    TYPE, VALADDR, ADDRESS, STREAM, RECURSE, and OPTIONS have the
142    same meanings as in cp_print_value and c_val_print.
143
144    2nd argument REAL_TYPE is used to carry over the type of the derived
145    class across the recursion to base classes. 
146
147    DONT_PRINT is an array of baseclass types that we
148    should not print, or zero if called from top level.  */
149
150 void
151 cp_print_value_fields (struct type *type, struct type *real_type,
152                        const gdb_byte *valaddr, int offset, CORE_ADDR address,
153                        struct ui_file *stream, int recurse,
154                        const struct value_print_options *options,
155                        struct type **dont_print_vb, int dont_print_statmem)
156 {
157   int i, len, n_baseclasses;
158   int fields_seen = 0;
159   static int last_set_recurse = -1;
160
161   CHECK_TYPEDEF (type);
162   
163   if (recurse == 0)
164     {
165       if (obstack_object_size (&dont_print_statmem_obstack) > 0)
166         obstack_free (&dont_print_statmem_obstack, NULL);
167       if (obstack_object_size (&dont_print_stat_array_obstack) > 0)
168         obstack_free (&dont_print_stat_array_obstack, NULL);
169     }
170
171   fprintf_filtered (stream, "{");
172   len = TYPE_NFIELDS (type);
173   n_baseclasses = TYPE_N_BASECLASSES (type);
174
175   /* First, print out baseclasses such that we don't print
176      duplicates of virtual baseclasses.  */
177
178   if (n_baseclasses > 0)
179     cp_print_value (type, real_type, valaddr, offset, address, stream,
180                     recurse + 1, options, dont_print_vb);
181
182   /* Second, print out data fields */
183
184   /* If there are no data fields, skip this part */
185   if (len == n_baseclasses || !len)
186     fprintf_filtered (stream, "<No data fields>");
187   else
188     {
189       void *statmem_obstack_top = NULL;
190       void *stat_array_obstack_top = NULL;
191       
192       if (dont_print_statmem == 0)
193         {
194           /* Set the current printed-statics stack top.  */
195           statmem_obstack_top
196             = obstack_next_free (&dont_print_statmem_obstack);
197
198           if (last_set_recurse != recurse)
199             {
200               stat_array_obstack_top
201                 = obstack_next_free (&dont_print_stat_array_obstack);
202               last_set_recurse = recurse;
203             }
204         }
205
206       for (i = n_baseclasses; i < len; i++)
207         {
208           /* If requested, skip printing of static fields.  */
209           if (!options->static_field_print
210               && field_is_static (&TYPE_FIELD (type, i)))
211             continue;
212
213           if (fields_seen)
214             fprintf_filtered (stream, ", ");
215           else if (n_baseclasses > 0)
216             {
217               if (options->pretty)
218                 {
219                   fprintf_filtered (stream, "\n");
220                   print_spaces_filtered (2 + 2 * recurse, stream);
221                   fputs_filtered ("members of ", stream);
222                   fputs_filtered (type_name_no_tag (type), stream);
223                   fputs_filtered (": ", stream);
224                 }
225             }
226           fields_seen = 1;
227
228           if (options->pretty)
229             {
230               fprintf_filtered (stream, "\n");
231               print_spaces_filtered (2 + 2 * recurse, stream);
232             }
233           else
234             {
235               wrap_here (n_spaces (2 + 2 * recurse));
236             }
237           if (options->inspect_it)
238             {
239               if (TYPE_CODE (TYPE_FIELD_TYPE (type, i)) == TYPE_CODE_PTR)
240                 fputs_filtered ("\"( ptr \"", stream);
241               else
242                 fputs_filtered ("\"( nodef \"", stream);
243               if (field_is_static (&TYPE_FIELD (type, i)))
244                 fputs_filtered ("static ", stream);
245               fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
246                                        current_language->la_language,
247                                        DMGL_PARAMS | DMGL_ANSI);
248               fputs_filtered ("\" \"", stream);
249               fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
250                                        current_language->la_language,
251                                        DMGL_PARAMS | DMGL_ANSI);
252               fputs_filtered ("\") \"", stream);
253             }
254           else
255             {
256               annotate_field_begin (TYPE_FIELD_TYPE (type, i));
257
258               if (field_is_static (&TYPE_FIELD (type, i)))
259                 fputs_filtered ("static ", stream);
260               fprintf_symbol_filtered (stream, TYPE_FIELD_NAME (type, i),
261                                        current_language->la_language,
262                                        DMGL_PARAMS | DMGL_ANSI);
263               annotate_field_name_end ();
264               /* do not print leading '=' in case of anonymous unions */
265               if (strcmp (TYPE_FIELD_NAME (type, i), ""))
266                 fputs_filtered (" = ", stream);
267               annotate_field_value ();
268             }
269
270           if (!field_is_static (&TYPE_FIELD (type, i))
271               && TYPE_FIELD_PACKED (type, i))
272             {
273               struct value *v;
274
275               /* Bitfields require special handling, especially due to byte
276                  order problems.  */
277               if (TYPE_FIELD_IGNORE (type, i))
278                 {
279                   fputs_filtered ("<optimized out or zero length>", stream);
280                 }
281               else
282                 {
283                   struct value_print_options opts = *options;
284                   opts.deref_ref = 0;
285                   v = value_from_longest
286                     (TYPE_FIELD_TYPE (type, i), 
287                      unpack_field_as_long (type, valaddr + offset, i));
288
289                   common_val_print (v, stream, recurse + 1, &opts,
290                                     current_language);
291                 }
292             }
293           else
294             {
295               if (TYPE_FIELD_IGNORE (type, i))
296                 {
297                   fputs_filtered ("<optimized out or zero length>", stream);
298                 }
299               else if (field_is_static (&TYPE_FIELD (type, i)))
300                 {
301                   struct value *v = value_static_field (type, i);
302                   if (v == NULL)
303                     fputs_filtered ("<optimized out>", stream);
304                   else
305                     cp_print_static_field (TYPE_FIELD_TYPE (type, i), v,
306                                            stream, recurse + 1, options);
307                 }
308               else
309                 {
310                   struct value_print_options opts = *options;
311                   opts.deref_ref = 0;
312                   val_print (TYPE_FIELD_TYPE (type, i),
313                              valaddr, offset + TYPE_FIELD_BITPOS (type, i) / 8,
314                              address,
315                              stream, recurse + 1, &opts,
316                              current_language);
317                 }
318             }
319           annotate_field_end ();
320         }
321
322       if (dont_print_statmem == 0)
323         {
324           if (obstack_object_size (&dont_print_statmem_obstack) > 0) 
325             obstack_free (&dont_print_statmem_obstack, statmem_obstack_top);
326
327           if (last_set_recurse != recurse)
328             {
329               if (obstack_object_size (&dont_print_stat_array_obstack) > 0) 
330                 obstack_free (&dont_print_stat_array_obstack,
331                               stat_array_obstack_top);
332               last_set_recurse = -1;
333             }
334         }
335
336       if (options->pretty)
337         {
338           fprintf_filtered (stream, "\n");
339           print_spaces_filtered (2 * recurse, stream);
340         }
341     }                           /* if there are data fields */
342
343   fprintf_filtered (stream, "}");
344 }
345
346 /* Like cp_print_value_fields, but find the runtime type of the object
347    and pass it as the `real_type' argument to cp_print_value_fields.
348    This function is a hack to work around the fact that
349    common_val_print passes the embedded offset to val_print, but not
350    the enclosing type.  */
351
352 void
353 cp_print_value_fields_rtti (struct type *type,
354                             const gdb_byte *valaddr, int offset,
355                             CORE_ADDR address,
356                             struct ui_file *stream, int recurse,
357                             const struct value_print_options *options,
358                             struct type **dont_print_vb, int dont_print_statmem)
359 {
360   struct value *value;
361   int full, top, using_enc;
362   struct type *real_type;
363
364   /* Ugh, we have to convert back to a value here.  */
365   value = value_from_contents_and_address (type, valaddr + offset,
366                                            address + offset);
367   /* We don't actually care about most of the result here -- just the
368      type.  We already have the correct offset, due to how val_print
369      was initially called.  */
370   real_type = value_rtti_type (value, &full, &top, &using_enc);
371   if (!real_type)
372     real_type = type;
373
374   cp_print_value_fields (type, real_type, valaddr, offset,
375                          address, stream, recurse, options,
376                          dont_print_vb, dont_print_statmem);
377 }
378
379 /* Special val_print routine to avoid printing multiple copies of virtual
380    baseclasses.  */
381
382 static void
383 cp_print_value (struct type *type, struct type *real_type,
384                 const gdb_byte *valaddr, int offset, CORE_ADDR address,
385                 struct ui_file *stream, int recurse,
386                 const struct value_print_options *options,
387                 struct type **dont_print_vb)
388 {
389   struct type **last_dont_print
390     = (struct type **) obstack_next_free (&dont_print_vb_obstack);
391   struct obstack tmp_obstack = dont_print_vb_obstack;
392   int i, n_baseclasses = TYPE_N_BASECLASSES (type);
393   int thisoffset;
394   struct type *thistype;
395
396   if (dont_print_vb == 0)
397     {
398       /* If we're at top level, carve out a completely fresh
399          chunk of the obstack and use that until this particular
400          invocation returns.  */
401       /* Bump up the high-water mark.  Now alpha is omega.  */
402       obstack_finish (&dont_print_vb_obstack);
403     }
404
405   for (i = 0; i < n_baseclasses; i++)
406     {
407       int boffset;
408       int skip;
409       struct type *baseclass = check_typedef (TYPE_BASECLASS (type, i));
410       char *basename = TYPE_NAME (baseclass);
411       const gdb_byte *base_valaddr;
412
413       if (BASETYPE_VIA_VIRTUAL (type, i))
414         {
415           struct type **first_dont_print
416             = (struct type **) obstack_base (&dont_print_vb_obstack);
417
418           int j = (struct type **) obstack_next_free (&dont_print_vb_obstack)
419             - first_dont_print;
420
421           while (--j >= 0)
422             if (baseclass == first_dont_print[j])
423               goto flush_it;
424
425           obstack_ptr_grow (&dont_print_vb_obstack, baseclass);
426         }
427
428       thisoffset = offset;
429       thistype = real_type;
430
431       boffset = baseclass_offset (type, i, valaddr + offset, address + offset);
432       skip = ((boffset == -1) || (boffset + offset) < 0) ? 1 : -1;
433
434       if (BASETYPE_VIA_VIRTUAL (type, i))
435         {
436           /* The virtual base class pointer might have been
437              clobbered by the user program. Make sure that it
438              still points to a valid memory location.  */
439
440           if (boffset != -1
441               && ((boffset + offset) < 0
442                   || (boffset + offset) >= TYPE_LENGTH (real_type)))
443             {
444               /* FIXME (alloca): unsafe if baseclass is really really large. */
445               gdb_byte *buf = alloca (TYPE_LENGTH (baseclass));
446               base_valaddr = buf;
447               if (target_read_memory (address + boffset, buf,
448                                       TYPE_LENGTH (baseclass)) != 0)
449                 skip = 1;
450               address = address + boffset;
451               thisoffset = 0;
452               boffset = 0;
453               thistype = baseclass;
454             }
455           else
456             base_valaddr = valaddr;
457         }
458       else
459         base_valaddr = valaddr;
460
461       /* now do the printing */
462       if (options->pretty)
463         {
464           fprintf_filtered (stream, "\n");
465           print_spaces_filtered (2 * recurse, stream);
466         }
467       fputs_filtered ("<", stream);
468       /* Not sure what the best notation is in the case where there is no
469          baseclass name.  */
470       fputs_filtered (basename ? basename : "", stream);
471       fputs_filtered ("> = ", stream);
472
473
474       if (skip >= 1)
475         fprintf_filtered (stream, "<invalid address>");
476       else
477         {
478           int result = 0;
479
480           /* Attempt to run the Python pretty-printers on the
481              baseclass if possible.  */
482           if (!options->raw)
483             result = apply_val_pretty_printer (baseclass, base_valaddr,
484                                                thisoffset + boffset,
485                                                address,
486                                                stream, recurse,
487                                                options,
488                                                current_language);
489                   
490           if (!result)
491             cp_print_value_fields (baseclass, thistype, base_valaddr,
492                                    thisoffset + boffset, address,
493                                    stream, recurse, options,
494                                    ((struct type **)
495                                     obstack_base (&dont_print_vb_obstack)),
496                                    0);
497         }
498       fputs_filtered (", ", stream);
499
500     flush_it:
501       ;
502     }
503
504   if (dont_print_vb == 0)
505     {
506       /* Free the space used to deal with the printing
507          of this type from top level.  */
508       obstack_free (&dont_print_vb_obstack, last_dont_print);
509       /* Reset watermark so that we can continue protecting
510          ourselves from whatever we were protecting ourselves.  */
511       dont_print_vb_obstack = tmp_obstack;
512     }
513 }
514
515 /* Print value of a static member.
516    To avoid infinite recursion when printing a class that contains
517    a static instance of the class, we keep the addresses of all printed
518    static member classes in an obstack and refuse to print them more
519    than once.
520
521    VAL contains the value to print, TYPE, STREAM, RECURSE, and OPTIONS
522    have the same meanings as in c_val_print.  */
523
524 static void
525 cp_print_static_field (struct type *type,
526                        struct value *val,
527                        struct ui_file *stream,
528                        int recurse,
529                        const struct value_print_options *options)
530 {
531   struct value_print_options opts;
532   
533   if (TYPE_CODE (type) == TYPE_CODE_STRUCT)
534     {
535       CORE_ADDR *first_dont_print;
536       CORE_ADDR addr;
537       int i;
538
539       first_dont_print
540         = (CORE_ADDR *) obstack_base (&dont_print_statmem_obstack);
541       i = obstack_object_size (&dont_print_statmem_obstack)
542         / sizeof (CORE_ADDR);
543
544       while (--i >= 0)
545         {
546           if (value_address (val) == first_dont_print[i])
547             {
548               fputs_filtered ("<same as static member of an already"
549                               " seen type>",
550                               stream);
551               return;
552             }
553         }
554
555       addr = value_address (val);
556       obstack_grow (&dont_print_statmem_obstack, (char *) &addr,
557                     sizeof (CORE_ADDR));
558
559       CHECK_TYPEDEF (type);
560       cp_print_value_fields (type, value_enclosing_type (val),
561                              value_contents_all (val),
562                              value_embedded_offset (val), addr,
563                              stream, recurse, options, NULL, 1);
564       return;
565     }
566
567   if (TYPE_CODE (type) == TYPE_CODE_ARRAY)
568     {
569       struct type **first_dont_print;
570       int i;
571       struct type *target_type = TYPE_TARGET_TYPE (type);
572
573       first_dont_print
574         = (struct type **) obstack_base (&dont_print_stat_array_obstack);
575       i = obstack_object_size (&dont_print_stat_array_obstack)
576         / sizeof (CORE_ADDR);
577
578       while (--i >= 0)
579         {
580           if (target_type == first_dont_print[i])
581             {
582               fputs_filtered ("<same as static member of an already"
583                               " seen type>",
584                               stream);
585               return;
586             }
587         }
588
589       obstack_grow (&dont_print_stat_array_obstack, (char *) &target_type,
590                     sizeof (struct type *));
591     }
592
593   opts = *options;
594   opts.deref_ref = 0;
595   val_print (type, value_contents_all (val), 
596              value_embedded_offset (val), value_address (val),
597              stream, recurse, &opts, current_language);
598 }
599
600
601 /* Find the field in *DOMAIN, or its non-virtual base classes, with bit offset
602    OFFSET.  Set *DOMAIN to the containing type and *FIELDNO to the containing
603    field number.  If OFFSET is not exactly at the start of some field, set
604    *DOMAIN to NULL.  */
605
606 static void
607 cp_find_class_member (struct type **domain_p, int *fieldno,
608                       LONGEST offset)
609 {
610   struct type *domain;
611   unsigned int i;
612   unsigned len;
613
614   *domain_p = check_typedef (*domain_p);
615   domain = *domain_p;
616   len = TYPE_NFIELDS (domain);
617
618   for (i = TYPE_N_BASECLASSES (domain); i < len; i++)
619     {
620       LONGEST bitpos = TYPE_FIELD_BITPOS (domain, i);
621
622       QUIT;
623       if (offset == bitpos)
624         {
625           *fieldno = i;
626           return;
627         }
628     }
629
630   for (i = 0; i < TYPE_N_BASECLASSES (domain); i++)
631     {
632       LONGEST bitpos = TYPE_FIELD_BITPOS (domain, i);
633       LONGEST bitsize = 8 * TYPE_LENGTH (TYPE_FIELD_TYPE (domain, i));
634
635       if (offset >= bitpos && offset < bitpos + bitsize)
636         {
637           *domain_p = TYPE_FIELD_TYPE (domain, i);
638           cp_find_class_member (domain_p, fieldno, offset - bitpos);
639           return;
640         }
641     }
642
643   *domain_p = NULL;
644 }
645
646 void
647 cp_print_class_member (const gdb_byte *valaddr, struct type *type,
648                        struct ui_file *stream, char *prefix)
649 {
650   enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type));
651
652   /* VAL is a byte offset into the structure type DOMAIN.
653      Find the name of the field for that offset and
654      print it.  */
655   struct type *domain = TYPE_DOMAIN_TYPE (type);
656   LONGEST val;
657   unsigned int fieldno;
658
659   val = extract_signed_integer (valaddr, TYPE_LENGTH (type), byte_order);
660
661   /* Pointers to data members are usually byte offsets into an object.
662      Because a data member can have offset zero, and a NULL pointer to
663      member must be distinct from any valid non-NULL pointer to
664      member, either the value is biased or the NULL value has a
665      special representation; both are permitted by ISO C++.  HP aCC
666      used a bias of 0x20000000; HP cfront used a bias of 1; g++ 3.x
667      and other compilers which use the Itanium ABI use -1 as the NULL
668      value.  GDB only supports that last form; to add support for
669      another form, make this into a cp-abi hook.  */
670
671   if (val == -1)
672     {
673       fprintf_filtered (stream, "NULL");
674       return;
675     }
676
677   cp_find_class_member (&domain, &fieldno, val << 3);
678
679   if (domain != NULL)
680     {
681       char *name;
682       fputs_filtered (prefix, stream);
683       name = type_name_no_tag (domain);
684       if (name)
685         fputs_filtered (name, stream);
686       else
687         c_type_print_base (domain, stream, 0, 0);
688       fprintf_filtered (stream, "::");
689       fputs_filtered (TYPE_FIELD_NAME (domain, fieldno), stream);
690     }
691   else
692     fprintf_filtered (stream, "%ld", (long) val);
693 }
694
695
696 void
697 _initialize_cp_valprint (void)
698 {
699   add_setshow_boolean_cmd ("static-members", class_support,
700                            &user_print_options.static_field_print, _("\
701 Set printing of C++ static members."), _("\
702 Show printing of C++ static members."), NULL,
703                            NULL,
704                            show_static_field_print,
705                            &setprintlist, &showprintlist);
706
707   add_setshow_boolean_cmd ("vtbl", class_support,
708                            &user_print_options.vtblprint, _("\
709 Set printing of C++ virtual function tables."), _("\
710 Show printing of C++ virtual function tables."), NULL,
711                            NULL,
712                            show_vtblprint,
713                            &setprintlist, &showprintlist);
714
715   add_setshow_boolean_cmd ("object", class_support,
716                            &user_print_options.objectprint, _("\
717 Set printing of object's derived type based on vtable info."), _("\
718 Show printing of object's derived type based on vtable info."), NULL,
719                            NULL,
720                            show_objectprint,
721                            &setprintlist, &showprintlist);
722
723   obstack_begin (&dont_print_stat_array_obstack, 32 * sizeof (CORE_ADDR));
724   obstack_begin (&dont_print_statmem_obstack, 32 * sizeof (CORE_ADDR));
725   obstack_begin (&dont_print_vb_obstack, 32 * sizeof (struct type *));
726 }