This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [Patch v18 4/4] Add xmethod support to the Python API


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."));
>     }
>   ...
> }


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]