Commit 1731911c authored by hjk's avatar hjk

debugger: implement gdb python dumper fuer std::array

Change-Id: I32d353ec332d39fa80fab9780a0b084156842666
Reviewed-by: default avatarhjk <qthjk@ovi.com>
parent e15912d7
...@@ -278,7 +278,12 @@ def numericTemplateArgument(type, position): ...@@ -278,7 +278,12 @@ def numericTemplateArgument(type, position):
except RuntimeError, error: except RuntimeError, error:
# ": No type named 30." # ": No type named 30."
msg = str(error) 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): def showException(msg, exType, exValue, exTraceback):
......
...@@ -1699,6 +1699,19 @@ def qdump__QxXmlAttributes(d, value): ...@@ -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): def qdump__std__complex(d, value):
innerType = templateArgument(value.type, 0) innerType = templateArgument(value.type, 0)
base = value.address.cast(innerType.pointer()) base = value.address.cast(innerType.pointer())
......
...@@ -158,6 +158,9 @@ void dummyStatement(...) {} ...@@ -158,6 +158,9 @@ void dummyStatement(...) {}
#include <QStandardItemModel> #include <QStandardItemModel>
#include <QLabel> #include <QLabel>
#if USE_CXX11
#include <array>
#endif
#include <complex> #include <complex>
#include <deque> #include <deque>
#include <iostream> #include <iostream>
...@@ -2259,6 +2262,25 @@ namespace qxml { ...@@ -2259,6 +2262,25 @@ namespace qxml {
} // 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 { namespace stdcomplex {
void testStdComplex() void testStdComplex()
...@@ -2266,12 +2288,13 @@ namespace stdcomplex { ...@@ -2266,12 +2288,13 @@ namespace stdcomplex {
std::complex<double> c(1, 2); std::complex<double> c(1, 2);
BREAK_HERE; BREAK_HERE;
// Expand c. // Expand c.
// Check c (1.000000, 2.000000) complex. // Check c (1.000000, 2.000000) std::complex<double>.
// Continue. // Continue.
dummyStatement(&c); dummyStatement(&c);
} }
} // namespace stddeque } // namespace stdcomplex
namespace stddeque { namespace stddeque {
...@@ -5972,6 +5995,7 @@ int main(int argc, char *argv[]) ...@@ -5972,6 +5995,7 @@ int main(int argc, char *argv[])
namespc::testNamespace(); namespc::testNamespace();
painting::testPainting(); painting::testPainting();
stdarray::testStdArray();
stdcomplex::testStdComplex(); stdcomplex::testStdComplex();
stddeque::testStdDeque(); stddeque::testStdDeque();
stdlist::testStdList(); stdlist::testStdList();
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment