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] Debug Methods in GDB Python


Hi,

This is a continuation from a previous thread, but switching from RFC
to PATCH. For reference, my last message from the previous thread can
be found here: https://sourceware.org/ml/gdb-patches/2013-11/msg00303.html

Please find the patch attached.  It now has tests, info/enable/disable
debug method commands, and addresses most previous comments from Tom
and Doug. For couple of them, I have responses inline.

Siva> +struct py_ext_object
Siva> +{
Siva> +  /* Holds an instance of the DebugMethod class.  */
Siva> +  PyObject *object;
Siva> +
Siva> +  /* Holds the type of the 'this' object.  */
Siva> +  PyObject *match_py_obj_type;
Siva> +
Siva> +  /* Holds the matching method name.  */
Siva> +  const char *match_method;

Tom> How "match_method" is allocated and how its lifetime is
Tom> managed is really unclear to me.

The match_method is the name of the method to match. This is allocated
and managed by the agents calling into the debug methods
infrastructure.

Doug> For matching the class I would look into how the current
Doug> version of the libstdc++ pretty-printers do this.

There is a utility debug method class in the patch which does a very
simple match. But, the infrastructure provided in the patch can used
to implement any kind of matching that the user wants. For example,
look at testsuite/gdb.python/py-debugmethods.py in the attached patch.

2013-11-22  Siva Chandra Reddy  <sivachandra@google.com>

        Add Debug methods support in GDB Python.

        * Makefile.in: Add entries for new files
        * data-directory/Makefile.in: Add entry for new Python file
        * eval.c: Invoke methods defined in extension methods.
        * ext-function.c: Support for working with functions/methods
        defined in an extension language.
        * ext-function.h: Support for working with functions/methods
        defined in an extension language.
        * python/lib/gdb/__init__.py: Add an attribute 'debug_methods'
        to the 'gdb' module.
        * python/lib/gdb/debugmethods.py: Python side of the support
        for debug methods in Python.
        * python/lib/gdb/command/debug-methods.py: Definition of
        new debug method commands (info/enable/disable).
        * python/py-debugmethods.c: C side of the support for debug
        methods in Python.
        * python/py-objfile.c: Add 'debug_methods' attribute to
        gdb.Objfile.
        * python/py-progspace.c: Add 'debug_methods' attribute to
        gdb.Progspace.
        * python/python-internal.h: Add new function.
        gdb.enable_debug_methods to the Python module 'gdb'.
        * python/python.c: Add new function gdb.enable_debug_methods to
        the Python module 'gdb'.
        * python/python.h: Add declarations of new functions.
        * valarith.c: Invoke operators defined in extension languages.
        * valops.c: Lookup methods defined in extension languages.
        * value.h: New signature for 'find_overload_match'.

        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.

Attachment: dm_patch_v6.txt
Description: Text document


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