This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [PATCH v14 3/4] Add support for lookup, overload resolution and invocation of C++ debug methods
- From: Siva Chandra <sivachandra at google dot com>
- To: Doug Evans <dje at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 23 Apr 2014 14:40:58 -0700
- Subject: Re: [PATCH v14 3/4] Add support for lookup, overload resolution and invocation of C++ debug methods
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyk9exQ9zCW5KcBs+qsyyP_Jj1ZnCsNQY6xny1oWANJMQ at mail dot gmail dot com> <21333 dot 45108 dot 381336 dot 447391 at ruffy dot mtv dot corp dot google dot com> <CAGyQ6gz0iFWoi1nS5-ZxQs6k18b6aYUpmUnVBDT-jZxyk9ibBA at mail dot gmail dot com> <CADPb22SPFTraB3nVH1XQZXXB7LKowmLzLLyU_TQ6eGkPZjKzsA at mail dot gmail dot com>
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