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]

[Patch v10] Debug methods in GDB Python


Hi,

Attached is the v10 of the patch which adds debug methods feature to
the Python API.

For reference, the v9 posting is here:
https://sourceware.org/ml/gdb-patches/2014-02/msg00324.html

Changes from v9:

1. Addressed all of Doug's comments on v9 except two for which I have
comments below.
2. More tests.
3. More documentation in the code.
4. NEWS entry

On Sun, Feb 23, 2014 at 1:10 PM, Doug Evans <dje@google.com> wrote:
> [Writing this down for reference sake. I'm not arguing for changes, per se.]
> struct debug_method_worker contains an extension_language_defn *, so
> there's no need to pass extlang as an arg here.
> IOW this function is more like a method of debug_method_worker than
> extension_language_defn.
> Given the absence of c++ going this route would require splitting debug_method_worker into
> debug_method_worker_defn and debug_method_worker_ops (or some such), so I don't mind
> leaving things as is.
> OTOH, I see there are two such methods that are more methods of debug_method_worker than
> ext_lang.

Your call. I have left it as is. It can be taken up later as well if
required as it is an "internal" mechanical change.

The next comment is for the change in valops.c:find_overload_match.

> Is value_cast sufficient here?
> Seems like value_dynamic_cast may be necessary.

I think value_dynamic_cast uses value_cast. All that is required here
is a down cast, which I think value_cast can handle alright.
Nevertheless, I am not able to get my tests passing with
value_dynamic_cast here (complains about some missing linker symbol
for a vtable). I will dig more.

It might seem as if I have not addressed some of Doug's comments, but
my responses for such cases are via code documentation near the bits
he has commented about.

ChangeLog

        * Makefile.in: Add entries for new files.
        * NEWS (Python Scripting): Add entry about this feature.
        * data-directory/Makefile.in: Add entries for new Python files.
        * eval.c (evaluate_subexp_standard): Lookup and invoke methods
        defined in extension languages.
        * extension-priv.h (struct extension_language_ops): Add the
        debug method interface.
        * extension.c (new_debug_method_worker): New function.
        (clone_debug_method_worker): Likewise.
        (get_matching_debug_method_workers): Likewise.
        (get_debug_method_argtypes): Likewise.
        (invoke_debug_method): Likewise
        (free_debug_method_worker_vec): Likewise.
        (make_debug_method_worker_vec_cleanup): Likewise.
        * extension.h: New function declarations.
        (struct debug_method_worker): New struct.
        (VEC (debug_method_worker_ptr)): New type.
        (debug_method_worker_ptr): New typedef.
        (debug_method_worker_vec): Likewise.
        * 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.
        * python/py-debug_methods.c: New file.
        * python/py-objfile.c (objfile_object): New field
        'debug_method_matchers'.
        (objfpy_dealloc): XDECREF on the new debug_method_matchers field.
        (objfpy_new, objfile_to_objfile_object): Initialize
        debug_method_macthers field.
        (objfpy_get_debug_method_matchers): New function.
            (objfile_getset): New entry 'debug_method_matchers'.
        * python/py-progspace.c (pspace_object): New field
        'debug_method_matchers'.
        (pspy_dealloc): XDECREF on the new debug_method_matchers field.
        (pspy_new, pspace_to_pspace_object): Initialize
        debug_method_matchers field.
        (pspy_get_debug_method_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_debug_methods.
        * python/lib/gdb/__init__.py (debug_method_matcherss): 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.

        doc/
        * python.texi (Debug Methods In Python): New node.
        (Debug Method API): Likewise.
        (Writing a Debug Method): Likewise.

Attachment: dm_patch_v10.txt
Description: Text document


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