2014-10-07 Pierre Muller * infcmd.c (default_print_one_register_info): Pass print_raw_format into opts.raw field for vector types. * printcmd.c (print_scalar_formatted): Handle float value with raw and hexadecimal by printing flaot valueand raw content. diff --git a/gdb/infcmd.c b/gdb/infcmd.c index 178bd73..bb8c606 100644 --- a/gdb/infcmd.c +++ b/gdb/infcmd.c @@ -2095,6 +2095,10 @@ default_print_one_register_info (struct ui_file *file, /* Print the register in hex. */ get_formatted_print_options (&opts, 'x'); + /* For vector type, specify also raw option, to generate more useful + output. */ + if (TYPE_VECTOR (regtype)) + opts.raw = print_raw_format; opts.deref_ref = 1; val_print (regtype, value_contents_for_printing (val), diff --git a/gdb/printcmd.c b/gdb/printcmd.c index a65423d..9ee3e96 100644 --- a/gdb/printcmd.c +++ b/gdb/printcmd.c @@ -415,6 +415,30 @@ print_scalar_formatted (const void *valaddr, struct type *type, val_long &= ((LONGEST) 1 << HOST_CHAR_BIT * len) - 1; } + /* Handle special raw and hexadecimal format for useful display of + vector types: for floating type, print out + float value and raw content in hexdecimal, + instead of value converted to long. */ + if (options->raw && options->format == 'x') + { + int i; + const gdb_byte *raw = (const gdb_byte *) valaddr; + + if (TYPE_CODE (type) == TYPE_CODE_FLT + || TYPE_CODE (type) == TYPE_CODE_DECFLOAT) + { + type = float_type_from_length (type); + print_floating (valaddr, type, stream); + if (len > 0) + { + fputs_filtered ("\t(raw: ", stream); + print_hex_chars (stream, valaddr, TYPE_LENGTH (type), byte_order); + fputs_filtered (")", stream); + } + return; + } + } + switch (options->format) { case 'x':