This is the mail archive of the
gdb@sourceware.org
mailing list for the GDB project.
Re: MI Development
- From: Vladimir Prus <ghost at cs dot msu dot su>
- To: Andrà PÃnitz <apoenitz at trolltech dot com>
- Cc: gdb at sources dot redhat dot com
- Date: Tue, 4 Sep 2007 19:06:22 +0400
- Subject: Re: MI Development
- References: <200709041740.22271.ghost@cs.msu.su> <200709041628.15560.apoenitz@trolltech.com>
On Tuesday 04 September 2007 18:28:15 Andrà PÃnitz wrote:
> > Variable objects and RTTI
> > For C++, variable objects are not able to look at the real type of the object.
> > only the static type is shown. We should be able to implement display of
> > al type, using Apple's branch as reference.
>
> Personally I think variable objects are not very well suited for C++ at all.
> Say, I want to display a "std::vector<int> x"in a frontend I usually do not
> want to show three pointers to some internal data. Instead I usually want
> to have x[0]...x[x.size()-1] as children. This is doable with variable objects,
> but the result feels clumsy, and the "update" feature cannot really be
> used.
I think we can fix that. I'd imagine we can make gdb invoke a Python hook
on -var-list-children. That hook will compute values that correspond to vector
member and create variable objects out of those. There's some work on Python
scripting already; I'd hope this use case will be kept in mind.
There's extra problem is that MI is not prepared that the number of children
of a variable objects can change -- and it can change in case of a vector. We'd
need to fix that.
> > Variable objects don't care much about C++ scopes. For example, it's not possible to
> > create a variable object for a given expression in particular scope, which makes it impossible
> > to accurately implement variable tooltips. Also, it's not possible to list all local variables in the
> > entire function, which requires extraordinary effort to display all local variables as the enter
> > scope and leave scope.
>
> Yup. And there seems to be no way to reliably tell whether a (C++) variable has already been
> constructed.
This is indeed big problem, and I don't know if anybody's working on getting gcc to produce
accurate debug information for that.
- Volodya