GDB (API)
|
00001 /* Declarations for value printing routines for GDB, the GNU debugger. 00002 00003 Copyright (C) 1986-2013 Free Software Foundation, Inc. 00004 00005 This file is part of GDB. 00006 00007 This program is free software; you can redistribute it and/or modify 00008 it under the terms of the GNU General Public License as published by 00009 the Free Software Foundation; either version 3 of the License, or 00010 (at your option) any later version. 00011 00012 This program is distributed in the hope that it will be useful, 00013 but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 00015 GNU General Public License for more details. 00016 00017 You should have received a copy of the GNU General Public License 00018 along with this program. If not, see <http://www.gnu.org/licenses/>. */ 00019 00020 #ifndef VALPRINT_H 00021 #define VALPRINT_H 00022 00023 /* This is used to pass formatting options to various value-printing 00024 functions. */ 00025 struct value_print_options 00026 { 00027 /* Pretty-formatting control. */ 00028 enum val_prettyformat prettyformat; 00029 00030 /* Controls pretty formatting of arrays. */ 00031 int prettyformat_arrays; 00032 00033 /* Controls pretty formatting of structures. */ 00034 int prettyformat_structs; 00035 00036 /* Controls printing of virtual tables. */ 00037 int vtblprint; 00038 00039 /* Controls printing of nested unions. */ 00040 int unionprint; 00041 00042 /* Controls printing of addresses. */ 00043 int addressprint; 00044 00045 /* Controls looking up an object's derived type using what we find 00046 in its vtables. */ 00047 int objectprint; 00048 00049 /* Maximum number of chars to print for a string pointer value or vector 00050 contents, or UINT_MAX for no limit. Note that "set print elements 0" 00051 stores UINT_MAX in print_max, which displays in a show command as 00052 "unlimited". */ 00053 unsigned int print_max; 00054 00055 /* Print repeat counts if there are more than this many repetitions 00056 of an element in an array. */ 00057 unsigned int repeat_count_threshold; 00058 00059 /* The global output format letter. */ 00060 int output_format; 00061 00062 /* The current format letter. This is set locally for a given call, 00063 e.g. when the user passes a format to "print". */ 00064 int format; 00065 00066 /* Stop printing at null character? */ 00067 int stop_print_at_null; 00068 00069 /* True if we should print the index of each element when printing 00070 an array. */ 00071 int print_array_indexes; 00072 00073 /* If nonzero, then dereference references, otherwise just print 00074 them like pointers. */ 00075 int deref_ref; 00076 00077 /* If nonzero, print static fields. */ 00078 int static_field_print; 00079 00080 /* If nonzero, print static fields for Pascal. FIXME: C++ and Java 00081 share one flag, why not Pascal too? */ 00082 int pascal_static_field_print; 00083 00084 /* If non-zero don't do Python pretty-printing. */ 00085 int raw; 00086 00087 /* If nonzero, print the value in "summary" form. 00088 If raw and summary are both non-zero, don't print non-scalar values 00089 ("..." is printed instead). */ 00090 int summary; 00091 00092 /* If nonzero, when printing a pointer, print the symbol to which it 00093 points, if any. */ 00094 int symbol_print; 00095 }; 00096 00097 /* The global print options set by the user. In general this should 00098 not be directly accessed, except by set/show commands. Ordinary 00099 code should call get_user_print_options instead. */ 00100 extern struct value_print_options user_print_options; 00101 00102 /* Initialize *OPTS to be a copy of the user print options. */ 00103 extern void get_user_print_options (struct value_print_options *opts); 00104 00105 /* Initialize *OPTS to be a copy of the user print options, but with 00106 pretty-formatting disabled. */ 00107 extern void get_no_prettyformat_print_options (struct value_print_options *); 00108 00109 /* Initialize *OPTS to be a copy of the user print options, but using 00110 FORMAT as the formatting option. */ 00111 extern void get_formatted_print_options (struct value_print_options *opts, 00112 char format); 00113 00114 extern void maybe_print_array_index (struct type *index_type, LONGEST index, 00115 struct ui_file *stream, 00116 const struct value_print_options *); 00117 00118 extern void val_print_array_elements (struct type *, const gdb_byte *, int, 00119 CORE_ADDR, struct ui_file *, int, 00120 const struct value *, 00121 const struct value_print_options *, 00122 unsigned int); 00123 00124 extern void val_print_type_code_int (struct type *, const gdb_byte *, 00125 struct ui_file *); 00126 00127 extern void val_print_type_code_flags (struct type *type, 00128 const gdb_byte *valaddr, 00129 struct ui_file *stream); 00130 00131 extern void val_print_scalar_formatted (struct type *, 00132 const gdb_byte *, int, 00133 const struct value *, 00134 const struct value_print_options *, 00135 int, 00136 struct ui_file *); 00137 00138 extern void print_binary_chars (struct ui_file *, const gdb_byte *, 00139 unsigned int, enum bfd_endian); 00140 00141 extern void print_octal_chars (struct ui_file *, const gdb_byte *, 00142 unsigned int, enum bfd_endian); 00143 00144 extern void print_decimal_chars (struct ui_file *, const gdb_byte *, 00145 unsigned int, enum bfd_endian); 00146 00147 extern void print_hex_chars (struct ui_file *, const gdb_byte *, 00148 unsigned int, enum bfd_endian); 00149 00150 extern void print_char_chars (struct ui_file *, struct type *, 00151 const gdb_byte *, unsigned int, enum bfd_endian); 00152 00153 extern void print_function_pointer_address (const struct value_print_options *options, 00154 struct gdbarch *gdbarch, 00155 CORE_ADDR address, 00156 struct ui_file *stream); 00157 00158 extern int read_string (CORE_ADDR addr, int len, int width, 00159 unsigned int fetchlimit, 00160 enum bfd_endian byte_order, gdb_byte **buffer, 00161 int *bytes_read); 00162 00163 extern void val_print_optimized_out (const struct value *val, 00164 struct ui_file *stream); 00165 00166 extern void val_print_unavailable (struct ui_file *stream); 00167 00168 extern void val_print_invalid_address (struct ui_file *stream); 00169 00170 /* An instance of this is passed to generic_val_print and describes 00171 some language-specific ways to print things. */ 00172 00173 struct generic_val_print_decorations 00174 { 00175 /* Printing complex numbers: what to print before, between the 00176 elements, and after. */ 00177 00178 const char *complex_prefix; 00179 const char *complex_infix; 00180 const char *complex_suffix; 00181 00182 /* Boolean true and false. */ 00183 00184 const char *true_name; 00185 const char *false_name; 00186 00187 /* What to print when we see TYPE_CODE_VOID. */ 00188 00189 const char *void_name; 00190 }; 00191 00192 00193 extern void generic_val_print (struct type *type, const gdb_byte *valaddr, 00194 int embedded_offset, CORE_ADDR address, 00195 struct ui_file *stream, int recurse, 00196 const struct value *original_value, 00197 const struct value_print_options *options, 00198 const struct generic_val_print_decorations *); 00199 00200 extern void generic_emit_char (int c, struct type *type, struct ui_file *stream, 00201 int quoter, const char *encoding); 00202 00203 extern void generic_printstr (struct ui_file *stream, struct type *type, 00204 const gdb_byte *string, unsigned int length, 00205 const char *encoding, int force_ellipses, 00206 int quote_char, int c_style_terminator, 00207 const struct value_print_options *options); 00208 00209 /* Run the "output" command. ARGS and FROM_TTY are the usual 00210 arguments passed to all command implementations, except ARGS is 00211 const. */ 00212 00213 extern void output_command_const (const char *args, int from_tty); 00214 00215 extern int val_print_scalar_type_p (struct type *type); 00216 00217 #endif