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: [RFC] Remove unused extension_language_defn argument to "virtual" functions


On Thu, Feb 6, 2014 at 11:05 AM, Siva Chandra <sivachandra@google.com> wrote:
> Hi,
>
> Doug's patch which added the extension language API is awesome.  I am
> tempted to say that it can serve as a great entry point for someone
> trying to understand GDB internals.
>
> While trying to add my debug methods patch to the API, I have noticed
> that all "virtual" functions in the API are having an unused argument
> which is a pointer to their extension_language_defn.  This seems a bit
> odd to me conceptually as a virtual function serving a language should
> know about its language! I could be missing something here and
> completely wrong about my understanding.  But, I have gone ahead and
> prepared a patch which removes the extension_language_defn arguments
> which are unused anyway. I could successfully build and test all the
> Python tests with the patch applied.
>
> 2014-02-06  Siva Chandra Reddy  <sivachandra@google.com>
>
>         * auto-load.h (auto_load_gdb_scripts_enabled): Remove unused arg
>         EXTLANG.
>         * auto-load.c (auto_load_gdb_scripts_enabled): Remove unused arg
>         EXTLANG.
>         (auto_load_objfile_script_1) Do not pass unused arg LANGUAGE to
>         sourcer.
>         * cli/cli-cmds.c (source_script_from_stream): Do not pass unused
>         arg EXTLANG to sourcer.
>         * extension-priv.h: Remove extension language argument of all
>         "virtual" functions.
>         * extension.h: Likewise.
>         * extension.c: Remove extension language argument from all
>         virtual function definitions and invocations.
>         * python/py-auto-load.c: Likewise.
>         * python/py-breakpoint.c: Likewise.
>         * python/py-framefilter.c: Likewise.
>         * python/py-prettyprint.c: Likewise.
>         * python/py-value.c: Likewise.
>         * python/python.c: Likewise.
>         * python/python-internal.h: Remove extension language argument
>         from all virtual function declarations.

Hi.
To close the loop in this thread,

We have a convention that "ops" functions (functions that are called
via a pseudo-vtable) take a pseudo-this parameter.
It's not always used, but I think it's a good convention as it allows
things like symfile-debug.c to be written (debug wrappers around the
calls).

I added some comments, and started an internals wiki entry for the topic.

https://sourceware.org/gdb/wiki/Internals%20Pseudo-Vtables


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