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]

[RFC] Debug Methods in GDB Python


Hi all,

This is a followup to the thread on debug operators here (last
message): http://sourceware.org/ml/gdb-patches/2013-01/msg00005.html

I am starting another thread as I now have, what I feel is, a fairly
independent patch which implements a larger feature (of which C++
operator methods are a part), and some of the un-implemented features
I have mentioned in my last post have been implemented. The patch is
attached. Few points about the patch:

1. The patch is incomplete in the sense that tests and documentation
are missing. Also, ways to enable and disable single or group of debug
methods is missing. At this point, I am looking for feedback on my
direction and the way I am intercepting the normal GDB flow to lookup
methods defined in Python. I will work on completing the patch once
there is an agreement on these basics.

2. I did not intend to provide a way for the user to define new or
override static methods via Python.

3. I did not intend to provide a way for the user to define new
virtual methods in Python. The user can however override existing
virtual and non-virtual methods. The user can also define new
non-virtual methods in Python.

4. Doug suggested that I use the C++ infrastructure in GDB as much as
possible. I feel I have done so.

5. The Changelog for the patch (which is also raw) is as follows:

2013-01-07  Siva Chandra Reddy  <sivachandra@google.com>

        * 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/debugmethods.py: Python side of the support
        for debug methods in Python.
        * 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/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'.

6. The toy program I used for testing, and the corresponding auto load
script are also attached for illustration.

Thanks and regards,
Siva Chandra

Attachment: dm_patch_v1.txt
Description: Text document

Attachment: dm.cc
Description: Binary data

Attachment: dm-gdb.py
Description: Binary data


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