This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC] Debug Methods in GDB Python
- From: Siva Chandra <sivachandra at google dot com>
- To: Tom Tromey <tromey at redhat dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Fri, 15 Nov 2013 14:27:15 -0800
- Subject: Re: [RFC] Debug Methods in GDB Python
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gyKTCdcjMcbfnc4zV3+yEt9tCTJzS8eW92dQrQzikRaTQ at mail dot gmail dot com> <CAGyQ6gxzG8vuPyFKHpacHS7W7jMEReidWDBkNJjywOXADXgVnw at mail dot gmail dot com> <87r4hefx59 dot fsf at fleche dot redhat dot com> <CAGyQ6gw_-MOu4Y9D+mUf-A55_Ms+j9JAmM9dU0y8PdJw73EkNw at mail dot gmail dot com> <871u995pbt dot fsf at fleche dot redhat dot com> <CAGyQ6gywGMDwmm9fHpPGhwE9vrki1VE8uDM2hRFEAvCZKaTyJg at mail dot gmail dot com> <87ehaq5nkr dot fsf at fleche dot redhat dot com> <CAGyQ6gwT5+Jmu4bqgakjCWmmZtWjbd83n0qq=B9ctfWjv7oS_w at mail dot gmail dot com> <87txfds4vf dot fsf at fleche dot redhat dot com>
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.