From 1c35a88f1d8399902c08a8334d3e3303df833538 Mon Sep 17 00:00:00 2001 From: Luis Machado Date: Wed, 9 Dec 2015 10:56:27 -0200 Subject: 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 * 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) : 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 * 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 * gdb.mi/mi-var-display.exp: Add new checks for the zero-hexadecimal format and change test names to make them unique. --- gdb/testsuite/gdb.mi/mi-var-display.exp | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) (limited to 'gdb/testsuite/gdb.mi') diff --git a/gdb/testsuite/gdb.mi/mi-var-display.exp b/gdb/testsuite/gdb.mi/mi-var-display.exp index 31bdce4..d65233b 100644 --- a/gdb/testsuite/gdb.mi/mi-var-display.exp +++ b/gdb/testsuite/gdb.mi/mi-var-display.exp @@ -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 -- cgit v1.1