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 - Python Scripting] New method Value.referenced_value to dereference pointer as well as reference values (with docs)


Hi all,

Per Tom's suggestion in another thread (see for reference
http://sourceware.org/ml/gdb-patches/2012-03/msg00417.html), I have
added a new method to gdb.Value. I am starting a new mail thread as
the subject line, and the patch, have changed quite a bit from last
time.

I could not think of a better name than 'referenced_value' for this
method. Hence, I have implemented it to deference pointer as well as
reference values as the name of the method suggests. I have tried to
document the similarities (and differences) between this new method
and the method Value.dereference wherever reasonable. I have used
Tom's example of a reference to a pointer to describe the differences.

About using prepare_for_testing, I notice that compilation fails with
this as gcc is being used to compile the test case and not g++. So, I
have not changed the exp file in this patch.

Code Changelog:

2012-03-13 Siva Chandra <sivachandra@google.com>

        Python scripting: Add new method Value.referenced_value to
        gdb.Value which can dereference pointer as well as reference
        values.
        * NEWS: Add entry under 'Python scripting' about the new method
        Value.referenced_value on gdb.Value objects.
        * python/py-value.c (valpy_referenced_value): New function
        defining a new method on gdb.Value objects which can dereference
        pointer and reference values.
        * testsuite/gdb.python/py-value.cc: Add test case for
        testing the methodology exposing C++ values to Python.
        * testsuite/gdb.python/py-value-cc.exp: Add tests testing the
        methodology exposing C++ values to Python.
        * testsuite/gdb.python/Makefile.in: Add py-value-cc to
        EXECUTABLES.

Docs Changelog:

2012-03-13 Siva Chandra <sivachandra@google.com>

        * gdb.texinfo (Python API/Values From Inferior): Add description
        about the new method Value.referenced_value.  Add description on
        how Value.dereference is different (and similar) to
        Value.referenced_value.

Thanks,
Siva Chandra

Attachment: value_referenced_value_patch_v1.txt
Description: Text document


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