From: Doug Evans <dje@google.com>
To: Siva Chandra <sivachandra@google.com>
Cc: Tom Tromey <tromey@redhat.com>, gdb-patches <gdb-patches@sourceware.org>
Subject: Re: [RFC] Debug Methods in GDB Python
Date: Sat, 16 Nov 2013 00:54:00 -0000 [thread overview]
Message-ID: <CADPb22TgkC-KBhAoYvNBueOKrHAFWwvd9TgYaQ2=Oq5qsFoZrA@mail.gmail.com> (raw)
In-Reply-To: <CAGyQ6gzaht0KYTxdFFZDeAo5hxesOmjCAiVomX8d_eV4XGK_CQ@mail.gmail.com>
On Fri, Nov 15, 2013 at 2:27 PM, Siva Chandra <sivachandra@google.com> wrote:
> Thanks a lot for reviewing.
>
> On Fri, Nov 15, 2013 at 1:59 PM, Tom Tromey <tromey@redhat.com> wrote:
>
>> I can do that if you want; but meanwhile I think if you wrote the
>> tests...
>
> Yes. Now that you are OK with the general approach, I am going to
> write the tests and elaborate the docs. Will send out patches for
> these early next week.
>
>> Also I was curious if this supports operator overloading. Like can I
>> define an "operator+"?
>
> Yes. Operator overloading is handled the same way as methods. The
> operator functions have to be methods though.
>
>> Siva> + if (ext_fnp)
>> Siva> + {
>> Siva> + if (ext_fn_is_method (ext_fnp))
>> Siva> + {
>> Siva> + struct value *ret_val;
>> Siva> +
>> Siva> + ret_val = ext_fn_invoke_method (ext_fnp, arg2, argvec + 2,
>> Siva> + nargs - 1);
>> Siva> + if (ret_val == NULL)
>> Siva> + error (_("Error invoking debug method for method %s."),
>> Siva> + tstr);
>> Siva> +
>> Siva> + return ret_val;
>> Siva> + }
>> Siva> + }
>>
>> What happens here if "ext_fnp && !ext_fn_is_method"?
>
>> Siva> +struct py_ext_object
>> Siva> +{
>> Siva> + /* Holds an instance of the DebugMethod class. */
>> Siva> + PyObject *object;
>> Siva> +
>> Siva> + /* Holds the type of the 'this' object. */
>> Siva> + PyObject *match_py_obj_type;
>> Siva> +
>> Siva> + /* Holds the matching method name. */
>> Siva> + const char *match_method;
>>
>> How "match_method" is allocated and how its lifetime is managed is
>> really unclear to me.
>
> I will address the above two question in the next round of review.
Hi.
It's great that you're getting back at this.
I have a few thoughts, nothing burdensome I hope, in random order
It would be good to provide enable/disable/info support akin the the
python pretty-printers.
The original pretty-printers used regexps for matching but that was
IIUC found to be excessively general.
We might want to avoid them in the basic versions of debug methods.
I could be wrong but it seemed like errors were handled differently
than in the pretty-printers.
The inconsistency doesn't feel warranted.
IIRC the "ext_lang" stuff was going to be deleted, right?
I wonder if other users are going to constantly trip on the name
"debug methods" like I do.
I don't have a better name at the moment, but maybe something to think about.
What are debug method groups for?
One thought I had, and this is mostly for discussion's sake,
is why stop at providing support for user-defined methods (incl. operators)?
Why not allow anything that might be "hand called" to be implemented in Python?
[One way of implementing user-defined methods/operators was to
translate, e.g. my_stl_vector[3], into a "pseudo- hand call",
and then call into Python at the point where we would have hand-called
the inferior instead.]
TIA
[and thanks again for getting back to this!]
next prev parent reply other threads:[~2013-11-16 0:05 UTC|newest]
Thread overview: 18+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-07 21:22 Siva Chandra
2013-01-29 1:51 ` Siva Chandra
2013-02-25 23:02 ` Siva Chandra
2013-05-10 19:33 ` Tom Tromey
2013-05-10 19:55 ` Siva Chandra
2013-05-14 19:33 ` Tom Tromey
2013-06-17 19:10 ` Siva Chandra
2013-07-22 20:47 ` Tom Tromey
2013-11-12 2:56 ` Siva Chandra
2013-11-15 22:28 ` Tom Tromey
2013-11-16 0:05 ` Siva Chandra
2013-11-16 0:54 ` Doug Evans [this message]
2013-11-16 1:03 ` Siva Chandra
2013-11-16 2:48 ` Siva Chandra
2013-11-20 0:03 ` Doug Evans
2013-11-19 23:52 ` Doug Evans
2013-11-20 0:39 ` Siva Chandra
2013-11-20 2:48 ` Doug Evans
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to='CADPb22TgkC-KBhAoYvNBueOKrHAFWwvd9TgYaQ2=Oq5qsFoZrA@mail.gmail.com' \
--to=dje@google.com \
--cc=gdb-patches@sourceware.org \
--cc=sivachandra@google.com \
--cc=tromey@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox