🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: gnu.gdb.bug
Article #1208

Re: GDB/MI - garbage in first call to -var-evaluate-expression

#1208
From: Nick Roberts
Date: Sun, 12 Feb 2006 11:53
76 lines
3519 bytes
> I'm hope this is right group.

In practice, no.  Most people follow gdb@sources.redhat.com.

> I'm working with GDB/MI. I'm stepping on C++ code (actually it is SystemC
> code). I want to read local variable 'VALIDATED' of current frame:

> -var-create - * VALIDATED
> ^done,name="var2",numchild="0",type="int"
> -var-info-type var2
> ^done,type="int"
> -var-update var2
> ^done,changelist=[{name="var2",in_scope="false"}]
                               ^^^^^^^^^^^^^^^
This says that VALIDATED is no longer in scope.  Are you sure that your
program is not executing?

> -var-evaluate-expression var2
> ^done,value="77828156"
> -var-delete var2
> ^done,ndeleted="1"


> As you can see there is garbage instead of real variable value.


> However if I do exactly the same instructions again (no change in debugger
> between) I get proper value:

> -var-create - * VALIDATED
> ^done,name="var3",numchild="0",type="int"
> -var-info-type var3
> ^done,type="int"
> -var-update var3
> ^done,changelist=[]
                 ^^

It looks like VALIDATED is back in scope but that its value was set to 1
before you created the variable object.

> -var-evaluate-expression var3
> ^done,value="1"
> -var-delete var3
> ^done,ndeleted="1"

-var-update should report any changes since last update/creation, and update
 object if appropriate:

-var-create - * VALIDATED
^done,name="var1",numchild="0",type="int"
-var-update var1
^done,changelist=[]
-var-evaluate-expression var1
^done,value="77828156"

program executes...

  VALIDATE = 5;

program stops

-var-evaluate-expression var1
^done,value="77828156"
-var-update var1
^done,changelist=[{name="var1",in_scope="true",type_changed="false"}]
-var-evaluate-expression var1
^done,value="5"

> GDB 6.3/windows.

GDB 6.4 is available now.

If there is a bug, for someone to be able to fix it, you need to show how it
can be reproduced with a simple test program.

Nick                                           http://www.inet.net.nz/~nickrob
Technical Details
Message-ID: <mailman.160.1139770561.2858.bug-gdb@gnu.org>
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Thread: f5053,a195bd4432bbbad6
X-Google-Attributes: gidf5053,public
X-Google-Language: ENGLISH,ASCII-7-bit
Path: arc1-ca.pugleaf.net!g2news1.google.com!news3.google.com!newsfeed.stanford.edu!shelby.stanford.edu!not-for-mail
From: Nick Roberts <nickrob@snap.net.nz>
Newsgroups: gnu.gdb.bug
Subject: Re: GDB/MI - garbage in first call to -var-evaluate-expression
Date: Mon, 13 Feb 2006 00:53:01 +1300
Lines: 78
Approved: bug-gdb@gnu.org
Message-ID: <mailman.160.1139770561.2858.bug-gdb@gnu.org>
NNTP-Posting-Host: lists.gnu.org
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
X-Trace: news.Stanford.EDU 1139770562 3137 199.232.76.165 (12 Feb 2006 18:56:02 GMT)
X-Complaints-To: news@news.stanford.edu
Cc: bug-gdb@gnu.org
To: sebastianb@aldec.com.pl
Envelope-to: bug-gdb@gnu.org
X-Mailer: VM 7.19 under Emacs 22.0.50.59
X-Mailman-Approved-At: Sun, 12 Feb 2006 13:56:00 -0500
X-BeenThere: bug-gdb@gnu.org
X-Mailman-Version: 2.1.5
Precedence: list
List-Id: "Bug reports for GDB, the GNU debugger" <bug-gdb.gnu.org>
List-Unsubscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=unsubscribe>
List-Archive: <http://lists.gnu.org/pipermail/bug-gdb>
List-Post: <mailto:bug-gdb@gnu.org>
List-Help: <mailto:bug-gdb-request@gnu.org?subject=help>
List-Subscribe: <http://lists.gnu.org/mailman/listinfo/bug-gdb>,
 <mailto:bug-gdb-request@gnu.org?subject=subscribe>