Mirror of the gdb mailing list
 help / color / mirror / Atom feed
From: Vladimir Prus <ghost@cs.msu.su>
To: Daniel Jacobowitz <drow@false.org>
Cc: Jim Ingham <jingham@apple.com>,
	 Nick Roberts <nickrob@snap.net.nz>,
	 gdb@sources.redhat.com
Subject: Re: -var-update and address changes
Date: Thu, 04 May 2006 15:12:00 -0000	[thread overview]
Message-ID: <200605041911.48045.ghost@cs.msu.su> (raw)
In-Reply-To: <20060504145046.GA32605@nevyn.them.org>

On Thursday 04 May 2006 18:50, Daniel Jacobowitz wrote:
> On Wed, May 03, 2006 at 10:02:21AM +0400, Vladimir Prus wrote:
> > On Tuesday 02 May 2006 21:22, Jim Ingham wrote:
> > > Shouldn't the call to var->root->lang->value_of_root down at the
> > > bottom of value_of_root take care of fetching the new value?
> >
> > Well, it fetches the new value, I believe.
>
> For the wrong frame.
>
> I've only lightly tested this; could you give it a try?  If it works, I
> think we should really get the "@" syntax added to the manual and
> testsuite.

This appears to work for a simple case of variable 'i' defined both in 'main' 
and in 'foo' called from main.

For the case where I'm stepping into 'bar' that has no 'i', -var-update 
correctly says that 'i' has gone out of scope. However, after -exec-finish, 
-var-update does not say that 'i' is not back in scope -- which would be nice 
if "@-varobjs" are to be used for watches.

Here's example I've used for testing:

include <stdio.h>

int foo()
{
    int i = 15;
    printf("foo\n");
}

int bar()
{
}

int main()
{
    int i = 5;
    printf("hi 1\n");
    foo();
    bar();
}

and example session:

b 19
&"b 19\n"
~"Breakpoint 1 at 0x804849e: file s.cpp, line 19.\n"
^done
(gdb)
r
&"r\n"
~"Starting program: /space/p2/ghost/build/mi-tests/a.out \n"
hi 1
foo
~"\n"
~"Breakpoint 1, main () at s.cpp:19\n"
~"19\t    bar();\n"
^done
(gdb)
-var-create I @ i
^done,name="I",numchild="0",type="int"
(gdb)
-exec-step
^running
(gdb)
*stopped,reason="end-stepping-range",thread-id="0",frame={addr="0x08048473",func="bar",args=[],file="s.cpp",fullname="/space/p2/ghost/build/mi-tests/s.cpp",line="12"}
(gdb)
-var-update *
^done,changelist=[{name="I",in_scope="false"}]
(gdb)
-exec-finish
^running
(gdb)
*stopped,reason="function-finished",thread-id="0",frame={addr="0x080484a3",func="main",args=[],file="s.cpp",fullname="/space/p2/ghost/build/mi-tests/s.cpp",line="20"},gdb-result-var="$1",return-value="4"
(gdb)
-var-update *
^done,changelist=[]
(gdb)
p i
&"p i\n"
~"$2 = 5"
~"\n"
^done
(gdb)

- Volodya


  parent reply	other threads:[~2006-05-04 15:12 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-04-12 16:02 Vladimir Prus
2006-04-12 18:25 ` Jim Ingham
2006-04-13  9:25   ` Vladimir Prus
2006-04-13 17:31     ` Jim Ingham
2006-04-14 13:25   ` Daniel Jacobowitz
2006-04-14 20:03     ` Jim Ingham
2006-04-14 20:09       ` Daniel Jacobowitz
2006-04-14 20:27         ` Jim Ingham
2006-04-14 21:37           ` Daniel Jacobowitz
2006-04-17  6:18             ` Vladimir Prus
2006-04-17  9:02               ` Mark Kettenis
2006-04-17 10:54                 ` Vladimir Prus
2006-05-02 12:50       ` Vladimir Prus
2006-05-02 13:14         ` Nick Roberts
2006-05-02 13:41           ` Vladimir Prus
2006-05-02 17:23             ` Jim Ingham
2006-05-03  6:03               ` Vladimir Prus
     [not found]                 ` <20060504145046.GA32605@nevyn.them.org>
2006-05-04 15:12                   ` Vladimir Prus [this message]
2006-05-04 15:13                     ` Daniel Jacobowitz
2006-05-05  6:25                   ` Vladimir Prus
2006-05-05 15:02                     ` Daniel Jacobowitz
2006-04-16 15:52     ` 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=200605041911.48045.ghost@cs.msu.su \
    --to=ghost@cs.msu.su \
    --cc=drow@false.org \
    --cc=gdb@sources.redhat.com \
    --cc=jingham@apple.com \
    --cc=nickrob@snap.net.nz \
    /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