Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Nick Roberts <nickrob@snap.net.nz>
To: Vladimir Prus <ghost@cs.msu.su>
Cc: gdb-patches@sources.redhat.com
Subject: Re: -var-update @
Date: Thu, 27 Mar 2008 09:54:00 -0000	[thread overview]
Message-ID: <20080327095334.67CCE8FC6D@kahikatea.snap.net.nz> (raw)
In-Reply-To: <fsfgla$h72$1@ger.gmane.org>

 > > So I think it's wrong to equate the two uses of "*" which looks like what
 > > you've done with "@".
 > 
 > So, you think the change might create confusion for *users* for MI interface.
 > Clearly, as far as behaviour goes, no equation of two uses of "*" was done.
 > I think it might be unfortunate that '*' means different things in different
 > context, but that's what we have now, and probably the first fix to to 
 > remove '-var-create *' from the manual and educate frontend authors to use
 > the frame explicitly, as that will make the protocol even less stateful.

I'm not sure that I would advocate it's removal just yet, but yes it does
seem to be best for the frontend to keep track of the state of the debugger
rather than Gdb 

 >...
 >  Sorry, I don't quite get, from your description, when the output of
 > -var-update misses the value, and when the value is wrong -- it sounds like
 > both cases happen when you do -var-update in a different frame. Can you
 > clarify, or maybe create a testcase for this?

void
mysub ()
{
  int myvar = 5;
  int myvar1 = 5;
  return;
}

main ()
{
  float myvar = 7.8;
  int myvar1 = 7;
  mysub ();
}

Stop Gdb on the return statement in mysub, then:

(gdb) 
-var-create - @ myvar
^done,name="var1",numchild="0",value="5",type="int",thread-id="1"
(gdb) 
-var-create - @ myvar1
^done,name="var2",numchild="0",value="5",type="int",thread-id="1"
(gdb) 
up
&"up\n"
~"#1  0x0804837f in main () at temp5.c:13\n"
~"13\t  mysub ();\n"
^done
(gdb) 
-var-update --all-values var1
^done,changelist=[{name="var1",in_scope="true",new_type="float",new_num_children="0"}]
(gdb) 
-var-update --all-values var2
^done,changelist=[{name="var2",value="-1080652880",in_scope="true",type_changed="false"}]
(gdb) 



 > > I think we should fix (and document) such floating variable objects 
 > 
 > We should; I was not aware of the bug with wrong value you report above.
 > 
 > > but I really don't think we want a second command to update them.
 >
 > Let me try again. You are using '-var-update *' above. This command will
 > update all variable objects, including those that a bound to a frame.
 > There's no need to update variable objects that are bound to a frame -- a
 > change to selected thread or frame will not change them at all. Updating
 > variable object can take considerable time, and therefore it's better to be
 > able to update only floating variable object.  
 >
 > Is any bit of the logic above faulty?  - Volodya

There's a logic there if the frontend knows when the variable objects that are
bound to a frame will not change.  If there's a console, the user can change
the value with "p myvar=9", say, and the frontend wouldn't know directly that
such a variable object had changed value.

However, on reflection there is no harm in having this functionality as I see
now that "*" updates both kinds of objects so a frontend needn't use it.

I would just suggest a more consistent syntax as currently:

-var-update @     Updates all floating variable objects.
-var-update *     Updates all variable objects.
-var-update var1  Updates the variable object var1 (floating or otherwise).

-var-create - @   Creates a floating variable object.
-var-create - *   Creates a fixed frame variable object.

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


  reply	other threads:[~2008-03-27  9:54 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-03-26 14:54 Vladimir Prus
2008-03-27  5:17 ` Nick Roberts
2008-03-27  7:00   ` Vladimir Prus
2008-03-27  9:54     ` Nick Roberts [this message]
2008-03-27 10:38       ` Vladimir Prus
2008-03-27 13:25         ` Marc Khouzam
2008-03-27 13:37           ` Vladimir Prus
2008-03-27 20:58           ` Nick Roberts
2008-03-28 14:32             ` Marc Khouzam
2008-03-28 16:22               ` Vladimir Prus
2008-03-28 16:33                 ` Marc Khouzam
2008-04-01 13:37             ` André Pönitz
2008-04-01 13:56               ` Marc Khouzam
2008-04-01 14:30                 ` André Pönitz
2008-04-03 19:10                   ` Daniel Jacobowitz
2008-04-03 19:31             ` Daniel Jacobowitz
2008-04-03 20:05               ` Michael Snyder
2008-03-29  5:16         ` Nick Roberts
2008-03-29  6:38           ` Vladimir Prus
2008-03-30  3:54             ` Nick Roberts
2008-04-03 18:55               ` Vladimir Prus
2008-04-03 21:30                 ` Nick Roberts
2008-04-04 11:45                   ` Vladimir Prus
2008-04-11 22:01                     ` Vladimir Prus
2008-04-11 23:22                       ` Nick Roberts

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20080327095334.67CCE8FC6D@kahikatea.snap.net.nz \
    --to=nickrob@snap.net.nz \
    --cc=gdb-patches@sources.redhat.com \
    --cc=ghost@cs.msu.su \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox