aboutsummaryrefslogtreecommitdiff
path: root/libstdc++-v3/python
diff options
context:
space:
mode:
authorJonathan Wakely <jwakely@redhat.com>2023-03-10 11:06:25 +0000
committerJonathan Wakely <jwakely@redhat.com>2023-03-10 11:10:23 +0000
commit37c8a083d44f8123ad81a3cd411389b0b7b42ae6 (patch)
tree74531885153f7d9be4324849f6bcc7b5c89e5ec5 /libstdc++-v3/python
parente3f8dfcd885d19d322b10fb4e36d50b60da2576b (diff)
downloadgcc-37c8a083d44f8123ad81a3cd411389b0b7b42ae6.zip
gcc-37c8a083d44f8123ad81a3cd411389b0b7b42ae6.tar.gz
gcc-37c8a083d44f8123ad81a3cd411389b0b7b42ae6.tar.bz2
libstdc++: Fix GDB Xmethod for std::shared_ptr::use_count() [PR109064]
libstdc++-v3/ChangeLog: PR libstdc++/109064 * python/libstdcxx/v6/xmethods.py (SharedPtrUseCountWorker): Remove self-recursion in __init__. Add missing _supports. * testsuite/libstdc++-xmethods/shared_ptr.cc: Check use_count() and unique().
Diffstat (limited to 'libstdc++-v3/python')
-rw-r--r--libstdc++-v3/python/libstdcxx/v6/xmethods.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/libstdc++-v3/python/libstdcxx/v6/xmethods.py b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
index 6af7a3d..18a165f 100644
--- a/libstdc++-v3/python/libstdcxx/v6/xmethods.py
+++ b/libstdc++-v3/python/libstdcxx/v6/xmethods.py
@@ -730,7 +730,7 @@ class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker):
"Implements std::shared_ptr<T>::use_count()"
def __init__(self, elem_type):
- SharedPtrUseCountWorker.__init__(self, elem_type)
+ pass
def get_arg_types(self):
return None
@@ -738,6 +738,9 @@ class SharedPtrUseCountWorker(gdb.xmethod.XMethodWorker):
def get_result_type(self, obj):
return gdb.lookup_type('long')
+ def _supports(self, method_name):
+ return True
+
def __call__(self, obj):
refcounts = obj['_M_refcount']['_M_pi']
return refcounts['_M_use_count'] if refcounts else 0