forked from qt-creator/qt-creator
Debugger: Fix dumper for std::unique_ptr with custom deleter
Task-number: QTCREATORBUG-23885 Change-Id: Ifba6ef7233886d1c9341e7912d6924cd9afbc4eb Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -800,7 +800,10 @@ def qdump__std____1__shared_ptr(d, value):
|
||||
|
||||
|
||||
def qdump__std__unique_ptr(d, value):
|
||||
p = d.extractPointer(value)
|
||||
if value.type.size() == d.ptrSize():
|
||||
p = d.extractPointer(value)
|
||||
else:
|
||||
_, p = value.split("pp"); # For custom deleters.
|
||||
if p == 0:
|
||||
d.putValue("(null)")
|
||||
d.putNumChild(0)
|
||||
|
@@ -4706,14 +4706,19 @@ void tst_Dumpers::dumper_data()
|
||||
|
||||
QTest::newRow("StdUniquePtr")
|
||||
<< Data("#include <memory>\n"
|
||||
"#include <string>\n" + fooData,
|
||||
"#include <string>\n" + fooData +
|
||||
|
||||
"static Foo *alloc_foo() { return new Foo; }\n"
|
||||
"static void free_foo(Foo *f) { delete f; }\n",
|
||||
|
||||
"std::unique_ptr<int> p0;\n\n"
|
||||
"std::unique_ptr<int> p1(new int(32));\n\n"
|
||||
"std::unique_ptr<Foo> p2(new Foo);\n\n"
|
||||
"std::unique_ptr<std::string> p3(new std::string(\"ABC\"));",
|
||||
"std::unique_ptr<std::string> p3(new std::string(\"ABC\"));\n"
|
||||
|
||||
"&p0, &p1, &p2, &p3")
|
||||
"std::unique_ptr<Foo, void(*)(Foo*)> p4{alloc_foo(), free_foo};",
|
||||
|
||||
"&p0, &p1, &p2, &p3, &p4")
|
||||
|
||||
+ CoreProfile()
|
||||
+ Cxx11Profile()
|
||||
@@ -4722,7 +4727,8 @@ void tst_Dumpers::dumper_data()
|
||||
+ Check("p0", "(null)", "std::unique_ptr<int, std::default_delete<int> >")
|
||||
+ Check("p1", "32", "std::unique_ptr<int, std::default_delete<int> >")
|
||||
+ Check("p2", Pointer(), "std::unique_ptr<Foo, std::default_delete<Foo> >")
|
||||
+ Check("p3", "\"ABC\"", "std::unique_ptr<std::string, std::default_delete<std::string> >");
|
||||
+ Check("p3", "\"ABC\"", "std::unique_ptr<std::string, std::default_delete<std::string> >")
|
||||
+ Check("p4.b", "2", "int");
|
||||
|
||||
|
||||
QTest::newRow("StdOnce")
|
||||
|
Reference in New Issue
Block a user