Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
* [PATCH]: MI -var-set-format
@ 2006-05-02  6:19 Nick Roberts
  2006-05-05 18:11 ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2006-05-02  6:19 UTC (permalink / raw)
  To: gdb-patches


Currently:

  -var-evaluate-expression var1
  ^done,value="18"

  -var-set-format var1 hexadecimal
  ^done,format="hexadecimal"

-var-set-format just repeats the format that has been set which is not
very useful since presumably the front end sent it in the first place.

I would like to add the value in the (new) current format, which I find
much more useful:

  -var-set-format var1 hexadecimal
  ^done,format="hexadecimal",value="0x12"

OK to apply if I update the testsuite accordingly?


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


2006-05-02  Nick Roberts  <nickrob@snap.net.nz>

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



*** mi-cmd-var.c	31 Mar 2006 12:46:48 +1200	1.23
--- mi-cmd-var.c	02 May 2006 18:16:39 +1200	
***************
*** 211,216 ****
--- 211,219 ----
  
    /* 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;
  }


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2006-05-02  6:19 [PATCH]: MI -var-set-format Nick Roberts
@ 2006-05-05 18:11 ` Daniel Jacobowitz
  2006-05-05 23:30   ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2006-05-05 18:11 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Tue, May 02, 2006 at 06:20:04PM +1200, Nick Roberts wrote:
> 
> Currently:
> 
>   -var-evaluate-expression var1
>   ^done,value="18"
> 
>   -var-set-format var1 hexadecimal
>   ^done,format="hexadecimal"
> 
> -var-set-format just repeats the format that has been set which is not
> very useful since presumably the front end sent it in the first place.
> 
> I would like to add the value in the (new) current format, which I find
> much more useful:
> 
>   -var-set-format var1 hexadecimal
>   ^done,format="hexadecimal",value="0x12"
> 
> OK to apply if I update the testsuite accordingly?

This seems reasonable; I doubt anyone will object.

I was wondering how to handle potential error conditions.  I see at
least two:

  - The return of varobj_get_value can be NULL.  You should check for
    that.
  - common_val_print might fail to transform the struct value * into
    a string for some reason.  I believe it may call error() if that
    happens.

Should -var-set-format fail in those cases, or should it omit the
value, or should it supply a default value string (e.g. <error>)?  It
will have changed the varobj's settings, so I don't think ^error
is appropriate.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2006-05-05 18:11 ` Daniel Jacobowitz
@ 2006-05-05 23:30   ` Nick Roberts
  2006-05-15 17:07     ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2006-05-05 23:30 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > I would like to add the value in the (new) current format, which I find
 > > much more useful:
 > > 
 > >   -var-set-format var1 hexadecimal
 > >   ^done,format="hexadecimal",value="0x12"
 > > 
 > > OK to apply if I update the testsuite accordingly?
 > 
 > This seems reasonable; I doubt anyone will object.
 > 
 > I was wondering how to handle potential error conditions.  I see at
 > least two:
 > 
 >   - The return of varobj_get_value can be NULL.  You should check for
 >     that.

That often happens already.  I don't see a real problem: the null string
gets returned and nothing gets printed for the value.

 >   - common_val_print might fail to transform the struct value * into
 >     a string for some reason.  I believe it may call error() if that
 >     happens.

I don't know what the reason would be.  However, the value is printed via
varobj_get_value for many other MI commands e.g -var-evaluate-expression,
-var-list-children --all-values, -var-update --all-values -- and I've
not seen it call an error yet

 > Should -var-set-format fail in those cases, or should it omit the
 > value, or should it supply a default value string (e.g. <error>)?  It
 > will have changed the varobj's settings, so I don't think ^error
 > is appropriate.

Eventually I guess it might be a good idea to distinguish between a
NULL pointer and a string that has the value NULL, but I presume any
such changes would be to varobj_get_value and so are orthogonal to my
patch.


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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2006-05-05 23:30   ` Nick Roberts
@ 2006-05-15 17:07     ` Daniel Jacobowitz
  2006-05-16  3:46       ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2006-05-15 17:07 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Sat, May 06, 2006 at 11:29:57AM +1200, Nick Roberts wrote:
>  > > I would like to add the value in the (new) current format, which I find
>  > > much more useful:
>  > > 
>  > >   -var-set-format var1 hexadecimal
>  > >   ^done,format="hexadecimal",value="0x12"
>  > > 
>  > > OK to apply if I update the testsuite accordingly?
>  > 
>  > This seems reasonable; I doubt anyone will object.
>  > 
>  > I was wondering how to handle potential error conditions.  I see at
>  > least two:
>  > 
>  >   - The return of varobj_get_value can be NULL.  You should check for
>  >     that.
> 
> That often happens already.  I don't see a real problem: the null string
> gets returned and nothing gets printed for the value.

So ui_out_field_string will handle a NULL string OK.  I didn't realize
that.  I see that it seems to be true, though I couldn't see even any
comments to that effect - but both the CLI and MI output routines do
check, so you're right.

>  >   - common_val_print might fail to transform the struct value * into
>  >     a string for some reason.  I believe it may call error() if that
>  >     happens.
> 
> I don't know what the reason would be.  However, the value is printed via
> varobj_get_value for many other MI commands e.g -var-evaluate-expression,
> -var-list-children --all-values, -var-update --all-values -- and I've
> not seen it call an error yet

There were plenty of reasons - we were talking about this in another
thread at the same time :-)  For instance, it might try to read from
inaccessible memory to dereference a bad pointer.  DEREF_REF was set in
this call.

But, I've just changed that.  Now it won't error any more after the
patch I just committed.  So, I suppose your patch is now OK.

It's a little disconcerting that in some cases it will omit value and
in others print a <message>, but hey, things will work out OK.

Could you resubmit the patch including any necessary testsuite changes,
please?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2006-05-15 17:07     ` Daniel Jacobowitz
@ 2006-05-16  3:46       ` Nick Roberts
  2008-01-22 20:13         ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2006-05-16  3:46 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > Could you resubmit the patch including any necessary testsuite changes,
 > please?

I've just changed mi-var-display.exp.  Shall I do the same for
mi2-var-display.exp?  

I've tried to create a global for $octal.  I see that mi-regs.exp has its own
but it probably makes sense to centralise it.

Have you made a test for your change to val_print?  It could go in this
file or mi-var-cmd.exp.


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


2006-05-16  Nick Roberts  <nickrob@snap.net.nz>

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

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


*** mi-cmd-var.c	31 Mar 2006 12:46:48 +1200	1.23
--- mi-cmd-var.c	02 May 2006 18:16:39 +1200	
***************
*** 211,216 ****
--- 211,219 ----
  
    /* 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;
  }


*** mi-support.exp	29 Sep 2005 08:33:05 +1200	1.32
--- mi-support.exp	17 May 2006 14:03:01 +1200	
*************** global mi_inferior_tty_name
*** 33,38 ****
--- 33,39 ----
  
  set MIFLAGS "-i=mi"
  
+ set octal "\[0-7\]+"
  #
  # mi_gdb_exit -- exit the GDB, killing the target program if necessary
  #
*************** proc mi_runto {func} {
*** 870,876 ****
    }
  
    global mi_gdb_prompt expect_out
!   global hex decimal fullname_syntax
  
    set test "mi runto $func"
    mi_gdb_test "200-break-insert $func" \
--- 871,877 ----
    }
  
    global mi_gdb_prompt expect_out
!   global hex octal decimal fullname_syntax
  
    set test "mi runto $func"
    mi_gdb_test "200-break-insert $func" \
*************** proc mi_execute_to_helper { cmd reason f
*** 926,932 ****
  	return -1
      }
      global mi_gdb_prompt
!     global hex
      global decimal
      global fullname_syntax
      send_gdb "220-$cmd\n"
--- 927,933 ----
  	return -1
      }
      global mi_gdb_prompt
!     global hex octal
      global decimal
      global fullname_syntax
      send_gdb "220-$cmd\n"


*** mi-var-display.exp	30 May 2005 14:02:09 +1200	1.13
--- mi-var-display.exp	17 May 2006 14:10:52 +1200	
*************** 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=\"50 '2'\"" \
  	"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=\"$hex\"" \
  	"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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2006-05-16  3:46       ` Nick Roberts
@ 2008-01-22 20:13         ` Daniel Jacobowitz
  2008-01-23  3:25           ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2008-01-22 20:13 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Tue, May 16, 2006 at 02:34:42PM +1200, Nick Roberts wrote:
> 2006-05-16  Nick Roberts  <nickrob@snap.net.nz>
> 
> 	* mi/mi-cmd-var.c (mi_cmd_var_set_format): Add value field to output.
> 
> 	* gdb.mi/mi-var-display.exp: Add value field to tests for output of 
> 	-var-set-format.

Everyone seems to agree on this patch.  It's OK to commit (IIRC you'll
have to fix up another test too).  The changes to mi-support.exp in
the message I'm replying to do not look necessary.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-22 20:13         ` Daniel Jacobowitz
@ 2008-01-23  3:25           ` Nick Roberts
  2008-01-23  3:48             ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2008-01-23  3:25 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > Everyone seems to agree on this patch.  It's OK to commit (IIRC you'll
 > have to fix up another test too).  The changes to mi-support.exp in
 > the message I'm replying to do not look necessary.

Without the change to mi-support.exp, I get:

ERROR: can't read "octal": no such variable

Do you mean that I should set in mi-var-display.exp or just use \[0-7\]+"
directly?

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23  3:25           ` Nick Roberts
@ 2008-01-23  3:48             ` Daniel Jacobowitz
  2008-01-23  6:24               ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2008-01-23  3:48 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jan 23, 2008 at 04:25:03PM +1300, Nick Roberts wrote:
>  > Everyone seems to agree on this patch.  It's OK to commit (IIRC you'll
>  > have to fix up another test too).  The changes to mi-support.exp in
>  > the message I'm replying to do not look necessary.
> 
> Without the change to mi-support.exp, I get:
> 
> ERROR: can't read "octal": no such variable
> 
> Do you mean that I should set in mi-var-display.exp or just use \[0-7\]+"
> directly?

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.

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23  3:48             ` Daniel Jacobowitz
@ 2008-01-23  6:24               ` Nick Roberts
  2008-01-23 13:17                 ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2008-01-23  6:24 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > 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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23  6:24               ` Nick Roberts
@ 2008-01-23 13:17                 ` Daniel Jacobowitz
  2008-01-23 21:17                   ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2008-01-23 13:17 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Wed, Jan 23, 2008 at 07:23:33PM +1300, Nick Roberts wrote:
>  > 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,

-PASS: gdb.mi/mi2-var-display.exp: set format variable bar
+FAIL: gdb.mi/mi2-var-display.exp: set format variable bar

Could you fix that too, please?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23 13:17                 ` Daniel Jacobowitz
@ 2008-01-23 21:17                   ` Nick Roberts
  2008-01-23 21:24                     ` Daniel Jacobowitz
  0 siblings, 1 reply; 16+ messages in thread
From: Nick Roberts @ 2008-01-23 21:17 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > -PASS: gdb.mi/mi2-var-display.exp: set format variable bar
 > +FAIL: gdb.mi/mi2-var-display.exp: set format variable bar
 > 
 > Could you fix that too, please?

Yes, sorry.  I've committed the same changes as for mi-var-display.exp.

I thought the intentio was to commit Vladimir's patch too:

  http://sourceware.org/ml/gdb/2008-01/msg00116.html

perhaps using xstrdup instead of strdup.  I can then make appropriate changes
to Emacs in the CVS repository prior to the release of 22.2.

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23 21:17                   ` Nick Roberts
@ 2008-01-23 21:24                     ` Daniel Jacobowitz
  2008-01-23 22:30                       ` Nick Roberts
  0 siblings, 1 reply; 16+ messages in thread
From: Daniel Jacobowitz @ 2008-01-23 21:24 UTC (permalink / raw)
  To: Nick Roberts; +Cc: gdb-patches

On Thu, Jan 24, 2008 at 10:17:09AM +1300, Nick Roberts wrote:
> Yes, sorry.  I've committed the same changes as for mi-var-display.exp.

Thanks.

> I thought the intentio was to commit Vladimir's patch too:
> 
>   http://sourceware.org/ml/gdb/2008-01/msg00116.html
> 
> perhaps using xstrdup instead of strdup.  I can then make appropriate changes
> to Emacs in the CVS repository prior to the release of 22.2.

One thread at a time is all I can handle.  Have we concluded that the
above patch is better than always using natural format to check for
updates?

-- 
Daniel Jacobowitz
CodeSourcery


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-23 21:24                     ` Daniel Jacobowitz
@ 2008-01-23 22:30                       ` Nick Roberts
  0 siblings, 0 replies; 16+ messages in thread
From: Nick Roberts @ 2008-01-23 22:30 UTC (permalink / raw)
  To: Daniel Jacobowitz; +Cc: gdb-patches

 > > I thought the intentio was to commit Vladimir's patch too:
 > > 
 > >   http://sourceware.org/ml/gdb/2008-01/msg00116.html
 > > 
 > > perhaps using xstrdup instead of strdup.  I can then make appropriate
 > > changes to Emacs in the CVS repository prior to the release of 22.2.
 > 
 > One thread at a time is all I can handle.  Have we concluded that the
 > above patch is better than always using natural format to check for
 > updates?

I thought that was part of the thread.  Isn't Marc's patch for
-var-evaluate-expression meant to meet his requirement for multiple formats?

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


^ permalink raw reply	[flat|nested] 16+ messages in thread

* RE: [PATCH]: MI -var-set-format
  2008-01-25 10:38 ` Eli Zaretskii
@ 2008-01-25 15:46   ` Marc Khouzam
  0 siblings, 0 replies; 16+ messages in thread
From: Marc Khouzam @ 2008-01-25 15:46 UTC (permalink / raw)
  To: Eli Zaretskii; +Cc: gdb-patches

 
>> +To know if a variable object or any of its children has changed value in any 
>> +format instead of only the current one, the variable object and all its children
>> +should be in the natural format before issuing the @code{-var-update} command.  
>
>Sorry, I don't understand what this sentence is trying to say.  What
>does it mean ``the object should be in the natural format before
>issuing the command''?  How can an object ``be'' in some format?  

You are right about that.  I should probably refer to 'display format' instead.

>And how would its format help me know that it changed its value?

This is the tricky part.  We had a loooong thread about this but writing it in
one or two sentences was not that easy.  Maybe we should use an example?
I'll explain it in plain text and when we reach an understandable text, I'll attach
a new documentation patch.

In some cases, the displayed value of a variable object may change in some, but 
not all of the possible display formats.  For example, a variable object of 
type 'double', can change natural display from 1.1 to 1.9, while its hexadecimal 
display will remain at 0x1 in both cases.  Therefore, if the variable object has
its current display format set to 'hexadecimal', the -var-update command will not
list this object, as its current display has not changed. 

If a frontend needs -var-update to list 
variable objects for which the value has changed in any format (instead of only 
listing the ones for which the current displayed value has changed), the variable 
object and all its children should have their current display format set to natural 
before issuing the -var-update command.

[We believe that] if any formatted value changes, it guarantees that the natural
format value will also change.


Marc


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
  2008-01-24 21:49 Marc Khouzam
@ 2008-01-25 10:38 ` Eli Zaretskii
  2008-01-25 15:46   ` Marc Khouzam
  0 siblings, 1 reply; 16+ messages in thread
From: Eli Zaretskii @ 2008-01-25 10:38 UTC (permalink / raw)
  To: Marc Khouzam; +Cc: gdb-patches

> Date: Thu, 24 Jan 2008 16:35:19 -0500
> From: "Marc Khouzam" <marc.khouzam@ericsson.com>
> 
> Index: doc/gdb.texinfo
> ===================================================================
> RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
> retrieving revision 1.459
> diff -u -r1.459 gdb.texinfo
> --- doc/gdb.texinfo     23 Jan 2008 11:26:29 -0000      1.459
> +++ doc/gdb.texinfo     24 Jan 2008 21:32:51 -0000
> @@ -20058,6 +20058,9 @@
>  recommended to use the @samp{--all-values} option, to reduce the
>  number of MI commands needed on each program stop.
>  
> +To know if a variable object or any of its children has changed value in any 
> +format instead of only the current one, the variable object and all its children
> +should be in the natural format before issuing the @code{-var-update} command.  

Sorry, I don't understand what this sentence is trying to say.  What
does it mean ``the object should be in the natural format before
issuing the command''?  How can an object ``be'' in some format?  And
how would its format help me know that it changed its value?

What am I missing here?


^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [PATCH]: MI -var-set-format
@ 2008-01-24 21:49 Marc Khouzam
  2008-01-25 10:38 ` Eli Zaretskii
  0 siblings, 1 reply; 16+ messages in thread
From: Marc Khouzam @ 2008-01-24 21:49 UTC (permalink / raw)
  To: gdb-patches

>> I thought the intentio was to commit Vladimir's patch too:
>>> 
>>>   http://sourceware.org/ml/gdb/2008-01/msg00116.html
>>> 
>>> perhaps using xstrdup instead of strdup.  I can then make appropriate
>>> changes to Emacs in the CVS repository prior to the release of 22.2.
>>
>> One thread at a time is all I can handle.  Have we concluded that the
>> above patch is better than always using natural format to check for
>> updates?
>
> I thought that was part of the thread.  Isn't Marc's patch for
> -var-evaluate-expression meant to meet his requirement for multiple formats?

In my case, I agreed that this solution is sufficient (and probably the least intrusive.)
But we do need Vladimir's patch.

Here is a small patch for the doc to explain this requirement.  Feel free to reword
of course.

Marc

### Eclipse Workspace Patch 1.0
#P gdb
Index: doc/gdb.texinfo
===================================================================
RCS file: /cvs/src/src/gdb/doc/gdb.texinfo,v
retrieving revision 1.459
diff -u -r1.459 gdb.texinfo
--- doc/gdb.texinfo     23 Jan 2008 11:26:29 -0000      1.459
+++ doc/gdb.texinfo     24 Jan 2008 21:32:51 -0000
@@ -20058,6 +20058,9 @@
 recommended to use the @samp{--all-values} option, to reduce the
 number of MI commands needed on each program stop.
 
+To know if a variable object or any of its children has changed value in any 
+format instead of only the current one, the variable object and all its children
+should be in the natural format before issuing the @code{-var-update} command.  
 
 @subsubheading Example



^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2008-01-25 14:16 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2006-05-02  6:19 [PATCH]: MI -var-set-format Nick Roberts
2006-05-05 18:11 ` Daniel Jacobowitz
2006-05-05 23:30   ` Nick Roberts
2006-05-15 17:07     ` Daniel Jacobowitz
2006-05-16  3:46       ` Nick Roberts
2008-01-22 20:13         ` Daniel Jacobowitz
2008-01-23  3:25           ` Nick Roberts
2008-01-23  3:48             ` Daniel Jacobowitz
2008-01-23  6:24               ` Nick Roberts
2008-01-23 13:17                 ` Daniel Jacobowitz
2008-01-23 21:17                   ` Nick Roberts
2008-01-23 21:24                     ` Daniel Jacobowitz
2008-01-23 22:30                       ` Nick Roberts
2008-01-24 21:49 Marc Khouzam
2008-01-25 10:38 ` Eli Zaretskii
2008-01-25 15:46   ` Marc Khouzam

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox