GDB (xrefs)
Classes | Defines | Typedefs | Functions | Variables
/home/stan/gdb/src/gdb/valprint.c File Reference
#include "defs.h"
#include "gdb_string.h"
#include "symtab.h"
#include "gdbtypes.h"
#include "value.h"
#include "gdbcore.h"
#include "gdbcmd.h"
#include "target.h"
#include "language.h"
#include "annotate.h"
#include "valprint.h"
#include "floatformat.h"
#include "doublest.h"
#include "exceptions.h"
#include "dfp.h"
#include "python/python.h"
#include "ada-lang.h"
#include "gdb_obstack.h"
#include "charset.h"
#include <ctype.h>
#include <errno.h>

Go to the source code of this file.

Classes

struct  converted_character

Defines

#define MAX_WCHARS   4
#define WCHAR_BUFLEN(X)   ((X) * sizeof (gdb_wchar_t))
#define WCHAR_BUFLEN_MAX   WCHAR_BUFLEN (MAX_WCHARS)
#define PRINT_MAX_DEFAULT   200 /* Start print_max off at this value. */
#define BITS_IN_BYTES   8
#define BITS_IN_OCTAL   3
#define HIGH_ZERO   0340
#define LOW_ZERO   0016
#define CARRY_ZERO   0003
#define HIGH_ONE   0200
#define MID_ONE   0160
#define LOW_ONE   0016
#define CARRY_ONE   0001
#define HIGH_TWO   0300
#define MID_TWO   0070
#define LOW_TWO   0007
#define TEN   10
#define CARRY_OUT(x)   ((x) / TEN) /* extend char to int */
#define CARRY_LEFT(x)   ((x) % TEN)
#define SHIFT(x)   ((x) << 4)
#define LOW_NIBBLE(x)   ( (x) & 0x00F)
#define HIGH_NIBBLE(x)   (((x) & 0x0F0) >> 4)

Typedefs

typedef struct converted_character converted_character_d

Functions

 DEF_VEC_O (converted_character_d)
