+2015-12-09 Luis Machado <lgustavo@codesourcery.com>
+
+ * gdb/mi/mi-cmd-var.c (mi_parse_format): Handle new "zero-hexadecimal"
+ format.
+ * gdb/varobj.c (varobj_format_string): Add "zero-hexadecimal" entry.
+ (format_code): Add 'z' entry.
+ (varobj_set_display_format): Handle FORMAT_ZHEXADECIMAL.
+ * gdb/varobj.h (varobj_display_formats) <FORMAT_ZHEXADECIMAL>: New enum
+ field.
+ * NEWS: Add new note to MI changes citing the new zero-hexadecimal
+ format for -var-set-format.
+
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com> (tiny patch)
PR gdb/18702
The reply to qXfer:threads:read may now include a name attribute for each
thread.
+* MI changes
+
+ ** The -var-set-format command now accepts the zero-hexadecimal
+ format. It outputs data in hexadecimal format with zero-padding on the
+ left.
+
*** Changes in GDB 7.10
* Support for process record-replay and reverse debugging on aarch64*-linux*
+2015-12-09 Luis Machado <lgustavo@codesourcery.com>
+
+ * gdb.texinfo (GDB/MI Variable Objects): Update text to mention
+ -var-set-format's new zero-hexadecimal format.
+
2015-12-08 Pierre-Marie de Rodat <derodat@adacore.com>
* gdb.texinfo (Ada Mode Into): Move overloading support
@smallexample
@var{format-spec} @expansion{}
- @{binary | decimal | hexadecimal | octal | natural@}
+ @{binary | decimal | hexadecimal | octal | natural | zero-hexadecimal@}
@end smallexample
The natural format is the default format choosen automatically
based on the variable type (like decimal for an @code{int}, hex
for pointers, etc.).
+The zero-hexadecimal format has a representation similar to hexadecimal
+but with padding zeroes to the left of the value. For example, a 32-bit
+hexadecimal value of 0x1234 would be represented as 0x00001234 in the
+zero-hexadecimal format.
+
For a variable with children, the format is set only on the
variable itself, and the children are not affected.
return FORMAT_HEXADECIMAL;
else if (strncmp (arg, "octal", len) == 0)
return FORMAT_OCTAL;
+ else if (strncmp (arg, "zero-hexadecimal", len) == 0)
+ return FORMAT_ZHEXADECIMAL;
}
error (_("Must specify the format as: \"natural\", "
- "\"binary\", \"decimal\", \"hexadecimal\", or \"octal\""));
+ "\"binary\", \"decimal\", \"hexadecimal\", \"octal\" or \"zero-hexadecimal\""));
}
void
+2015-12-09 Luis Machado <lgustavo@codesourcery.com>
+
+ * gdb.mi/mi-var-display.exp: Add new checks for the zero-hexadecimal
+ format and change test names to make them unique.
+
2015-12-09 Ruslan Kabatsayev <b7.10110111@gmail.com>
Pedro Alves <pedro@redhat.com>
"eval variable bar"
# Test: c_variable-6.5
+# Desc: change format of bar to zero-padded hexadecimal
+mi_gdb_test "-var-set-format bar zero-hexadecimal" \
+ "\\^done,format=\"zero-hexadecimal\",value=\"0x0.*849\"" \
+ "set format variable bar in zero-padded hexadecimal"
+
# Desc: change format of bar to hex
mi_gdb_test "-var-set-format bar hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"0x849\"" \
mi_gdb_test "-var-show-format weird.func_ptr" \
"\\^done,format=\"hexadecimal\"" \
- "show format variable weird.func_ptr"
+ "show format variable weird.func_ptr (hex)"
mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
"\\^done,format=\"hexadecimal\"" \
- "show format variable weird.func_ptr_ptr"
+ "show format variable weird.func_ptr_ptr (hex)"
+
+mi_gdb_test "-var-set-format weird.func_ptr zero-hexadecimal" \
+ "\\^done,format=\"zero-hexadecimal\",value=\"$hex\"" \
+ "set format variable weird.func_ptr in zero-padded hex"
+
+mi_gdb_test "-var-show-format weird.func_ptr" \
+ "\\^done,format=\"zero-hexadecimal\"" \
+ "show format variable weird.func_ptr (zhex)"
+
+mi_gdb_test "-var-set-format weird.func_ptr_ptr zero-hexadecimal" \
+ "\\^done,format=\"zero-hexadecimal\",value=\"$hex\"" \
+ "set format variable weird.func_ptr_ptr in zero-padded hex"
+
+mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
+ "\\^done,format=\"zero-hexadecimal\"" \
+ "show format variable weird.func_ptr_ptr (zhex)"
# Test: c_variable-6.24
# Desc: format of weird and children
/* String representations of gdb's format codes. */
char *varobj_format_string[] =
- { "natural", "binary", "decimal", "hexadecimal", "octal" };
+ { "natural", "binary", "decimal", "hexadecimal", "octal", "zero-hexadecimal" };
/* True if we want to allow Python-based pretty-printing. */
static int pretty_printing = 0;
/* Private data */
/* Mappings of varobj_display_formats enums to gdb's format codes. */
-static int format_code[] = { 0, 't', 'd', 'x', 'o' };
+static int format_code[] = { 0, 't', 'd', 'x', 'o', 'z' };
/* Header of the list of root variable objects. */
static struct varobj_root *rootlist;
case FORMAT_DECIMAL:
case FORMAT_HEXADECIMAL:
case FORMAT_OCTAL:
+ case FORMAT_ZHEXADECIMAL:
var->format = format;
break;
FORMAT_BINARY, /* Binary display */
FORMAT_DECIMAL, /* Decimal display */
FORMAT_HEXADECIMAL, /* Hex display */
- FORMAT_OCTAL /* Octal display */
+ FORMAT_OCTAL, /* Octal display */
+ FORMAT_ZHEXADECIMAL /* Zero padded hexadecimal */
};
enum varobj_type