forked from qt-creator/qt-creator
debugger: add dumper for boost::shared_ptr
This commit is contained in:
@@ -1661,8 +1661,8 @@ def qdump__QWeakPointer(d, item):
|
||||
check(int(strongref) <= int(weakref))
|
||||
check(int(weakref) <= 10*1000*1000)
|
||||
|
||||
innerType = templateArgument(item.value.type, 0)
|
||||
if isSimpleType(value.dereference().type):
|
||||
d.putNumChild(3)
|
||||
d.putItem(Item(value.dereference(), item.iname, None))
|
||||
else:
|
||||
d.putValue("")
|
||||
@@ -1969,6 +1969,42 @@ def qdump__boost__optional(d, item):
|
||||
value = storage.cast(type)
|
||||
d.putItem(Item(value, item.iname))
|
||||
|
||||
def qdump__boost__shared_ptr(d, item):
|
||||
# s boost::shared_ptr<int>
|
||||
# pn boost::detail::shared_count
|
||||
# pi_ 0x0 boost::detail::sp_counted_base *
|
||||
# px 0x0 int *
|
||||
if isNull(item.value["pn"]["pi_"]):
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
return
|
||||
|
||||
if isNull(item.value["px"]):
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
return
|
||||
|
||||
countedbase = item.value["pn"]["pi_"].dereference()
|
||||
weakcount = countedbase["weak_count_"]
|
||||
usecount = countedbase["use_count_"]
|
||||
check(int(weakcount) >= 0)
|
||||
check(int(weakcount) <= int(usecount))
|
||||
check(int(usecount) <= 10*1000*1000)
|
||||
|
||||
value = item.value["px"].dereference()
|
||||
if isSimpleType(value.type):
|
||||
d.putNumChild(3)
|
||||
d.putItem(Item(value, item.iname, None))
|
||||
else:
|
||||
d.putValue("")
|
||||
|
||||
d.putNumChild(3)
|
||||
if d.isExpanded(item):
|
||||
with Children(d, 3):
|
||||
d.putSubItem(Item(value, item.iname, "data", "data"))
|
||||
d.putIntItem("weakcount", weakcount)
|
||||
d.putIntItem("usecount", usecount)
|
||||
|
||||
|
||||
#######################################################################
|
||||
#
|
||||
|
@@ -84,6 +84,11 @@
|
||||
#include <vector>
|
||||
|
||||
#define USE_PRIVATE 1
|
||||
#define USE_BOOST 1
|
||||
|
||||
#if USE_BOOST
|
||||
#include <boost/shared_ptr.hpp>
|
||||
#endif
|
||||
|
||||
#if USE_PRIVATE
|
||||
#include <QtCore/private/qobject_p.h>
|
||||
@@ -105,7 +110,6 @@
|
||||
#include <xmmintrin.h>
|
||||
#include <stddef.h>
|
||||
#endif
|
||||
|
||||
Q_DECLARE_METATYPE(QHostAddress)
|
||||
Q_DECLARE_METATYPE(QList<int>)
|
||||
Q_DECLARE_METATYPE(QStringList)
|
||||
@@ -2361,6 +2365,21 @@ void testQScriptValue(int argc, char *argv[])
|
||||
QScriptValue d = s.data();
|
||||
}
|
||||
|
||||
void testBoostSharedPtr()
|
||||
{
|
||||
#if USE_BOOST
|
||||
QSharedPointer<int> qs;
|
||||
QSharedPointer<int> qi(new int(43));
|
||||
QSharedPointer<int> qj = qi;
|
||||
|
||||
boost::shared_ptr<int> s;
|
||||
boost::shared_ptr<int> i(new int(43));
|
||||
boost::shared_ptr<int> j = i;
|
||||
int k = 2;
|
||||
++k;
|
||||
#endif
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
testPrivate();
|
||||
@@ -2454,6 +2473,7 @@ int main(int argc, char *argv[])
|
||||
testQVector();
|
||||
testQVectorOfQList();
|
||||
|
||||
testBoostSharedPtr();
|
||||
|
||||
//*(int *)0 = 0;
|
||||
|
||||
|
Reference in New Issue
Block a user