This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC 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 libstdc++ v5] - Add xmethods for std::vector and std::unique_ptr


The attached patch addresses Jonathan Wakely's comments on the
previous version of the patch:
https://gcc.gnu.org/ml/gcc-patches/2014-08/msg02426.html

On Tue, Aug 26, 2014 at 10:58 AM, Jonathan Wakely <jwakely@redhat.com> wrote:
> Shouldn't there be a change to python/Makefile.am so that xmethods.py
> gets installed alongside printers.py? Otherwise you can use these new
> xmethods in the libstdc++ testssuite, but they're not available to
> users.

Ah, sorry I missed that. Added in the attached patch.

> I'd also expect something to call the register_libstdcxx_xmethods
> function automatically, as in the attached patch, although this
> doesn't work for me.

gdb.xmethod is a module. Hence, hasattr(gdb, 'xmethod') in your
suggestion will not return True. I have modified this in the attached
patch to something which should work.

I had something in hook.in in my very first patch but Tom Tromey said
it was not required anymore:
https://gcc.gnu.org/ml/gcc-patches/2014-06/msg02405.html

> How am I expected to use these xmethods?

If you use the * operator on a unique_ptr or [] operator on a vector
in GDB, the xmethods will be called. Without the xmethods, GDB will
print something like "No matching method for
unique_ptr<...>::operator* found" if those operators were not used in
the source.

ChangeLog:
2014-08-27  Siva Chandra Reddy  <sivachandra@google.com>

        * python/hook.in: Load the xmethods.
        * python/Makefile.am (nobase_python_DATA): Add xmethods.py.
        * python/Makefile.in: Regenerated.
        * python/libstdcxx/v6/xmethods.py: New file.
        * testsuite/lib/gdb-test.exp (gdb_version_check_xmethods): New
        function.
        (gdb-test): New optional argument LOAD_XMETHODS.  Load xmethods
        python script if LOAD_XMETHODS is true.
        * testsuite/libstdc++-xmethods/unique_ptr.cc: New file.
        * testsuite/libstdc++-xmethods/vector.cc: New file.
        * testsuite/libstdc++-xmethods/xmethods.exp: New file.

Attachment: libstdcxx-xmethods-v5.txt
Description: Text document


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