valprint.h revision 1.1 1 1.1 christos /* Declarations for value printing routines for GDB, the GNU debugger.
2 1.1 christos
3 1.1 christos Copyright (C) 1986-2014 Free Software Foundation, Inc.
4 1.1 christos
5 1.1 christos This file is part of GDB.
6 1.1 christos
7 1.1 christos This program is free software; you can redistribute it and/or modify
8 1.1 christos it under the terms of the GNU General Public License as published by
9 1.1 christos the Free Software Foundation; either version 3 of the License, or
10 1.1 christos (at your option) any later version.
11 1.1 christos
12 1.1 christos This program is distributed in the hope that it will be useful,
13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 christos GNU General Public License for more details.
16 1.1 christos
17 1.1 christos You should have received a copy of the GNU General Public License
18 1.1 christos along with this program. If not, see <http://www.gnu.org/licenses/>. */
19 1.1 christos
20 1.1 christos #ifndef VALPRINT_H
21 1.1 christos #define VALPRINT_H
22 1.1 christos
23 1.1 christos /* This is used to pass formatting options to various value-printing
24 1.1 christos functions. */
25 1.1 christos struct value_print_options
26 1.1 christos {
27 1.1 christos /* Pretty-formatting control. */
28 1.1 christos enum val_prettyformat prettyformat;
29 1.1 christos
30 1.1 christos /* Controls pretty formatting of arrays. */
31 1.1 christos int prettyformat_arrays;
32 1.1 christos
33 1.1 christos /* Controls pretty formatting of structures. */
34 1.1 christos int prettyformat_structs;
35 1.1 christos
36 1.1 christos /* Controls printing of virtual tables. */
37 1.1 christos int vtblprint;
38 1.1 christos
39 1.1 christos /* Controls printing of nested unions. */
40 1.1 christos int unionprint;
41 1.1 christos
42 1.1 christos /* Controls printing of addresses. */
43 1.1 christos int addressprint;
44 1.1 christos
45 1.1 christos /* Controls looking up an object's derived type using what we find
46 1.1 christos in its vtables. */
47 1.1 christos int objectprint;
48 1.1 christos
49 1.1 christos /* Maximum number of chars to print for a string pointer value or vector
50 1.1 christos contents, or UINT_MAX for no limit. Note that "set print elements 0"
51 1.1 christos stores UINT_MAX in print_max, which displays in a show command as
52 1.1 christos "unlimited". */
53 1.1 christos unsigned int print_max;
54 1.1 christos
55 1.1 christos /* Print repeat counts if there are more than this many repetitions
56 1.1 christos of an element in an array. */
57 1.1 christos unsigned int repeat_count_threshold;
58 1.1 christos
59 1.1 christos /* The global output format letter. */
60 1.1 christos int output_format;
61 1.1 christos
62 1.1 christos /* The current format letter. This is set locally for a given call,
63 1.1 christos e.g. when the user passes a format to "print". */
64 1.1 christos int format;
65 1.1 christos
66 1.1 christos /* Stop printing at null character? */
67 1.1 christos int stop_print_at_null;
68 1.1 christos
69 1.1 christos /* True if we should print the index of each element when printing
70 1.1 christos an array. */
71 1.1 christos int print_array_indexes;
72 1.1 christos
73 1.1 christos /* If nonzero, then dereference references, otherwise just print
74 1.1 christos them like pointers. */
75 1.1 christos int deref_ref;
76 1.1 christos
77 1.1 christos /* If nonzero, print static fields. */
78 1.1 christos int static_field_print;
79 1.1 christos
80 1.1 christos /* If nonzero, print static fields for Pascal. FIXME: C++ and Java
81 1.1 christos share one flag, why not Pascal too? */
82 1.1 christos int pascal_static_field_print;
83 1.1 christos
84 1.1 christos /* If non-zero don't do Python pretty-printing. */
85 1.1 christos int raw;
86 1.1 christos
87 1.1 christos /* If nonzero, print the value in "summary" form.
88 1.1 christos If raw and summary are both non-zero, don't print non-scalar values
89 1.1 christos ("..." is printed instead). */
90 1.1 christos int summary;
91 1.1 christos
92 1.1 christos /* If nonzero, when printing a pointer, print the symbol to which it
93 1.1 christos points, if any. */
94 1.1 christos int symbol_print;
95 1.1 christos };
96 1.1 christos
97 1.1 christos /* The global print options set by the user. In general this should
98 1.1 christos not be directly accessed, except by set/show commands. Ordinary
99 1.1 christos code should call get_user_print_options instead. */
100 1.1 christos extern struct value_print_options user_print_options;
101 1.1 christos
102 1.1 christos /* Initialize *OPTS to be a copy of the user print options. */
103 1.1 christos extern void get_user_print_options (struct value_print_options *opts);
104 1.1 christos
105 1.1 christos /* Initialize *OPTS to be a copy of the user print options, but with
106 1.1 christos pretty-formatting disabled. */
107 1.1 christos extern void get_no_prettyformat_print_options (struct value_print_options *);
108 1.1 christos
109 1.1 christos /* Initialize *OPTS to be a copy of the user print options, but using
110 1.1 christos FORMAT as the formatting option. */
111 1.1 christos extern void get_formatted_print_options (struct value_print_options *opts,
112 1.1 christos char format);
113 1.1 christos
114 1.1 christos extern void maybe_print_array_index (struct type *index_type, LONGEST index,
115 1.1 christos struct ui_file *stream,
116 1.1 christos const struct value_print_options *);
117 1.1 christos
118 1.1 christos extern void val_print_array_elements (struct type *, const gdb_byte *, int,
119 1.1 christos CORE_ADDR, struct ui_file *, int,
120 1.1 christos const struct value *,
121 1.1 christos const struct value_print_options *,
122 1.1 christos unsigned int);
123 1.1 christos
124 1.1 christos extern void val_print_type_code_int (struct type *, const gdb_byte *,
125 1.1 christos struct ui_file *);
126 1.1 christos
127 1.1 christos extern void val_print_type_code_flags (struct type *type,
128 1.1 christos const gdb_byte *valaddr,
129 1.1 christos struct ui_file *stream);
130 1.1 christos
131 1.1 christos extern void val_print_scalar_formatted (struct type *,
132 1.1 christos const gdb_byte *, int,
133 1.1 christos const struct value *,
134 1.1 christos const struct value_print_options *,
135 1.1 christos int,
136 1.1 christos struct ui_file *);
137 1.1 christos
138 1.1 christos extern void print_binary_chars (struct ui_file *, const gdb_byte *,
139 1.1 christos unsigned int, enum bfd_endian);
140 1.1 christos
141 1.1 christos extern void print_octal_chars (struct ui_file *, const gdb_byte *,
142 1.1 christos unsigned int, enum bfd_endian);
143 1.1 christos
144 1.1 christos extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
145 1.1 christos unsigned int, enum bfd_endian);
146 1.1 christos
147 1.1 christos extern void print_hex_chars (struct ui_file *, const gdb_byte *,
148 1.1 christos unsigned int, enum bfd_endian);
149 1.1 christos
150 1.1 christos extern void print_char_chars (struct ui_file *, struct type *,
151 1.1 christos const gdb_byte *, unsigned int, enum bfd_endian);
152 1.1 christos
153 1.1 christos extern void print_function_pointer_address (const struct value_print_options *options,
154 1.1 christos struct gdbarch *gdbarch,
155 1.1 christos CORE_ADDR address,
156 1.1 christos struct ui_file *stream);
157 1.1 christos
158 1.1 christos extern int read_string (CORE_ADDR addr, int len, int width,
159 1.1 christos unsigned int fetchlimit,
160 1.1 christos enum bfd_endian byte_order, gdb_byte **buffer,
161 1.1 christos int *bytes_read);
162 1.1 christos
163 1.1 christos extern void val_print_optimized_out (const struct value *val,
164 1.1 christos struct ui_file *stream);
165 1.1 christos
166 1.1 christos /* Prints "<not saved>" to STREAM. */
167 1.1 christos extern void val_print_not_saved (struct ui_file *stream);
168 1.1 christos
169 1.1 christos extern void val_print_unavailable (struct ui_file *stream);
170 1.1 christos
171 1.1 christos extern void val_print_invalid_address (struct ui_file *stream);
172 1.1 christos
173 1.1 christos /* An instance of this is passed to generic_val_print and describes
174 1.1 christos some language-specific ways to print things. */
175 1.1 christos
176 1.1 christos struct generic_val_print_decorations
177 1.1 christos {
178 1.1 christos /* Printing complex numbers: what to print before, between the
179 1.1 christos elements, and after. */
180 1.1 christos
181 1.1 christos const char *complex_prefix;
182 1.1 christos const char *complex_infix;
183 1.1 christos const char *complex_suffix;
184 1.1 christos
185 1.1 christos /* Boolean true and false. */
186 1.1 christos
187 1.1 christos const char *true_name;
188 1.1 christos const char *false_name;
189 1.1 christos
190 1.1 christos /* What to print when we see TYPE_CODE_VOID. */
191 1.1 christos
192 1.1 christos const char *void_name;
193 1.1 christos };
194 1.1 christos
195 1.1 christos
196 1.1 christos extern void generic_val_print (struct type *type, const gdb_byte *valaddr,
197 1.1 christos int embedded_offset, CORE_ADDR address,
198 1.1 christos struct ui_file *stream, int recurse,
199 1.1 christos const struct value *original_value,
200 1.1 christos const struct value_print_options *options,
201 1.1 christos const struct generic_val_print_decorations *);
202 1.1 christos
203 1.1 christos extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
204 1.1 christos int quoter, const char *encoding);
205 1.1 christos
206 1.1 christos extern void generic_printstr (struct ui_file *stream, struct type *type,
207 1.1 christos const gdb_byte *string, unsigned int length,
208 1.1 christos const char *encoding, int force_ellipses,
209 1.1 christos int quote_char, int c_style_terminator,
210 1.1 christos const struct value_print_options *options);
211 1.1 christos
212 1.1 christos /* Run the "output" command. ARGS and FROM_TTY are the usual
213 1.1 christos arguments passed to all command implementations, except ARGS is
214 1.1 christos const. */
215 1.1 christos
216 1.1 christos extern void output_command_const (const char *args, int from_tty);
217 1.1 christos
218 1.1 christos extern int val_print_scalar_type_p (struct type *type);
219 1.1 christos
220 1.1 christos #endif
221