This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: [RFC/Patch v7] Debug methods using GDB Python
- From: Doug Evans <dje at google dot com>
- To: Siva Chandra <sivachandra at google dot com>
- Cc: gdb-patches <gdb-patches at sourceware dot org>
- Date: Sat, 25 Jan 2014 12:08:25 -0800
- Subject: Re: [RFC/Patch v7] Debug methods using GDB Python
- Authentication-results: sourceware.org; auth=none
- References: <CAGyQ6gwG20bS=LmoJe7EvEJPf1Orc8+DWsg3bDYfZm9_=pMSHw at mail dot gmail dot com>
On Wed, Jan 22, 2014 at 1:36 PM, Siva Chandra <sivachandra@google.com> wrote:
> Hi,
>
> Attached is the latest version of the patch which adds the debug
> methods feature to the GDB Python API. Changes from previous versions:
>
> 1. From the user point of view, the debug method API exposes a concept
> of a DebugMethodMatcher, and a DebugMethodWorker. A
> DebugMethodMatcher matches class type and method name, and a
> DebugMethodWorker is the worker which actually invokes the debug
> method. A DebugMethodWorker also does arg type matching indirectly.
> Internally, GDB first calls the DebugMethodMatcher which returns all
> matching workers. Next, GDB picks a winner among these workers based
> on the arg types the workers return/serve. Finally, the winning worker
> is invoked. A matcher can manage a number of named workers which a
> user can enable/disable using the appropriate command.
>
> 2. Formatting cleanup. There could be other tabs vs space formatting
> issues still left, especially on the GDB side of the *.c changes. I am
> working on cleaning up the code changes in this part. I will fix the
> formatting issues along with it.
>
> 3. No docs yet as the actual Python API is not yet finalized.
>
> 2014-01-22 Siva Chandra Reddy <sivachandra@google.com>
>
> * Makefile.in: Add entries for new files.
> * data-directory/Makefile.in: Add entries for new Python files.
> * eval.c (evaluate_subexp_standard): Lookup and invoke methods
> defined in extension languages.
> * valarith.c (value_x_binop, value_x_unop): Lookup and invoke
> overloaded operator methods defined in extension languages.
> * valops.c (find_oload_method_list, find_method_list,
> find_overload_match, find_oload_champ): Lookup methods defined
> in extension languages.
> (value_has_indirect_dynamic_type): New function to determine
> the indirect dynamic type of a value.
> * value.h (find_overload_match): Update signature.
> * ext-function.c: New file.
> * ext-function.h: New file.
> * python/py-debugmethods.c: New file.
> * python/py-objfile.c (objfile_object): New field
> 'debugmethod_matchers'.
> (objfpy_dealloc): XDECREF on the new debugmethod_matcherss field.
> (objfpy_new, objfile_to_objfile_object): Initialize
> debugmethod_macthers field.
> (objfpy_get_debugmethod_matchers): New function.
> (objfile_getset): New entry 'debugmethod_matchers'.
> * python/py-progspace.c (pspace_object): New field
> 'debugmethod_matchers'.
> (pspy_dealloc): XDECREF on the new debugmethod_matchers field.
> (pspy_new, pspace_to_pspace_object): Initialize
> debugmethod_matchers field.
> (pspy_get_debugmethod_matchers): New function.
> (pspace_getset): New entry 'debug_methods'.
> * python/python-internal.h: Add declarations for new functions.
> * python/python.c (_initialize_python): Invoke
> gdbpy_initialize_debugmethods.
> * python/python.h: Add declarations of new functions.
> * python/lib/gdb/__init__.py (debug_methods): New attribute.
> * python/lib/gdb/debugmethods.py: New file.
> * python/lib/gdb/command/debugmethods.py: New file.
>
> testuite/
> * gdb.python/py-debugmethods.cc: New testcase to test debug
> methods.
> * gdb.python/py-debugmethods.exp: New tests to test debug
> methods.
> * gdb.python/py-debugmethods.py: Python script supporting the
> new testcase and tests.
Hi. Thanks for persevering.
I have some comments (nits, buglets, etc.) on the implementation, but
I'm happy with the overall approach. I'll wait until you're ready
before sending a full review (since this is still a work in progress).
Thanks!