This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Type information in -data-evaluate-expression


Andrà PÃnitz wrote:

> 
> Hi all.
> 
> While playing around with gdb's "mi" interface (which looks rather
> nice for scripting btw...) I came across a few places where I think
> the interface might be made even more convienient without much
> effort.
> 
> One example: As far as I can see currently the only way to obtain
> the type of an expression is to use -var-create & -var-delete.
> It would be more convienient for me if I could get that information
> with a single command without creating a variable which will be
> thrown away immediatedly afterwards.

What is the use case where you need to just get the type of an expression,
without doing anything with it?

> A possibility to do so would be to "enhance" "-data-evaluate-expression"
> to return not only the value, but also the type information which is
> is available after the evaluation process anyway.
> 
> I came up with a tiny patch that "seem to work for me". But as this
> is the first time I look gdb source I am unsure whether this is done
> properly or if some kind of cleanup is needed, and, of course, whether
> there is a chance to get such patches included in gdb proper
> at some point of time.

I'd expect this patch will break a bunch of tests, since those tests
are not expecting the additional 'type' field. The patch itself
seems reasonable as far as code is concerned, but I'm not yet sure about
your use case. I'd prefer -data-evaluate-expression to fall to misuse,
rather than adding some new functionality to it.

- Volodya



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]