mirror of
https://sourceware.org/git/binutils-gdb.git
synced 2025-02-17 13:10:12 +08:00
varobj zero-padded hexadecimal format
This set of patches add support for the zero-padded hexadecimal format for varobj's, defined as "zero-hexadecimal". We currently only support regular non-zero-padded hexadecimal. Talking with IDE developers, they would like to have this option that is already available to GDB's print/x commands, in the CLI, as 'z'. gdb/ChangeLog: 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. gdb/doc/ChangeLog: 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. gdb/testsuite/ChangeLog: 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.
This commit is contained in:
parent
ec892a0718
commit
1c35a88f1d
@ -1,3 +1,15 @@
|
||||
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
|
||||
|
6
gdb/NEWS
6
gdb/NEWS
@ -135,6 +135,12 @@ show remote exec-event-feature-packet
|
||||
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*
|
||||
|
@ -1,3 +1,8 @@
|
||||
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
|
||||
|
@ -28980,13 +28980,18 @@ The syntax for the @var{format-spec} is as follows:
|
||||
|
||||
@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.
|
||||
|
||||
|
@ -233,10 +233,12 @@ mi_parse_format (const char *arg)
|
||||
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
|
||||
|
@ -1,3 +1,8 @@
|
||||
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>
|
||||
|
||||
|
@ -81,6 +81,11 @@ mi_gdb_test "-var-evaluate-expression bar" \
|
||||
"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\"" \
|
||||
@ -241,7 +246,7 @@ mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
|
||||
|
||||
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\"" \
|
||||
@ -249,7 +254,23 @@ mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
|
||||
|
||||
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
|
||||
|
@ -50,7 +50,7 @@ show_varobjdebug (struct ui_file *file, int from_tty,
|
||||
|
||||
/* 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;
|
||||
@ -214,7 +214,7 @@ static struct varobj *varobj_add_child (struct varobj *var,
|
||||
/* 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;
|
||||
@ -583,6 +583,7 @@ varobj_set_display_format (struct varobj *var,
|
||||
case FORMAT_DECIMAL:
|
||||
case FORMAT_HEXADECIMAL:
|
||||
case FORMAT_OCTAL:
|
||||
case FORMAT_ZHEXADECIMAL:
|
||||
var->format = format;
|
||||
break;
|
||||
|
||||
|
@ -28,7 +28,8 @@ enum varobj_display_formats
|
||||
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
|
||||
|
Loading…
Reference in New Issue
Block a user