This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH]: MI -var-set-format


 > That, or put the "set octal" line in gdb.exp (nothing mi-specific
 > about it).  I didn't see that line.  All the changes to "global" lines
 > are not needed.

OK.  Below is what I've committed.  A couple of the tests required new values
because of changes since the previous submission,

-- 
Nick                                           http://www.inet.net.nz/~nickrob


2008-01-23  Nick Roberts  <nickrob@snap.net.nz>

	* mi/mi-cmd-var.c (mi_cmd_var_set_format): Add value field to output.

2008-01-23  Nick Roberts  <nickrob@snap.net.nz>

	* lib/gdb.exp: Add the variable octal.
 
	* gdb.mi/mi-var-display.exp: Add value field to tests for output of 
	-var-set-format.


Index: mi/mi-cmd-var.c
===================================================================
RCS file: /cvs/src/src/gdb/mi/mi-cmd-var.c,v
retrieving revision 1.43
diff -p -r1.43 mi-cmd-var.c
*** mi/mi-cmd-var.c	1 Jan 2008 22:53:14 -0000	1.43
--- mi/mi-cmd-var.c	23 Jan 2008 06:11:02 -0000
*************** mi_cmd_var_set_format (char *command, ch
*** 231,236 ****
--- 231,239 ----
  
    /* Report the new current format */
    ui_out_field_string (uiout, "format", varobj_format_string[(int) format]);
+  
+   /* Report the value in the new format */
+   ui_out_field_string (uiout, "value", varobj_get_value (var));
    return MI_CMD_DONE;
  }
  
Index: testsuite/lib/gdb.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/lib/gdb.exp,v
retrieving revision 1.95
diff -p -r1.95 gdb.exp
*** testsuite/lib/gdb.exp	1 Jan 2008 22:53:22 -0000	1.95
--- testsuite/lib/gdb.exp	23 Jan 2008 06:11:05 -0000
*************** if ![info exists env(EXEEXT)] {
*** 85,90 ****
--- 85,92 ----
      set EXEEXT $env(EXEEXT)
  }
  
+ set octal "\[0-7\]+"
+ 
  ### Only procedures should come after this point.
  
  #
Index: testsuite/gdb.mi/mi-var-display.exp
===================================================================
RCS file: /cvs/src/src/gdb/testsuite/gdb.mi/mi-var-display.exp,v
retrieving revision 1.20
diff -p -r1.20 mi-var-display.exp
*** testsuite/gdb.mi/mi-var-display.exp	1 Jan 2008 22:53:20 -0000	1.20
--- testsuite/gdb.mi/mi-var-display.exp	23 Jan 2008 06:11:06 -0000
*************** mi_gdb_test "-var-evaluate-expression ba
*** 89,95 ****
  # Test: c_variable-6.5
  # Desc: change format of bar to hex
  mi_gdb_test "-var-set-format bar hexadecimal" \
! 	"\\^done,format=\"hexadecimal\"" \
  	"set format variable bar"
  
  # Test: c_variable-6.6
--- 89,95 ----
  # Test: c_variable-6.5
  # Desc: change format of bar to hex
  mi_gdb_test "-var-set-format bar hexadecimal" \
! 	"\\^done,format=\"hexadecimal\",value=\"0x849\"" \
  	"set format variable bar"
  
  # Test: c_variable-6.6
*************** mi_gdb_test "-var-assign bar 3" \
*** 105,111 ****
  	"assing to variable bar"
  
  mi_gdb_test "-var-set-format bar decimal" \
! 	"\\^done,format=\"decimal\"" \
  	"set format variable bar"
  
  mi_gdb_test "-var-evaluate-expression bar" \
--- 105,111 ----
  	"assing to variable bar"
  
  mi_gdb_test "-var-set-format bar decimal" \
! 	"\\^done,format=\"decimal\",value=\"3\"" \
  	"set format variable bar"
  
  mi_gdb_test "-var-evaluate-expression bar" \
*************** mi_gdb_test "-var-evaluate-expression fo
*** 143,149 ****
  # Test: c_variable-6.15
  # Desc: change format of var to octal
  mi_gdb_test "-var-set-format foo octal" \
! 	"\\^done,format=\"octal\"" \
  	"set format variable foo"
  
  mi_gdb_test "-var-show-format foo" \
--- 143,149 ----
  # Test: c_variable-6.15
  # Desc: change format of var to octal
  mi_gdb_test "-var-set-format foo octal" \
! 	"\\^done,format=\"octal\",value=\"$octal\"" \
  	"set format variable foo"
  
  mi_gdb_test "-var-show-format foo" \
*************** mi_gdb_test "-var-assign foo 3" \
*** 163,169 ****
  	"assing to variable foo"
  
  mi_gdb_test "-var-set-format foo decimal" \
! 	"\\^done,format=\"decimal\"" \
  	"set format variable foo"
  
  # Test: c_variable-6.18
