xref: /dflybsd-src/contrib/gdb-7/gdb/valprint.h (revision de8e141f24382815c10a4012d209bbbf7abf1112)
15796c8dcSSimon Schubert /* Declarations for value printing routines for GDB, the GNU debugger.
25796c8dcSSimon Schubert 
3*ef5ccd6cSJohn Marino    Copyright (C) 1986-2013 Free Software Foundation, Inc.
45796c8dcSSimon Schubert 
55796c8dcSSimon Schubert    This file is part of GDB.
65796c8dcSSimon Schubert 
75796c8dcSSimon Schubert    This program is free software; you can redistribute it and/or modify
85796c8dcSSimon Schubert    it under the terms of the GNU General Public License as published by
95796c8dcSSimon Schubert    the Free Software Foundation; either version 3 of the License, or
105796c8dcSSimon Schubert    (at your option) any later version.
115796c8dcSSimon Schubert 
125796c8dcSSimon Schubert    This program is distributed in the hope that it will be useful,
135796c8dcSSimon Schubert    but WITHOUT ANY WARRANTY; without even the implied warranty of
145796c8dcSSimon Schubert    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
155796c8dcSSimon Schubert    GNU General Public License for more details.
165796c8dcSSimon Schubert 
175796c8dcSSimon Schubert    You should have received a copy of the GNU General Public License
185796c8dcSSimon Schubert    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */
195796c8dcSSimon Schubert 
205796c8dcSSimon Schubert #ifndef VALPRINT_H
215796c8dcSSimon Schubert #define VALPRINT_H
225796c8dcSSimon Schubert 
235796c8dcSSimon Schubert /* This is used to pass formatting options to various value-printing
245796c8dcSSimon Schubert    functions.  */
255796c8dcSSimon Schubert struct value_print_options
265796c8dcSSimon Schubert {
275796c8dcSSimon Schubert   /* Pretty-printing control.  */
285796c8dcSSimon Schubert   enum val_prettyprint pretty;
295796c8dcSSimon Schubert 
305796c8dcSSimon Schubert   /* Controls pretty printing of arrays.  */
315796c8dcSSimon Schubert   int prettyprint_arrays;
325796c8dcSSimon Schubert 
335796c8dcSSimon Schubert   /* Controls pretty printing of structures.  */
345796c8dcSSimon Schubert   int prettyprint_structs;
355796c8dcSSimon Schubert 
365796c8dcSSimon Schubert   /* Controls printing of virtual tables.  */
375796c8dcSSimon Schubert   int vtblprint;
385796c8dcSSimon Schubert 
395796c8dcSSimon Schubert   /* Controls printing of nested unions.  */
405796c8dcSSimon Schubert   int unionprint;
415796c8dcSSimon Schubert 
425796c8dcSSimon Schubert   /* Controls printing of addresses.  */
435796c8dcSSimon Schubert   int addressprint;
445796c8dcSSimon Schubert 
455796c8dcSSimon Schubert   /* Controls looking up an object's derived type using what we find
465796c8dcSSimon Schubert      in its vtables.  */
475796c8dcSSimon Schubert   int objectprint;
485796c8dcSSimon Schubert 
495796c8dcSSimon Schubert   /* Maximum number of chars to print for a string pointer value or vector
505796c8dcSSimon Schubert      contents, or UINT_MAX for no limit.  Note that "set print elements 0"
515796c8dcSSimon Schubert      stores UINT_MAX in print_max, which displays in a show command as
525796c8dcSSimon Schubert      "unlimited".  */
535796c8dcSSimon Schubert   unsigned int print_max;
545796c8dcSSimon Schubert 
555796c8dcSSimon Schubert   /* Print repeat counts if there are more than this many repetitions
565796c8dcSSimon Schubert      of an element in an array.  */
575796c8dcSSimon Schubert   unsigned int repeat_count_threshold;
585796c8dcSSimon Schubert 
595796c8dcSSimon Schubert   /* The global output format letter.  */
605796c8dcSSimon Schubert   int output_format;
615796c8dcSSimon Schubert 
625796c8dcSSimon Schubert   /* The current format letter.  This is set locally for a given call,
635796c8dcSSimon Schubert      e.g. when the user passes a format to "print".  */
645796c8dcSSimon Schubert   int format;
655796c8dcSSimon Schubert 
665796c8dcSSimon Schubert   /* Stop printing at null character?  */
675796c8dcSSimon Schubert   int stop_print_at_null;
685796c8dcSSimon Schubert 
695796c8dcSSimon Schubert   /* True if we should print the index of each element when printing
705796c8dcSSimon Schubert      an array.  */
715796c8dcSSimon Schubert   int print_array_indexes;
725796c8dcSSimon Schubert 
735796c8dcSSimon Schubert   /* If nonzero, then dereference references, otherwise just print
745796c8dcSSimon Schubert      them like pointers.  */
755796c8dcSSimon Schubert   int deref_ref;
765796c8dcSSimon Schubert 
775796c8dcSSimon Schubert   /* If nonzero, print static fields.  */
785796c8dcSSimon Schubert   int static_field_print;
795796c8dcSSimon Schubert 
805796c8dcSSimon Schubert   /* If nonzero, print static fields for Pascal.  FIXME: C++ and Java
815796c8dcSSimon Schubert      share one flag, why not Pascal too?  */
825796c8dcSSimon Schubert   int pascal_static_field_print;
835796c8dcSSimon Schubert 
845796c8dcSSimon Schubert   /* Controls Python pretty-printing.  */
855796c8dcSSimon Schubert   int raw;
865796c8dcSSimon Schubert 
875796c8dcSSimon Schubert   /* If nonzero, print the value in "summary" form.  */
885796c8dcSSimon Schubert   int summary;
89*ef5ccd6cSJohn Marino 
90*ef5ccd6cSJohn Marino   /* If nonzero, when printing a pointer, print the symbol to which it
91*ef5ccd6cSJohn Marino      points, if any.  */
92*ef5ccd6cSJohn Marino   int symbol_print;
935796c8dcSSimon Schubert };
945796c8dcSSimon Schubert 
955796c8dcSSimon Schubert /* The global print options set by the user.  In general this should
965796c8dcSSimon Schubert    not be directly accessed, except by set/show commands.  Ordinary
975796c8dcSSimon Schubert    code should call get_user_print_options instead.  */
985796c8dcSSimon Schubert extern struct value_print_options user_print_options;
995796c8dcSSimon Schubert 
1005796c8dcSSimon Schubert /* Initialize *OPTS to be a copy of the user print options.  */
1015796c8dcSSimon Schubert extern void get_user_print_options (struct value_print_options *opts);
1025796c8dcSSimon Schubert 
1035796c8dcSSimon Schubert /* Initialize *OPTS to be a copy of the user print options, but with
1045796c8dcSSimon Schubert    pretty-printing disabled.  */
1055796c8dcSSimon Schubert extern void get_raw_print_options (struct value_print_options *opts);
1065796c8dcSSimon Schubert 
1075796c8dcSSimon Schubert /* Initialize *OPTS to be a copy of the user print options, but using
1085796c8dcSSimon Schubert    FORMAT as the formatting option.  */
1095796c8dcSSimon Schubert extern void get_formatted_print_options (struct value_print_options *opts,
1105796c8dcSSimon Schubert 					 char format);
1115796c8dcSSimon Schubert 
1125796c8dcSSimon Schubert extern void maybe_print_array_index (struct type *index_type, LONGEST index,
1135796c8dcSSimon Schubert                                      struct ui_file *stream,
114c50c785cSJohn Marino 				     const struct value_print_options *);
1155796c8dcSSimon Schubert 
116c50c785cSJohn Marino extern void val_print_array_elements (struct type *, const gdb_byte *, int,
1175796c8dcSSimon Schubert 				      CORE_ADDR, struct ui_file *, int,
118cf7f2e2dSJohn Marino 				      const struct value *,
1195796c8dcSSimon Schubert 				      const struct value_print_options *,
1205796c8dcSSimon Schubert 				      unsigned int);
1215796c8dcSSimon Schubert 
1225796c8dcSSimon Schubert extern void val_print_type_code_int (struct type *, const gdb_byte *,
1235796c8dcSSimon Schubert 				     struct ui_file *);
1245796c8dcSSimon Schubert 
1255796c8dcSSimon Schubert extern void val_print_type_code_flags (struct type *type,
1265796c8dcSSimon Schubert 				       const gdb_byte *valaddr,
1275796c8dcSSimon Schubert 				       struct ui_file *stream);
1285796c8dcSSimon Schubert 
129c50c785cSJohn Marino extern void val_print_scalar_formatted (struct type *,
130c50c785cSJohn Marino 					const gdb_byte *, int,
131c50c785cSJohn Marino 					const struct value *,
132c50c785cSJohn Marino 					const struct value_print_options *,
133c50c785cSJohn Marino 					int,
134c50c785cSJohn Marino 					struct ui_file *);
135c50c785cSJohn Marino 
1365796c8dcSSimon Schubert extern void print_binary_chars (struct ui_file *, const gdb_byte *,
1375796c8dcSSimon Schubert 				unsigned int, enum bfd_endian);
1385796c8dcSSimon Schubert 
1395796c8dcSSimon Schubert extern void print_octal_chars (struct ui_file *, const gdb_byte *,
1405796c8dcSSimon Schubert 			       unsigned int, enum bfd_endian);
1415796c8dcSSimon Schubert 
1425796c8dcSSimon Schubert extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
1435796c8dcSSimon Schubert 				 unsigned int, enum bfd_endian);
1445796c8dcSSimon Schubert 
1455796c8dcSSimon Schubert extern void print_hex_chars (struct ui_file *, const gdb_byte *,
1465796c8dcSSimon Schubert 			     unsigned int, enum bfd_endian);
1475796c8dcSSimon Schubert 
1485796c8dcSSimon Schubert extern void print_char_chars (struct ui_file *, struct type *,
1495796c8dcSSimon Schubert 			      const gdb_byte *, unsigned int, enum bfd_endian);
1505796c8dcSSimon Schubert 
151*ef5ccd6cSJohn Marino extern void print_function_pointer_address (const struct value_print_options *options,
152*ef5ccd6cSJohn Marino 					    struct gdbarch *gdbarch,
153*ef5ccd6cSJohn Marino 					    CORE_ADDR address,
154*ef5ccd6cSJohn Marino 					    struct ui_file *stream);
155*ef5ccd6cSJohn Marino 
156*ef5ccd6cSJohn Marino extern int read_string (CORE_ADDR addr, int len, int width,
157*ef5ccd6cSJohn Marino 			unsigned int fetchlimit,
1585796c8dcSSimon Schubert 			enum bfd_endian byte_order, gdb_byte **buffer,
1595796c8dcSSimon Schubert 			int *bytes_read);
1605796c8dcSSimon Schubert 
161c50c785cSJohn Marino extern void val_print_optimized_out (struct ui_file *stream);
162c50c785cSJohn Marino 
163c50c785cSJohn Marino extern void val_print_unavailable (struct ui_file *stream);
164c50c785cSJohn Marino 
165c50c785cSJohn Marino extern void val_print_invalid_address (struct ui_file *stream);
166c50c785cSJohn Marino 
167*ef5ccd6cSJohn Marino /* An instance of this is passed to generic_val_print and describes
168*ef5ccd6cSJohn Marino    some language-specific ways to print things.  */
169*ef5ccd6cSJohn Marino 
170*ef5ccd6cSJohn Marino struct generic_val_print_decorations
171*ef5ccd6cSJohn Marino {
172*ef5ccd6cSJohn Marino   /* Printing complex numbers: what to print before, between the
173*ef5ccd6cSJohn Marino      elements, and after.  */
174*ef5ccd6cSJohn Marino 
175*ef5ccd6cSJohn Marino   const char *complex_prefix;
176*ef5ccd6cSJohn Marino   const char *complex_infix;
177*ef5ccd6cSJohn Marino   const char *complex_suffix;
178*ef5ccd6cSJohn Marino 
179*ef5ccd6cSJohn Marino   /* Boolean true and false.  */
180*ef5ccd6cSJohn Marino 
181*ef5ccd6cSJohn Marino   const char *true_name;
182*ef5ccd6cSJohn Marino   const char *false_name;
183*ef5ccd6cSJohn Marino 
184*ef5ccd6cSJohn Marino   /* What to print when we see TYPE_CODE_VOID.  */
185*ef5ccd6cSJohn Marino 
186*ef5ccd6cSJohn Marino   const char *void_name;
187*ef5ccd6cSJohn Marino };
188*ef5ccd6cSJohn Marino 
189*ef5ccd6cSJohn Marino 
190*ef5ccd6cSJohn Marino extern void generic_val_print (struct type *type, const gdb_byte *valaddr,
191*ef5ccd6cSJohn Marino 			       int embedded_offset, CORE_ADDR address,
192*ef5ccd6cSJohn Marino 			       struct ui_file *stream, int recurse,
193*ef5ccd6cSJohn Marino 			       const struct value *original_value,
194*ef5ccd6cSJohn Marino 			       const struct value_print_options *options,
195*ef5ccd6cSJohn Marino 			       const struct generic_val_print_decorations *);
196*ef5ccd6cSJohn Marino 
197a45ae5f8SJohn Marino extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
198a45ae5f8SJohn Marino 			       int quoter, const char *encoding);
199a45ae5f8SJohn Marino 
200a45ae5f8SJohn Marino extern void generic_printstr (struct ui_file *stream, struct type *type,
201a45ae5f8SJohn Marino 			      const gdb_byte *string, unsigned int length,
202a45ae5f8SJohn Marino 			      const char *encoding, int force_ellipses,
203a45ae5f8SJohn Marino 			      int quote_char, int c_style_terminator,
204a45ae5f8SJohn Marino 			      const struct value_print_options *options);
205a45ae5f8SJohn Marino 
206*ef5ccd6cSJohn Marino extern void output_command (char *exp, int from_tty);
207*ef5ccd6cSJohn Marino 
2085796c8dcSSimon Schubert #endif
209