This is the mail archive of the
mailing list for the GDB project.
-var-update and address changes
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: gdb at sources dot redhat dot com
- Date: Wed, 12 Apr 2006 16:04:36 +0400
- Subject: -var-update and address changes
I'm running into what looks like a bug in -var-update. Basically, I create a
varobj with "&variable", then I enter a function that has a variable with
the same name, and -var-update does not report anything.
Here's the code, and the gdb session.
int i = 10;
int i = 10;
i = foo();
And here's the session
-var-create TEST * &i
The value of "&i" changes, but -var-update does not report this. This can be
explained by the fact that varobjs are "bound" to the stack frame where
they were created, but that "binding" is not mentioned in documentation.
The problem I'm trying to solve is this:
1. In some frame, I create varobj for 'i'.
2. After continue, I see that there's local variable 'i', and I want to find
out if previously-created varobj can be used to show this local 'i', or if
I should create new 'i'.
- I can't use frame ids because gdb only prints code address, and two
different stack frames can have the same code address.
- I can't use -var-update, because it does not seem to report anything
- I can't use -var-update on variable addresses, because of the above
So, the only solution is to remove all varobjs, and create them afresh,
which is contrary to the very purpose of varobjs.
Can somebody suggest the right fix? So far, I think that the simplest
approach is to make gdb print stack address of current frame, like is done
on the Apple branch:
That way, frontend can deal with the issue of frame stacks themself, and
-var-update will be only used when single-stepping inside a given frame.
Will patches to implement this be welcome?
And I still don't know what to do about variable shadowing inside a single