This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1749578

        * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker.__call__):
        Fix syntax error.

Tested x86_64-linux (although I can't get tests for the use_count() or
unique() Xmethods to actually work ...)

Committed to trunk. I'll backport it too.

commit 0f5caaa9b5fedebc6117cae5f3bc57c5cb3448d8
Author: redi <redi@138bc75d-0d04-0410-961f-82ee72b054a4>
Date:   Wed Sep 11 11:38:23 2019 +0000

    Fix Xmethod for shared_ptr::use_count()
    
    This was reported in https://bugzilla.redhat.com/show_bug.cgi?id=1749578
    
            * python/libstdcxx/v6/xmethods.py 
(SharedPtrUseCountWorker.__call__):
            Fix syntax error.
    
    git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@275644 
138bc75d-0d04-0410-961f-82ee72b054a4

diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py 
b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 623cb80bc0e..a720a63fa1a 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -739,7 +739,7 @@ class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker):
         return gdb.lookup_type('long')
 
     def __call__(self, obj):
-        refcounts = ['_M_refcount']['_M_pi']
+        refcounts = obj['_M_refcount']['_M_pi']
         return refcounts['_M_use_count'] if refcounts else 0
 
 class SharedPtrUniqueWorker(SharedPtrUseCountWorker):

Reply via email to