diff --git a/src/libs/qtcreatorcdbext/pycdbextmodule.cpp b/src/libs/qtcreatorcdbext/pycdbextmodule.cpp index c1584587c0c..49eed21616c 100644 --- a/src/libs/qtcreatorcdbext/pycdbextmodule.cpp +++ b/src/libs/qtcreatorcdbext/pycdbextmodule.cpp @@ -220,17 +220,13 @@ static PyObject *cdbext_listOfLocals(PyObject *, PyObject *args) // -> [ Value ] ++currentPartialIname; // skip "local" part ULONG symbolGroupIndex = 0; - ULONG childEndIndex = 0; for (;symbolGroupIndex < scopeEnd; ++symbolGroupIndex) { PyValue value(symbolGroupIndex, symbolGroup); - if (childEndIndex <= symbolGroupIndex) { // do not return a child value - if (value.name() == *currentPartialIname) { - PyList_Append(locals, createPythonObject(value)); - return locals; - } - ++childEndIndex; + if (value.name() == *currentPartialIname) { + PyList_Append(locals, createPythonObject(value)); + return locals; } - childEndIndex += ULONG(value.childCount()); + symbolGroupIndex += value.currentNumberOfDescendants(); } } diff --git a/src/libs/qtcreatorcdbext/pyvalue.cpp b/src/libs/qtcreatorcdbext/pyvalue.cpp index a56cb08ba9c..c92b694bf37 100644 --- a/src/libs/qtcreatorcdbext/pyvalue.cpp +++ b/src/libs/qtcreatorcdbext/pyvalue.cpp @@ -278,13 +278,18 @@ PyValue PyValue::childFromIndex(int index) int offset = index + 1; for (ULONG childIndex = m_index + 1; childIndex < m_index + offset; ) { - const ULONG childDescendantCount = currentNumberOfDescendants(childIndex, m_symbolGroup); + const ULONG childDescendantCount = ::currentNumberOfDescendants(childIndex, m_symbolGroup); childIndex += childDescendantCount + 1; offset += childDescendantCount; } return PyValue(m_index + offset, m_symbolGroup); } +ULONG PyValue::currentNumberOfDescendants() +{ + return ::currentNumberOfDescendants(m_index, m_symbolGroup); +} + PyValue PyValue::createValue(ULONG64 address, const PyType &type) { if (debuggingValueEnabled()) { diff --git a/src/libs/qtcreatorcdbext/pyvalue.h b/src/libs/qtcreatorcdbext/pyvalue.h index fa89c730621..045658a01b3 100644 --- a/src/libs/qtcreatorcdbext/pyvalue.h +++ b/src/libs/qtcreatorcdbext/pyvalue.h @@ -55,6 +55,7 @@ public: PyValue childFromName(const std::string &name); PyValue childFromField(const PyField &field); PyValue childFromIndex(int index); + ULONG currentNumberOfDescendants(); static PyValue createValue(ULONG64 address, const PyType &type); static int tag(const std::string &typeName);