This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [Patch v18 4/4] Add xmethod support to the Python API
- From: Siva Chandra <sivachandra at google dot com>
- To: Doug Evans <xdje42 at gmail dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Wed, 28 May 2014 13:44:26 -0700
- Subject: Re: [Patch v18 4/4] Add xmethod support to the Python API
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gz5zh64AcfeHcqiXtYKpJf7GWpD+5FmKe38fg1bOMJc_w at mail dot gmail dot com> <m3ha4dh1vq dot fsf at sspiff dot org> <m3mwe2fqcp dot fsf at sspiff dot org>
On Tue, May 27, 2014 at 10:02 PM, Doug Evans <xdje42@gmail.com> wrote:
> Ok, let's do this.
>
> extension.c:invoke_xmethod will throw an error if this function
> returns EXT_LANG_RC_ERROR:
>
> if (rc == EXT_LANG_RC_ERROR)
> {
> error (_("Error while invoking a xmethod defined in %s"),
> worker->extlang->capitalized_name);
> }
I did not understand this part. Since you suggest below that
gdbpy_invoke_xmethod return value * and throw GDB errors for Python
errors as well, where would invoke_xmethod get RC from?
>
> So there's no real difference between a gdb-detected error in, say,
> value_cast and a python-detected error from invoking the xmethod.
> So why not have gdbpy_invoke_xmethod return a struct value *,
> and if a python error is detected then throw a gdb error.
>
> IOW:
>
> struct value *
> gdbpy_invoke_xmethod (const struct extension_language_defn *extlang,
> struct xmethod_worker *worker,
> struct value *obj, struct value **args, int nargs)
> {
> ...
> if (error_return_from_python)
> {
> gdbpy_print_stack ();
> error (_("Error while executing Python code."));
> }
> ...
> }