intelligent variable window (was Re: Debugging with KDevelop)

Vladimir Prus ghost at cs.msu.su
Wed Oct 26 08:21:04 UTC 2005


Hi Francesco,

> Vladimir Prus wrote:
> > On Monday 24 October 2005 00:33, Sascha Cunz wrote:
> >>>1) You cannot define any "expansion rule"
> >>
> >>Here you really have a point!
> >>
> >>Maybe Vladimir can have a look, if it's posible to solve this. However,
> >>autoexp.dat always seemed a little mystic to me, if we can implement the
> >>backend, we should also implement a nice frontend to it.
> >
> > My thoughts are in http://bugs.kde.org/show_bug.cgi?id=94313
> > Essentially, it's not possible to reliable implement automatic
> > pretty-printing of anything, because gdb helpfully includes variables
> > that were not initialized in "info locals" output. Example:
> >
> >      string s = "fooo";
> >      // lots of code
> >      QUrl url = ....;
> >
> > when inside <lots of code>, gdb will still report 'url' as live, and
> > trying to call QUrl::prettyURL on an uninitialized object will lead to
> > segfault. It's possible to ignore that, but then the program might
> > randomly crash.
>
> I think that some modifications could be asked to GDB dev team to flag the
> variables which are not truly "living" yet as "dirty" (if this is not
> already available in GDB internals; look at my other post "integrating
> GDB").

   http://sources.redhat.com/ml/gdb/2005-09/msg00010.html

Summary: supposed to work in gcc 4, nobody knows how to make it work. If you 
cna investigate and come up with a solution, that would be great.

> Then a good & reliable pretty-printing system could be implemented, but not
> only.
>
> A major thing I forgot to list in my wish-list is that MSVC6 has an
> "intelligent" variable window: when you are looking at a piece of code
> like:
>
> 1   int A=3, C=4, D=6, E=8;
> 2   work_on(A,C);
> 3   work_on(C,D);
> 4   work_on(D,E);
> 5   myClass *Z;
> 6   Z=new myClass();
>
> and you step on the 4th line, MSVC shows you in the variable window only
> the variables which are used by the 3rd line and the ones used by 4th line.
> This is *very* useful since when you have many variables in a piece of
> code, you cannot scroll all times a 200-variables list and find the one
> you're working on. Also adding the variables in the Watch expression
> requires time and is a useless loss of time when you just need to see their
> value once.

   http://sources.redhat.com/ml/gdb/2005-09/msg00002.html

Just like with "is this variable live", we can hack something around, but it 
will be hack-around.

> >>>2) You cannot see the return values of the functions. This is a bit
> >>>problematic specially when the returned value is used directly in other
> >>>expressions, without storing it in a variable...
> >>
> >>I've no clue if that is posible with GDB at all, but maybe Vladimir can
> >>enlighten us here.
> >
> > Yes, it's possible. As I say in another email, user interface is the only
> > question.
>
> maybe that a dummy variable item (like "foo()_returnvalue") could be
> created into the variables window so that the user doesn't need to switch
> to another window tab...

Maybe.

- Volodya




More information about the KDevelop-devel mailing list