--- 163,169 ----
  	"assing to variable foo"
  
  mi_gdb_test "-var-set-format foo decimal" \
! 	"\\^done,format=\"decimal\",value=\"3\"" \
  	"set format variable foo"
  
  # Test: c_variable-6.18
*************** mi_gdb_test "-var-list-children weird" \
*** 190,196 ****
  # Test: c_variable-6.23
  # Desc: change format of weird.func_ptr and weird.func_ptr_ptr
  mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\"" \
  	"set format variable weird.func_ptr"
  
  mi_gdb_test "-var-show-format weird.func_ptr" \
--- 190,196 ----
  # Test: c_variable-6.23
  # Desc: change format of weird.func_ptr and weird.func_ptr_ptr
  mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
  	"set format variable weird.func_ptr"
  
  mi_gdb_test "-var-show-format weird.func_ptr" \
*************** mi_gdb_test "-var-show-format weird.func
*** 198,204 ****
  	"show format variable weird.func_ptr"
  
  mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\"" \
  	"set format variable weird.func_ptr_ptr"
  
  mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
--- 198,204 ----
  	"show format variable weird.func_ptr"
  
  mi_gdb_test "-var-set-format weird.func_ptr_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
  	"set format variable weird.func_ptr_ptr"
  
  mi_gdb_test "-var-show-format weird.func_ptr_ptr" \
*************** mi_gdb_test "-var-show-format weird.func
*** 208,258 ****
  # Test: c_variable-6.24
  # Desc: format of weird and children
  mi_gdb_test "-var-set-format weird natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird"
  
  mi_gdb_test "-var-set-format weird.integer natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.integer"
  
  mi_gdb_test "-var-set-format weird.character natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.character"
  
  mi_gdb_test "-var-set-format weird.char_ptr natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.char_ptr"
  
  mi_gdb_test "-var-set-format weird.long_int natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.long_int"
  
  mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.int_ptr_ptr"
  
  mi_gdb_test "-var-set-format weird.long_array natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.long_array"
  
  mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\"" \
  	"set format variable weird.func_ptr"
  
  mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
! 	"\\^done,format=\"hexadecimal\"" \
  	"set format variable weird.func_ptr_struct"
  
  mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.func_ptr_ptr"
  
  mi_gdb_test "-var-set-format weird.u1 natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.u1"
  
  mi_gdb_test "-var-set-format weird.s2 natural" \
! 	"\\^done,format=\"natural\"" \
  	"set format variable weird.s2"
  
  # Test: c_variable-6.25
--- 208,258 ----
  # Test: c_variable-6.24
  # Desc: format of weird and children
  mi_gdb_test "-var-set-format weird natural" \
! 	"\\^done,format=\"natural\",value=\"$hex\"" \
  	"set format variable weird"
  
  mi_gdb_test "-var-set-format weird.integer natural" \
! 	"\\^done,format=\"natural\",value=\"123\"" \
  	"set format variable weird.integer"
  
  mi_gdb_test "-var-set-format weird.character natural" \
! 	"\\^done,format=\"natural\",value=\"0 '\\\\\\\\0'\"" \
  	"set format variable weird.character"
  
  mi_gdb_test "-var-set-format weird.char_ptr natural" \
! 	"\\^done,format=\"natural\",value=\"$hex \\\\\"hello\\\\\"\"" \
  	"set format variable weird.char_ptr"
  
  mi_gdb_test "-var-set-format weird.long_int natural" \
! 	"\\^done,format=\"natural\",value=\"0\"" \
  	"set format variable weird.long_int"
  
  mi_gdb_test "-var-set-format weird.int_ptr_ptr natural" \
! 	"\\^done,format=\"natural\",value=\"$hex\"" \
  	"set format variable weird.int_ptr_ptr"
  
  mi_gdb_test "-var-set-format weird.long_array natural" \
! 	"\\^done,format=\"natural\",value=\"\\\[10\\\]\"" \
  	"set format variable weird.long_array"
  
  mi_gdb_test "-var-set-format weird.func_ptr hexadecimal" \
! 	"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
  	"set format variable weird.func_ptr"
  
  mi_gdb_test "-var-set-format weird.func_ptr_struct hexadecimal" \
! 	"\\^done,format=\"hexadecimal\",value=\"$hex\"" \
  	"set format variable weird.func_ptr_struct"
  
  mi_gdb_test "-var-set-format weird.func_ptr_ptr natural" \
! 	"\\^done,format=\"natural\",value=\"0\"" \
  	"set format variable weird.func_ptr_ptr"
  
  mi_gdb_test "-var-set-format weird.u1 natural" \
! 	"\\^done,format=\"natural\",value=\"\{...\}\"" \
  	"set format variable weird.u1"
  
  mi_gdb_test "-var-set-format weird.s2 natural" \
! 	"\\^done,format=\"natural\",value=\"\{...\}\"" \
  	"set format variable weird.s2"
  
  # Test: c_variable-6.25


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]