X-Git-Url: http://git.efficios.com/?a=blobdiff_plain;f=gdb%2Fvalprint.c;h=f7088d4d4984968c9ee2381c9cac5a502d7c7f7d;hb=7c392d1de1400202eb86f7679628c4b7c14f8108;hp=7b2b79b53964d1a5d723dc88d1ec5d5015c226f9;hpb=268a13a5a3f7c6b9b6ffc5ac2d1b24eb41f3fbdc;p=deliverable%2Fbinutils-gdb.git diff --git a/gdb/valprint.c b/gdb/valprint.c index 7b2b79b539..f7088d4d49 100644 --- a/gdb/valprint.c +++ b/gdb/valprint.c @@ -1,6 +1,6 @@ /* Print values for GDB, the GNU debugger. - Copyright (C) 1986-2019 Free Software Foundation, Inc. + Copyright (C) 1986-2020 Free Software Foundation, Inc. This file is part of GDB. @@ -37,6 +37,8 @@ #include #include "gdbsupport/byte-vector.h" #include "cli/cli-option.h" +#include "gdbarch.h" +#include "cli/cli-style.h" /* Maximum number of wchars returned from wchar_iterate. */ #define MAX_WCHARS 4 @@ -346,7 +348,8 @@ valprint_check_validity (struct ui_file *stream, } if (!is_ref || !ref_is_addressable) - fputs_filtered (_(""), stream); + fputs_styled (_(""), metadata_style.style (), + stream); /* C++ references should be valid even if they're synthetic. */ return is_ref; @@ -368,25 +371,25 @@ val_print_optimized_out (const struct value *val, struct ui_file *stream) if (val != NULL && value_lval_const (val) == lval_register) val_print_not_saved (stream); else - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); } void val_print_not_saved (struct ui_file *stream) { - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); } void val_print_unavailable (struct ui_file *stream) { - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); } void val_print_invalid_address (struct ui_file *stream) { - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); } /* Print a pointer based on the type of its target. @@ -987,7 +990,7 @@ generic_val_print (struct type *type, /* This happens (without TYPE_STUB set) on systems which don't use dbx xrefs (NO_DBX_XREFS in gcc) if a file has a "struct foo *bar" and no complete type for struct foo in that file. */ - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); break; case TYPE_CODE_COMPLEX: @@ -1046,7 +1049,7 @@ val_print (struct type *type, LONGEST embedded_offset, if (TYPE_STUB (real_type)) { - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), _("")); return; } @@ -1083,7 +1086,8 @@ val_print (struct type *type, LONGEST embedded_offset, } catch (const gdb_exception_error &except) { - fprintf_filtered (stream, _("")); + fprintf_styled (stream, metadata_style.style (), + _("")); } } @@ -1114,7 +1118,8 @@ value_check_printable (struct value *val, struct ui_file *stream, { if (val == 0) { - fprintf_filtered (stream, _("
")); + fprintf_styled (stream, metadata_style.style (), + _("
")); return 0; } @@ -1138,8 +1143,9 @@ value_check_printable (struct value *val, struct ui_file *stream, if (TYPE_CODE (value_type (val)) == TYPE_CODE_INTERNAL_FUNCTION) { - fprintf_filtered (stream, _(""), - value_internal_function_name (val)); + fprintf_styled (stream, metadata_style.style (), + _(""), + value_internal_function_name (val)); return 0; } @@ -1323,7 +1329,7 @@ val_print_scalar_formatted (struct type *type, (leading 0 or 0x). Hilfinger/2004-09-09: USE_C_FORMAT was originally called USE_LOCAL - and was intended to request formating according to the current + and was intended to request formatting according to the current language and would be used for most integers that GDB prints. The exceptional cases were things like protocols where the format of the integer is a protocol thing, not a user-visible thing). The @@ -1714,7 +1720,7 @@ print_decimal_chars (struct ui_file *stream, const gdb_byte *valaddr, * decimal. * * Given a hex number (in nibbles) as XYZ, we start by taking X and - * decemalizing it as "x1 x2" in two decimal nibbles. Then we multiply + * decimalizing it as "x1 x2" in two decimal nibbles. Then we multiply * the nibbles by 16, add Y and re-decimalize. Repeat with Z. * * The trick is that "digits" holds a base-10 number, but sometimes @@ -2068,7 +2074,8 @@ val_print_array_elements (struct type *type, address, stream, recurse + 1, val, options, current_language); annotate_elt_rep (reps); - fprintf_filtered (stream, " ", reps); + fprintf_filtered (stream, " %p[%p]", + metadata_style.style ().ptr (), reps, nullptr); annotate_elt_rep_end (); i = rep1 - 1; @@ -2395,7 +2402,7 @@ generic_emit_char (int c, struct type *type, struct ui_file *stream, int quoter, const char *encoding) { enum bfd_endian byte_order - = gdbarch_byte_order (get_type_arch (type)); + = type_byte_order (type); gdb_byte *c_buf; int need_escape = 0; @@ -2657,7 +2664,7 @@ print_converted_chars_to_obstack (struct obstack *obstack, obstack, 0, &need_escape); obstack_grow_wstr (obstack, LCST (">")); - /* We do not attempt to outupt anything after this. */ + /* We do not attempt to output anything after this. */ state = FINISH; break; @@ -2715,7 +2722,7 @@ generic_printstr (struct ui_file *stream, struct type *type, int quote_char, int c_style_terminator, const struct value_print_options *options) { - enum bfd_endian byte_order = gdbarch_byte_order (get_type_arch (type)); + enum bfd_endian byte_order = type_byte_order (type); unsigned int i; int width = TYPE_LENGTH (type); int finished = 0; @@ -2827,7 +2834,7 @@ val_print_string (struct type *elttype, const char *encoding, int bytes_read; gdb::unique_xmalloc_ptr buffer; /* Dynamically growable fetch buffer. */ struct gdbarch *gdbarch = get_type_arch (elttype); - enum bfd_endian byte_order = gdbarch_byte_order (gdbarch); + enum bfd_endian byte_order = type_byte_order (elttype); int width = TYPE_LENGTH (elttype); /* First we need to figure out the limit on the number of characters we are @@ -2890,9 +2897,9 @@ val_print_string (struct type *elttype, const char *encoding, { std::string str = memory_error_message (TARGET_XFER_E_IO, gdbarch, addr); - fprintf_filtered (stream, ""); + fprintf_filtered (stream, _(""), + styled_string (metadata_style.style (), + str.c_str ())); } return (bytes_read / width); @@ -3113,7 +3120,7 @@ using uinteger_option_def using zuinteger_unlimited_option_def = gdb::option::zuinteger_unlimited_option_def; -/* Definions of options for the "print" and "compile print" +/* Definitions of options for the "print" and "compile print" commands. */ static const gdb::option::option_def value_print_option_defs[] = { @@ -3140,7 +3147,7 @@ static const gdb::option::option_def value_print_option_defs[] = { [] (value_print_options *opt) { return &opt->print_array_indexes; }, show_print_array_indexes, /* show_cmd_cb */ N_("Set printing of array indexes."), - N_("Show printing of array indexes"), + N_("Show printing of array indexes."), NULL, /* help_doc */ }, @@ -3191,6 +3198,16 @@ Use \"unlimited\" to print the complete structure.") NULL, /* help_doc */ }, + boolean_option_def { + "raw-values", + [] (value_print_options *opt) { return &opt->raw; }, + NULL, /* show_cmd_cb */ + N_("Set whether to print values in raw form."), + N_("Show whether to print values in raw form."), + N_("If set, values are printed in raw form, bypassing any\n\ +pretty-printers for that value.") + }, + uinteger_option_def { "repeats", [] (value_print_options *opt) { return &opt->repeat_count_threshold; },