gdb/valprint.h - gdb

Data types defined

Macros defined

Source code

  1. /* Declarations for value printing routines for GDB, the GNU debugger.

  2.    Copyright (C) 1986-2015 Free Software Foundation, Inc.

  3.    This file is part of GDB.

  4.    This program is free software; you can redistribute it and/or modify
  5.    it under the terms of the GNU General Public License as published by
  6.    the Free Software Foundation; either version 3 of the License, or
  7.    (at your option) any later version.

  8.    This program is distributed in the hope that it will be useful,
  9.    but WITHOUT ANY WARRANTY; without even the implied warranty of
  10.    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  11.    GNU General Public License for more details.

  12.    You should have received a copy of the GNU General Public License
  13.    along with this program.  If not, see <http://www.gnu.org/licenses/>.  */

  14. #ifndef VALPRINT_H
  15. #define VALPRINT_H

  16. /* This is used to pass formatting options to various value-printing
  17.    functions.  */
  18. struct value_print_options
  19. {
  20.   /* Pretty-formatting control.  */
  21.   enum val_prettyformat prettyformat;

  22.   /* Controls pretty formatting of arrays.  */
  23.   int prettyformat_arrays;

  24.   /* Controls pretty formatting of structures.  */
  25.   int prettyformat_structs;

  26.   /* Controls printing of virtual tables.  */
  27.   int vtblprint;

  28.   /* Controls printing of nested unions.  */
  29.   int unionprint;

  30.   /* Controls printing of addresses.  */
  31.   int addressprint;

  32.   /* Controls looking up an object's derived type using what we find
  33.      in its vtables.  */
  34.   int objectprint;

  35.   /* Maximum number of chars to print for a string pointer value or vector
  36.      contents, or UINT_MAX for no limit.  Note that "set print elements 0"
  37.      stores UINT_MAX in print_max, which displays in a show command as
  38.      "unlimited".  */
  39.   unsigned int print_max;

  40.   /* Print repeat counts if there are more than this many repetitions
  41.      of an element in an array.  */
  42.   unsigned int repeat_count_threshold;

  43.   /* The global output format letter.  */
  44.   int output_format;

  45.   /* The current format letter.  This is set locally for a given call,
  46.      e.g. when the user passes a format to "print".  */
  47.   int format;

  48.   /* Stop printing at null character?  */
  49.   int stop_print_at_null;

  50.   /* True if we should print the index of each element when printing
  51.      an array.  */
  52.   int print_array_indexes;

  53.   /* If nonzero, then dereference references, otherwise just print
  54.      them like pointers.  */
  55.   int deref_ref;

  56.   /* If nonzero, print static fields.  */
  57.   int static_field_print;

  58.   /* If nonzero, print static fields for Pascal.  FIXME: C++ and Java
  59.      share one flag, why not Pascal too?  */
  60.   int pascal_static_field_print;

  61.   /* If non-zero don't do Python pretty-printing.  */
  62.   int raw;

  63.   /* If nonzero, print the value in "summary" form.
  64.      If raw and summary are both non-zero, don't print non-scalar values
  65.      ("..." is printed instead).  */
  66.   int summary;

  67.   /* If nonzero, when printing a pointer, print the symbol to which it
  68.      points, if any.  */
  69.   int symbol_print;
  70. };

  71. /* The global print options set by the user.  In general this should
  72.    not be directly accessed, except by set/show commands.  Ordinary
  73.    code should call get_user_print_options instead.  */
  74. extern struct value_print_options user_print_options;

  75. /* Initialize *OPTS to be a copy of the user print options.  */
  76. extern void get_user_print_options (struct value_print_options *opts);

  77. /* Initialize *OPTS to be a copy of the user print options, but with
  78.    pretty-formatting disabled.  */
  79. extern void get_no_prettyformat_print_options (struct value_print_options *);

  80. /* Initialize *OPTS to be a copy of the user print options, but using
  81.    FORMAT as the formatting option.  */
  82. extern void get_formatted_print_options (struct value_print_options *opts,
  83.                                          char format);

  84. extern void maybe_print_array_index (struct type *index_type, LONGEST index,
  85.                                      struct ui_file *stream,
  86.                                      const struct value_print_options *);

  87. extern void val_print_array_elements (struct type *, const gdb_byte *, int,
  88.                                       CORE_ADDR, struct ui_file *, int,
  89.                                       const struct value *,
  90.                                       const struct value_print_options *,
  91.                                       unsigned int);

  92. extern void val_print_type_code_int (struct type *, const gdb_byte *,
  93.                                      struct ui_file *);

  94. extern void val_print_type_code_flags (struct type *type,
  95.                                        const gdb_byte *valaddr,
  96.                                        struct ui_file *stream);

  97. extern void val_print_scalar_formatted (struct type *,
  98.                                         const gdb_byte *, int,
  99.                                         const struct value *,
  100.                                         const struct value_print_options *,
  101.                                         int,
  102.                                         struct ui_file *);

  103. extern void print_binary_chars (struct ui_file *, const gdb_byte *,
  104.                                 unsigned int, enum bfd_endian);

  105. extern void print_octal_chars (struct ui_file *, const gdb_byte *,
  106.                                unsigned int, enum bfd_endian);

  107. extern void print_decimal_chars (struct ui_file *, const gdb_byte *,
  108.                                  unsigned int, enum bfd_endian);

  109. extern void print_hex_chars (struct ui_file *, const gdb_byte *,
  110.                              unsigned int, enum bfd_endian);

  111. extern void print_char_chars (struct ui_file *, struct type *,
  112.                               const gdb_byte *, unsigned int, enum bfd_endian);

  113. extern void print_function_pointer_address (const struct value_print_options *options,
  114.                                             struct gdbarch *gdbarch,
  115.                                             CORE_ADDR address,
  116.                                             struct ui_file *stream);

  117. extern int read_string (CORE_ADDR addr, int len, int width,
  118.                         unsigned int fetchlimit,
  119.                         enum bfd_endian byte_order, gdb_byte **buffer,
  120.                         int *bytes_read);

  121. extern void val_print_optimized_out (const struct value *val,
  122.                                      struct ui_file *stream);

  123. /* Prints "<not saved>" to STREAM.  */
  124. extern void val_print_not_saved (struct ui_file *stream);

  125. extern void val_print_unavailable (struct ui_file *stream);

  126. extern void val_print_invalid_address (struct ui_file *stream);

  127. /* An instance of this is passed to generic_val_print and describes
  128.    some language-specific ways to print things.  */

  129. struct generic_val_print_decorations
  130. {
  131.   /* Printing complex numbers: what to print before, between the
  132.      elements, and after.  */

  133.   const char *complex_prefix;
  134.   const char *complex_infix;
  135.   const char *complex_suffix;

  136.   /* Boolean true and false.  */

  137.   const char *true_name;
  138.   const char *false_name;

  139.   /* What to print when we see TYPE_CODE_VOID.  */

  140.   const char *void_name;
  141. };


  142. extern void generic_val_print (struct type *type, const gdb_byte *valaddr,
  143.                                int embedded_offset, CORE_ADDR address,
  144.                                struct ui_file *stream, int recurse,
  145.                                const struct value *original_value,
  146.                                const struct value_print_options *options,
  147.                                const struct generic_val_print_decorations *);

  148. extern void generic_emit_char (int c, struct type *type, struct ui_file *stream,
  149.                                int quoter, const char *encoding);

  150. extern void generic_printstr (struct ui_file *stream, struct type *type,
  151.                               const gdb_byte *string, unsigned int length,
  152.                               const char *encoding, int force_ellipses,
  153.                               int quote_char, int c_style_terminator,
  154.                               const struct value_print_options *options);

  155. /* Run the "output" command.  ARGS and FROM_TTY are the usual
  156.    arguments passed to all command implementations, except ARGS is
  157.    const.  */

  158. extern void output_command_const (const char *args, int from_tty);

  159. extern int val_print_scalar_type_p (struct type *type);

  160. #endif