static int partial_memory_read (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int *errptr)
static void show_print (char *, int)
static void set_print (char *, int)
static void set_radix (char *, int)
static void show_radix (char *, int)
static void set_input_radix (char *, int, struct cmd_list_element *)
static void set_input_radix_1 (int, unsigned)
static void set_output_radix (char *, int, struct cmd_list_element *)
static void set_output_radix_1 (int, unsigned)
void _initialize_valprint (void)
void get_user_print_options (struct value_print_options *opts)
void get_no_prettyformat_print_options (struct value_print_options *opts)
void get_formatted_print_options (struct value_print_options *opts, char format)
static void show_print_max (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_input_radix (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_output_radix (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_print_array_indexes (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_repeat_count_threshold (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_stop_print_at_null (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_prettyformat_structs (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_prettyformat_arrays (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_unionprint (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_addressprint (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
static void show_symbol_print (struct ui_file *file, int from_tty, struct cmd_list_element *c, const char *value)
int val_print_scalar_type_p (struct type *type)
int valprint_check_validity (struct ui_file *stream, struct type *type, int embedded_offset, const struct value *val)
void val_print_optimized_out (const struct value *val, struct ui_file *stream)
void val_print_unavailable (struct ui_file *stream)
void val_print_invalid_address (struct ui_file *stream)
void generic_val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *original_value, const struct value_print_options *options, const struct generic_val_print_decorations *decorations)
void val_print (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, const struct language_defn *language)
static int value_check_printable (struct value *val, struct ui_file *stream, const struct value_print_options *options)
void common_val_print (struct value *val, struct ui_file *stream, int recurse, const struct value_print_options *options, const struct language_defn *language)
void value_print (struct value *val, struct ui_file *stream, const struct value_print_options *options)
void val_print_type_code_int (struct type *type, const gdb_byte *valaddr, struct ui_file *stream)
void val_print_type_code_flags (struct type *type, const gdb_byte *valaddr, struct ui_file *stream)
void val_print_scalar_formatted (struct type *type, const gdb_byte *valaddr, int embedded_offset, const struct value *val, const struct value_print_options *options, int size, struct ui_file *stream)
void print_longest (struct ui_file *stream, int format, int use_c_format, LONGEST val_long)
int longest_to_int (LONGEST arg)
void print_floating (const gdb_byte *valaddr, struct type *type, struct ui_file *stream)
void print_decimal_floating (const gdb_byte *valaddr, struct type *type, struct ui_file *stream)
void print_binary_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
void print_octal_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
void print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
void print_hex_chars (struct ui_file *stream, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
void print_char_chars (struct ui_file *stream, struct type *type, const gdb_byte *valaddr, unsigned len, enum bfd_endian byte_order)
void print_function_pointer_address (const struct value_print_options *options, struct gdbarch *gdbarch, CORE_ADDR address, struct ui_file *stream)
void maybe_print_array_index (struct type *index_type, LONGEST index, struct ui_file *stream, const struct value_print_options *options)
void val_print_array_elements (struct type *type, const gdb_byte *valaddr, int embedded_offset, CORE_ADDR address, struct ui_file *stream, int recurse, const struct value *val, const struct value_print_options *options, unsigned int i)
int read_string (CORE_ADDR addr, int len, int width, unsigned int fetchlimit, enum bfd_endian byte_order, gdb_byte **buffer, int *bytes_read)
static int wchar_printable (gdb_wchar_t w)
static void append_string_as_wide (const char *string, struct obstack *output)
static void print_wchar (gdb_wint_t w, const gdb_byte *orig, int orig_len, int width, enum bfd_endian byte_order, struct obstack *output, int quoter, int *need_escapep)
void generic_emit_char (int c, struct type *type, struct ui_file *stream, int quoter, const char *encoding)
static int count_next_character (struct wchar_iterator *iter, VEC(converted_character_d)**vec)
static void print_converted_chars_to_obstack (struct obstack *obstack, VEC(converted_character_d)*chars, int quote_char, int width, enum bfd_endian byte_order, const struct value_print_options *options)
void generic_printstr (struct ui_file *stream, struct type *type, const gdb_byte *string, unsigned int length, const char *encoding, int force_ellipses, int quote_char, int c_style_terminator, const struct value_print_options *options)
int val_print_string (struct type *elttype, const char *encoding, CORE_ADDR addr, int len, struct ui_file *stream, const struct value_print_options *options)
static void set_print_raw (char *arg, int from_tty)
static void show_print_raw (char *args, int from_tty)

Variables

struct cmd_list_elementsetprintrawlist
struct cmd_list_elementshowprintrawlist
struct value_print_options user_print_options
unsigned input_radix = 10
unsigned output_radix = 10
static unsigned input_radix_1 = 10
static unsigned output_radix_1 = 10

Define Documentation

#define BITS_IN_BYTES   8
#define BITS_IN_OCTAL   3

Referenced by print_octal_chars().

#define CARRY_LEFT (   x)    ((x) % TEN)

Referenced by print_decimal_chars().

#define CARRY_ONE   0001

Referenced by print_octal_chars().

#define CARRY_OUT (   x)    ((x) / TEN) /* extend char to int */

Referenced by print_decimal_chars().

#define CARRY_ZERO   0003

Referenced by print_octal_chars().

#define HIGH_NIBBLE (   x)    (((x) & 0x0F0) >> 4)

Referenced by print_decimal_chars().

#define HIGH_ONE   0200
#define HIGH_TWO   0300
#define HIGH_ZERO   0340

Referenced by print_octal_chars().

#define LOW_NIBBLE (   x)    ( (x) & 0x00F)

Referenced by print_decimal_chars().

#define LOW_ONE   0016

Referenced by print_octal_chars().

#define LOW_TWO   0007

Referenced by print_octal_chars().

#define LOW_ZERO   0016

Referenced by print_octal_chars().

#define MAX_WCHARS   4

Definition at line 44 of file valprint.c.

Referenced by count_next_character().

#define MID_ONE   0160

Referenced by print_octal_chars().

#define MID_TWO   0070

Referenced by print_octal_chars().

#define PRINT_MAX_DEFAULT   200 /* Start print_max off at this value. */

Definition at line 106 of file valprint.c.

#define SHIFT (   x)    ((x) << 4)

Referenced by print_decimal_chars().

#define TEN   10
#define WCHAR_BUFLEN (   X)    ((X) * sizeof (gdb_wchar_t))

Definition at line 48 of file valprint.c.

Referenced by count_next_character().

Definition at line 51 of file valprint.c.


Typedef Documentation

Definition at line 76 of file valprint.c.


Function Documentation

void _initialize_valprint ( void  )
static void append_string_as_wide ( const char *  string,
struct obstack *  output 
) [static]

Definition at line 1903 of file valprint.c.

References gdb_btowc, and string.

Referenced by print_wchar().

void common_val_print ( struct value val,
struct ui_file stream,
int  recurse,
const struct value_print_options options,
const struct language_defn language 
)
static int count_next_character ( struct wchar_iterator iter,
VEC(converted_character_d)**  vec 
) [static]
void generic_emit_char ( int  c,
struct type type,
struct ui_file stream,
int  quoter,
const char *  encoding 
)
void generic_printstr ( struct ui_file stream,
struct type type,
const gdb_byte string,
unsigned int  length,
const char *  encoding,
int  force_ellipses,
int  quote_char,
int  c_style_terminator,
const struct value_print_options options 
)
void generic_val_print ( struct type type,
const gdb_byte valaddr,
int  embedded_offset,
CORE_ADDR  address,
struct ui_file stream,
int  recurse,
const struct value original_value,
const struct value_print_options options,
const struct generic_val_print_decorations decorations 
)

Definition at line 371 of file valprint.c.

References _, value_print_options::addressprint, check_typedef(), CHECK_TYPEDEF, coerce_ref_if_computed(), common_val_print(), generic_val_print_decorations::complex_infix, generic_val_print_decorations::complex_prefix, generic_val_print_decorations::complex_suffix, current_language, demangle, value_print_options::deref_ref, error(), extract_typed_address(), generic_val_print_decorations::false_name, value_print_options::format, fprintf_filtered(), fputs_filtered(), gdb_assert, gdb_flush(), get_array_bounds(), get_type_arch(), LA_PRINT_CHAR, len, LONGEST, value_print_options::output_format, paddress(), value_print_options::prettyformat_arrays, print_address_demangle(), print_decimal_floating(), print_floating(), print_function_pointer_address(), print_longest(), print_spaces_filtered(), print_unpacked_pointer(), QUIT, value_print_options::symbol_print, generic_val_print_decorations::true_name, type, TYPE_CODE, TYPE_CODE_ARRAY, TYPE_CODE_BOOL, TYPE_CODE_CHAR, TYPE_CODE_COMPLEX, TYPE_CODE_DECFLOAT, TYPE_CODE_ENUM, TYPE_CODE_ERROR, TYPE_CODE_FLAGS, TYPE_CODE_FLT, TYPE_CODE_FUNC, TYPE_CODE_INT, TYPE_CODE_MEMBERPTR, TYPE_CODE_METHOD, TYPE_CODE_METHODPTR, TYPE_CODE_PTR, TYPE_CODE_RANGE, TYPE_CODE_REF, TYPE_CODE_STRUCT, TYPE_CODE_UNDEF, TYPE_CODE_UNION, TYPE_CODE_VOID, TYPE_ERROR_NAME, TYPE_FIELD_ENUMVAL, TYPE_FIELD_NAME, TYPE_FLAG_ENUM, TYPE_LENGTH, TYPE_NFIELDS, type_print(), TYPE_TARGET_TYPE, TYPE_UNSIGNED, unpack_long(), unpack_pointer(), val_print_array_elements(), val_print_scalar_formatted(), val_print_type_code_flags(), val_print_type_code_int(), value_at(), and generic_val_print_decorations::void_name.

Referenced by c_val_print(), f_val_print(), m2_val_print(), and pascal_val_print().

void get_formatted_print_options ( struct value_print_options opts,
char  format 
)
void maybe_print_array_index ( struct type index_type,
LONGEST  index,
struct ui_file stream,
const struct value_print_options options 
)
static int partial_memory_read ( CORE_ADDR  memaddr,
gdb_byte myaddr,
int  len,
int errptr 
) [static]

Definition at line 1721 of file valprint.c.

References len, and target_read_memory().

Referenced by read_string().

void print_binary_chars ( struct ui_file stream,
const gdb_byte valaddr,
unsigned  len,
enum bfd_endian  byte_order 
)

Definition at line 1144 of file valprint.c.

References BITS_IN_BYTES, fprintf_filtered(), len, and p.

Referenced by print_scalar_formatted().

void print_char_chars ( struct ui_file stream,
struct type type,
const gdb_byte valaddr,
unsigned  len,
enum bfd_endian  byte_order 
)

Definition at line 1519 of file valprint.c.

References LA_EMIT_CHAR, and p.

Referenced by print_scalar_formatted().

static void print_converted_chars_to_obstack ( struct obstack *  obstack,
VEC(converted_character_d)*  chars,
int  quote_char,
int  width,
enum bfd_endian  byte_order,
const struct value_print_options options 
) [static]
void print_decimal_chars ( struct ui_file stream,
const gdb_byte valaddr,
unsigned  len,
enum bfd_endian  byte_order 
)

Definition at line 1355 of file valprint.c.

References CARRY_LEFT, CARRY_OUT, dummy, fprintf_filtered(), HIGH_NIBBLE, LOW_NIBBLE, p, SHIFT, xfree(), and xmalloc().

Referenced by print_scalar_formatted().

void print_decimal_floating ( const gdb_byte valaddr,
struct type type,
struct ui_file stream 
)
void print_floating ( const gdb_byte valaddr,
struct type type,
struct ui_file stream 
)
void print_function_pointer_address ( const struct value_print_options options,
struct gdbarch gdbarch,
CORE_ADDR  address,
struct ui_file stream 
)
void print_hex_chars ( struct ui_file stream,
const gdb_byte valaddr,
unsigned  len,
enum bfd_endian  byte_order 
)
void print_longest ( struct ui_file stream,
int  format,
int  use_c_format,
LONGEST  val_long 
)
void print_octal_chars ( struct ui_file stream,
const gdb_byte valaddr,
unsigned  len,
enum bfd_endian  byte_order 
)
static void print_wchar ( gdb_wint_t  w,
const gdb_byte orig,
int  orig_len,
int  width,
enum bfd_endian  byte_order,
struct obstack *  output,
int  quoter,
int need_escapep 
) [static]
int read_string ( CORE_ADDR  addr,
int  len,
int  width,
unsigned int  fetchlimit,
enum bfd_endian  byte_order,
gdb_byte **  buffer,
int bytes_read 
)
static void set_input_radix ( char *  args,
int  from_tty,
struct cmd_list_element c 
) [static]

Definition at line 2555 of file valprint.c.

References set_input_radix_1().

static void set_input_radix_1 ( int  from_tty,
unsigned  radix 
) [static]

Definition at line 2561 of file valprint.c.

References _, error(), input_radix, and printf_filtered().

Referenced by set_input_radix(), and set_radix().

static void set_output_radix ( char *  args,
int  from_tty,
struct cmd_list_element c 
) [static]

Definition at line 2592 of file valprint.c.

References set_output_radix_1().

static void set_output_radix_1 ( int  from_tty,
unsigned  radix 
) [static]

Definition at line 2598 of file valprint.c.

References _, error(), value_print_options::output_format, output_radix, and printf_filtered().

Referenced by set_output_radix(), and set_radix().

static void set_print ( char *  arg,
int  from_tty 
) [static]

Definition at line 2679 of file valprint.c.

References gdb_stdout, help_list(), printf_unfiltered(), and setprintlist.

static void set_print_raw ( char *  arg,
int  from_tty 
) [static]

Definition at line 2693 of file valprint.c.

References gdb_stdout, help_list(), and printf_unfiltered().

static void set_radix ( char *  arg,
int  from_tty 
) [static]
static void show_addressprint ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 257 of file valprint.c.

References _, and fprintf_filtered().

static void show_input_radix ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 172 of file valprint.c.

References _, and fprintf_filtered().

static void show_output_radix ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 182 of file valprint.c.

References _, and fprintf_filtered().

static void show_prettyformat_arrays ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 236 of file valprint.c.

References _, and fprintf_filtered().

static void show_prettyformat_structs ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 227 of file valprint.c.

References _, and fprintf_filtered().

static void show_print ( char *  args,
int  from_tty 
) [static]

Definition at line 2687 of file valprint.c.

References cmd_show_list(), and showprintlist.

static void show_print_array_indexes ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 194 of file valprint.c.

References _, and fprintf_filtered().

static void show_print_max ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 158 of file valprint.c.

References _, and fprintf_filtered().

static void show_print_raw ( char *  args,
int  from_tty 
) [static]

Definition at line 2701 of file valprint.c.

References cmd_show_list().

static void show_radix ( char *  arg,
int  from_tty 
) [static]

Definition at line 2655 of file valprint.c.

References _, input_radix, output_radix, and printf_filtered().

static void show_repeat_count_threshold ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 205 of file valprint.c.

References _, and fprintf_filtered().

static void show_stop_print_at_null ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 215 of file valprint.c.

References _, and fprintf_filtered().

static void show_symbol_print ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 264 of file valprint.c.

References _, and fprintf_filtered().

static void show_unionprint ( struct ui_file file,
int  from_tty,
struct cmd_list_element c,
const char *  value 
) [static]

Definition at line 246 of file valprint.c.

References _, and fprintf_filtered().

void val_print ( struct type type,
const gdb_byte valaddr,
int  embedded_offset,
CORE_ADDR  address,
struct ui_file stream,
int  recurse,
const struct value val,
const struct value_print_options options,
const struct language_defn language 
)
void val_print_array_elements ( struct type type,
const gdb_byte valaddr,
int  embedded_offset,
CORE_ADDR  address,
struct ui_file stream,
int  recurse,
const struct value val,
const struct value_print_options options,
unsigned int  i 
)
void val_print_invalid_address ( struct ui_file stream)

Definition at line 354 of file valprint.c.

References _, and fprintf_filtered().

Referenced by cp_print_value(), and pascal_object_print_value().

void val_print_optimized_out ( const struct value val,
struct ui_file stream 
)
void val_print_scalar_formatted ( struct type type,
const gdb_byte valaddr,
int  embedded_offset,
const struct value val,
const struct value_print_options options,
int  size,
struct ui_file stream 
)
int val_print_scalar_type_p ( struct type type)
int val_print_string ( struct type elttype,
const char *  encoding,
CORE_ADDR  addr,
int  len,
struct ui_file stream,
const struct value_print_options options 
)
void val_print_type_code_flags ( struct type type,
const gdb_byte valaddr,
struct ui_file stream 
)
void val_print_type_code_int ( struct type type,
const gdb_byte valaddr,
struct ui_file stream 
)
void val_print_unavailable ( struct ui_file stream)
int valprint_check_validity ( struct ui_file stream,
struct type type,
int  embedded_offset,
const struct value val 
)
static int value_check_printable ( struct value val,
struct ui_file stream,
const struct value_print_options options 
) [static]
void value_print ( struct value val,
struct ui_file stream,
const struct value_print_options options 
)
static int wchar_printable ( gdb_wchar_t  w) [static]

Definition at line 1890 of file valprint.c.

References gdb_iswprint, and LCST.

Referenced by generic_emit_char().


Variable Documentation

unsigned input_radix = 10
unsigned input_radix_1 = 10 [static]

Definition at line 2548 of file valprint.c.

unsigned output_radix = 10

Definition at line 180 of file valprint.c.

Referenced by set_output_radix_1(), and show_radix().

unsigned output_radix_1 = 10 [static]

Definition at line 2589 of file valprint.c.

Definition at line 80 of file valprint.c.

Definition at line 81 of file valprint.c.

Initial value:
{
  Val_prettyformat_default,     
  0,                            
  0,                            
  0,                            
  1,                            
  1,                            
  0,                            
  PRINT_MAX_DEFAULT,            
  10,                           
  0,                            
  0,                            
  0,                            
  0,                            
  0,                            
  1,                            
  1,                            
  0,                            
  0,                            
  1                             
}

Definition at line 108 of file valprint.c.

Referenced by _initialize_pascal_valprint(), get_formatted_print_options(), get_no_prettyformat_print_options(), and get_user_print_options().

 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Defines