forked from qt-creator/qt-creator
Debugger: Make {boost,std}::shared_ptr display more compact
After debugging through a code base that makes extensive use of shared pointers (LLDB...) I came to the conclusion that the display of weak and strong counts is pretty much useless and it would be better to avoid that level in the display. Change-Id: Ie03b05fff4f7f5b7dced2e656b404e8e7938cc25 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -65,12 +65,8 @@ def qdump__boost__shared_ptr(d, value):
|
||||
d.check(weakcount >= 0)
|
||||
d.check(weakcount <= usecount)
|
||||
d.check(usecount <= 10*1000*1000)
|
||||
|
||||
with Children(d):
|
||||
short = d.putSubItem("data", d.createValue(px, value.type[0]))
|
||||
d.putIntItem("weakcount", weakcount)
|
||||
d.putIntItem("usecount", usecount)
|
||||
d.putValue(short.value, short.encoding)
|
||||
d.putItem(d.createValue(px, value.type[0]))
|
||||
d.putBetterType(value.type)
|
||||
|
||||
|
||||
def qdump__boost__container__list(d, value):
|
||||
|
||||
@@ -667,41 +667,27 @@ def qdump__std__shared_ptr(d, value):
|
||||
if i.pointer() == 0:
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
return
|
||||
with Children(d):
|
||||
short = d.putSubItem("data", i.dereference())
|
||||
if d.isMsvcTarget():
|
||||
refcount = value["_Rep"]
|
||||
d.putIntItem("usecount", refcount["_Uses"])
|
||||
d.putIntItem("weakcount", refcount["_Weaks"])
|
||||
else:
|
||||
refcount = value["_M_refcount"]["_M_pi"]
|
||||
d.putIntItem("usecount", refcount["_M_use_count"])
|
||||
d.putIntItem("weakcount", refcount["_M_weak_count"])
|
||||
d.putValue(short.value, short.encoding)
|
||||
else:
|
||||
d.putItem(i.dereference())
|
||||
d.putBetterType(value.type)
|
||||
|
||||
def qdump__std____1__shared_ptr(d, value):
|
||||
i = value["__ptr_"]
|
||||
if i.pointer() == 0:
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
return
|
||||
with Children(d):
|
||||
short = d.putSubItem("data", i.dereference())
|
||||
d.putFields(value["__cntrl_"].dereference())
|
||||
#d.putIntItem("usecount", refcount["_M_use_count"])
|
||||
#d.putIntItem("weakcount", refcount["_M_weak_count"])
|
||||
d.putValue(short.value, short.encoding)
|
||||
else:
|
||||
d.putItem(i.dereference())
|
||||
d.putBetterType(value.type)
|
||||
|
||||
def qdump__std__unique_ptr(d, value):
|
||||
p = d.extractPointer(value)
|
||||
if p == 0:
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
return
|
||||
with Children(d):
|
||||
short = d.putSubItem("data", d.createValue(p, value.type[0]))
|
||||
d.putValue(short.value, short.encoding)
|
||||
else:
|
||||
d.putItem(d.createValue(p, value.type[0]))
|
||||
d.putBetterType(value.type)
|
||||
|
||||
def qdump__std____1__unique_ptr(d, value):
|
||||
qdump__std__unique_ptr(d, value)
|
||||
|
||||
@@ -4375,15 +4375,9 @@ void tst_Dumpers::dumper_data()
|
||||
+ MacLibCppProfile()
|
||||
|
||||
+ Check("p0", "(null)", "std::unique_ptr<int, std::default_delete<int> >")
|
||||
|
||||
+ Check("p1", "32", "std::unique_ptr<int, std::default_delete<int> >")
|
||||
+ Check("p1.data", "32", "int")
|
||||
|
||||
+ Check("p2", Pointer(), "std::unique_ptr<Foo, std::default_delete<Foo> >")
|
||||
+ CheckType("p2.data", "Foo")
|
||||
|
||||
+ Check("p3", "\"ABC\"", "std::unique_ptr<std::string, std::default_delete<std::string> >")
|
||||
+ Check("p3.data", "\"ABC\"", "std::string");
|
||||
+ Check("p3", "\"ABC\"", "std::unique_ptr<std::string, std::default_delete<std::string> >");
|
||||
|
||||
|
||||
QTest::newRow("StdOnce")
|
||||
@@ -4408,17 +4402,12 @@ void tst_Dumpers::dumper_data()
|
||||
+ MacLibCppProfile()
|
||||
|
||||
+ Check("pi", "32", "std::shared_ptr<int>")
|
||||
+ Check("pi.data", "32", "int")
|
||||
+ Check("pf", Pointer(), "std::shared_ptr<Foo>")
|
||||
+ CheckType("pf.data", "Foo")
|
||||
+ Check("ps", "\"ABC\"", "std::shared_ptr<std::string>")
|
||||
+ Check("ps.data", "\"ABC\"", "std::string")
|
||||
+ Check("wi", "32", "std::weak_ptr<int>")
|
||||
+ Check("wi.data", "32", "int")
|
||||
+ Check("wf", Pointer(), "std::weak_ptr<Foo>")
|
||||
+ CheckType("wf.data", "Foo")
|
||||
+ Check("ws", "\"ABC\"", "std::weak_ptr<std::string>")
|
||||
+ Check("ws.data", "\"ABC\"", "std::string");
|
||||
+ Check("ps", "\"ABC\"", "std::shared_ptr<std::string>");
|
||||
|
||||
QTest::newRow("StdSharedPtr2")
|
||||
<< Data("#include <memory>\n"
|
||||
@@ -4436,10 +4425,10 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("inner.m_1", "0x1", "int *")
|
||||
+ Check("inner.m_2", "0x2", "int *")
|
||||
+ Check("inner.x", "3", "int")
|
||||
+ Check("a.data.m_0", "0x0", "int *")
|
||||
+ Check("a.data.m_1", "0x1", "int *")
|
||||
+ Check("a.data.m_2", "0x2", "int *")
|
||||
+ Check("a.data.x", "3", "int");
|
||||
+ Check("a.m_0", "0x0", "int *")
|
||||
+ Check("a.m_1", "0x1", "int *")
|
||||
+ Check("a.m_2", "0x2", "int *")
|
||||
+ Check("a.x", "3", "int");
|
||||
|
||||
QTest::newRow("StdSet")
|
||||
<< Data("#include <set>\n",
|
||||
@@ -5594,13 +5583,9 @@ void tst_Dumpers::dumper_data()
|
||||
|
||||
+ Check("s", "(null)", "boost::shared_ptr<int>")
|
||||
+ Check("i", "43", "boost::shared_ptr<int>")
|
||||
+ Check("i.weakcount", "1", "int")
|
||||
+ Check("i.usecount", "2", "int")
|
||||
+ Check("i.data", "43", "int")
|
||||
+ Check("j", "43", "boost::shared_ptr<int>")
|
||||
+ Check("sl", "<1 items>", " boost::shared_ptr<@QStringList>")
|
||||
+ Check("sl.data", "<1 items>", "@QStringList")
|
||||
+ Check("sl.data.0", "[0]", "\"HUH!\"", "@QString");
|
||||
+ Check("sl.0", "[0]", "\"HUH!\"", "@QString");
|
||||
|
||||
|
||||
QTest::newRow("BoostGregorianDate")
|
||||
|
||||
Reference in New Issue
Block a user