forked from qt-creator/qt-creator
debugger: implement gdb python dumper fuer std::array
Change-Id: I32d353ec332d39fa80fab9780a0b084156842666 Reviewed-by: hjk <qthjk@ovi.com>
This commit is contained in:
@@ -278,7 +278,12 @@ def numericTemplateArgument(type, position):
|
||||
except RuntimeError, error:
|
||||
# ": No type named 30."
|
||||
msg = str(error)
|
||||
return int(msg[14:-1])
|
||||
msg = msg[14:-1]
|
||||
# gdb at least until 7.4 produces for std::array<int, 4u>
|
||||
# for template_argument(1): RuntimeError: No type named 4u.
|
||||
if msg[-1] == 'u':
|
||||
msg = msg[0:-1]
|
||||
return int(msg)
|
||||
|
||||
|
||||
def showException(msg, exType, exValue, exTraceback):
|
||||
|
@@ -1699,6 +1699,19 @@ def qdump__QxXmlAttributes(d, value):
|
||||
#
|
||||
#######################################################################
|
||||
|
||||
def qdump__std__array(d, value):
|
||||
size = numericTemplateArgument(value.type, 1)
|
||||
d.putItemCount(size)
|
||||
d.putNumChild(size)
|
||||
if d.isExpanded():
|
||||
innerType = templateArgument(value.type, 0)
|
||||
with Children(d, size, childType=innerType):
|
||||
pcur = value.address.cast(innerType.pointer())
|
||||
for i in d.childRange():
|
||||
d.putSubItem(i, pcur.dereference())
|
||||
pcur += 1
|
||||
|
||||
|
||||
def qdump__std__complex(d, value):
|
||||
innerType = templateArgument(value.type, 0)
|
||||
base = value.address.cast(innerType.pointer())
|
||||
|
@@ -158,6 +158,9 @@ void dummyStatement(...) {}
|
||||
#include <QStandardItemModel>
|
||||
#include <QLabel>
|
||||
|
||||
#if USE_CXX11
|
||||
#include <array>
|
||||
#endif
|
||||
#include <complex>
|
||||
#include <deque>
|
||||
#include <iostream>
|
||||
@@ -2259,6 +2262,25 @@ namespace qxml {
|
||||
} // namespace qxml
|
||||
|
||||
|
||||
namespace stdarray {
|
||||
|
||||
void testStdArray()
|
||||
{
|
||||
#if USE_CXX11
|
||||
std::array<int, 4> a = { 1, 2, 3, 4};
|
||||
BREAK_HERE;
|
||||
// Expand a.
|
||||
// Check a <4 items> std::array<int>.
|
||||
// Check [0] 1 int.
|
||||
// Continue.
|
||||
dummyStatement(&a);
|
||||
#endif
|
||||
}
|
||||
|
||||
} // namespace stdcomplex
|
||||
|
||||
|
||||
|
||||
namespace stdcomplex {
|
||||
|
||||
void testStdComplex()
|
||||
@@ -2266,12 +2288,13 @@ namespace stdcomplex {
|
||||
std::complex<double> c(1, 2);
|
||||
BREAK_HERE;
|
||||
// Expand c.
|
||||
// Check c (1.000000, 2.000000) complex.
|
||||
// Check c (1.000000, 2.000000) std::complex<double>.
|
||||
// Continue.
|
||||
dummyStatement(&c);
|
||||
}
|
||||
|
||||
} // namespace stddeque
|
||||
} // namespace stdcomplex
|
||||
|
||||
|
||||
namespace stddeque {
|
||||
|
||||
@@ -5972,6 +5995,7 @@ int main(int argc, char *argv[])
|
||||
namespc::testNamespace();
|
||||
painting::testPainting();
|
||||
|
||||
stdarray::testStdArray();
|
||||
stdcomplex::testStdComplex();
|
||||
stddeque::testStdDeque();
|
||||
stdlist::testStdList();
|
||||
|
Reference in New Issue
Block a user