[PATCH v14 3/4] Add support for lookup, overload resolution and invocation of C++ debug methods

Siva Chandra sivachandra@google.com
Wed Apr 23 21:41:00 GMT 2014


On Wed, Apr 23, 2014 at 1:06 PM, Doug Evans <dje@google.com> wrote:
> A good question we need to answer is: What happens if a user does
> "ptype" on an expression involving a debug method?
> [ptype uses evaluate_type which is an example of using EVAL_AVOID_SIDE_EFFECTS]
> A user should be able to do that and have confidence that inferior
> state will not be modified.
> Reading the vtable is ok, but if the debug method is implementing,
> say, some kind of iterator then modifying inferior state would not be
> ok.
>
> I tried "ptype a1 + a2" from your py-debugmethods.exp testcase, and
> the debug method does get invoked.
> Is that ok?  In many cases probably, but it doesn't seem likely to be
> ok in the general case.

The example answers it! As a user I never used ptype on expressions,
and have never seen one do it. The only doc about
EVAL_AVOID_SIDE_EFFECTS I have is the comment in expression.h. I think
we should add there that one use of this option is when ptype-ing on
expressions. I can send a comment patch if you feel its meaningful.

So then, I will take your suggestion about encapsulating debug methods
in a value and send a new version. The rest of your comments will be
automatically taken care of I think. The name, I will go with
"xmethods" and TYPE_CODE_XMETHOD if that is OK.

Thanks,
Siva Chandra



More information about the Gdb-patches mailing list