summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDavid Schulz <david.schulz@qt.io>2016-11-24 13:46:02 +0100
committerDavid Schulz <david.schulz@qt.io>2016-12-01 10:16:29 +0000
commit54a363b36c1e0934380ad4094952beacb54a765b (patch)
tree244998e1b58e89742716cd0981298d6ee3b42142
parent681efe2324fc6874eeedd7e54a0158732b809c88 (diff)
downloadqt-creator-54a363b36c1e0934380ad4094952beacb54a765b.tar.gz
Debugger: Move symbolgroup indices after expanding
Change-Id: I0c2078b5c780a8f8f018e72c27575825c076cdd3 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
-rw-r--r--src/libs/qtcreatorcdbext/pyvalue.cpp38
1 files changed, 35 insertions, 3 deletions
diff --git a/src/libs/qtcreatorcdbext/pyvalue.cpp b/src/libs/qtcreatorcdbext/pyvalue.cpp
index 6e5fb53d3e..a39d8eb7e7 100644
--- a/src/libs/qtcreatorcdbext/pyvalue.cpp
+++ b/src/libs/qtcreatorcdbext/pyvalue.cpp
@@ -32,9 +32,14 @@
#include "stringutils.h"
#include "symbolgroupvalue.h"
+#include <map>
+#include <algorithm>
+
constexpr bool debugPyValue = false;
constexpr bool debuggingValueEnabled() { return debugPyValue || debugPyCdbextModule; }
+static std::map<CIDebugSymbolGroup *, std::list<Value *>> valuesForSymbolGroup;
+
std::string getSymbolName(CIDebugSymbolGroup *sg, ULONG index)
{
ULONG size = 0;
@@ -147,6 +152,21 @@ PyObject *value_Address(Value *self)
return Py_BuildValue("K", address);
}
+void indicesMoved(CIDebugSymbolGroup *symbolGroup, ULONG start, ULONG delta)
+{
+ if (delta == 0)
+ return;
+ ULONG count;
+ if (FAILED(symbolGroup->GetNumberSymbols(&count)))
+ return;
+ if (count <= start)
+ return;
+ for (Value *val : valuesForSymbolGroup[symbolGroup]) {
+ if (val->m_index >= start && val->m_index + delta < count)
+ val->m_index += delta;
+ }
+}
+
bool expandValue(Value *v)
{
DEBUG_SYMBOL_PARAMETERS params;
@@ -154,7 +174,15 @@ bool expandValue(Value *v)
return false;
if (params.Flags & DEBUG_SYMBOL_EXPANDED)
return true;
- return SUCCEEDED(v->m_symbolGroup->ExpandSymbol(v->m_index, TRUE));
+ if (FAILED(v->m_symbolGroup->ExpandSymbol(v->m_index, TRUE)))
+ return false;
+ if (FAILED(v->m_symbolGroup->GetSymbolParameters(v->m_index, 1, &params)))
+ return false;
+ if (params.Flags & DEBUG_SYMBOL_EXPANDED) {
+ indicesMoved(v->m_symbolGroup, v->m_index + 1, params.SubElements);
+ return true;
+ }
+ return false;
}
ULONG numberOfChildren(Value *v)
@@ -310,8 +338,11 @@ PyObject *value_ChildFromIndex(Value *self, PyObject *args)
return createValue(self->m_index + index + 1, self->m_symbolGroup);
}
-void value_Dealloc(Value *)
-{ }
+void value_Dealloc(Value *v)
+{
+ auto values = valuesForSymbolGroup[v->m_symbolGroup];
+ std::remove(values.begin(), values.end(), v);
+}
PyObject *value_New(PyTypeObject *type, PyObject *, PyObject *)
{
@@ -339,6 +370,7 @@ PyObject *createValue(ULONG index, CIDebugSymbolGroup *symbolGroup)
if (value != NULL) {
value->m_index = index;
value->m_symbolGroup = symbolGroup;
+ valuesForSymbolGroup[symbolGroup].push_back(value);
}
return reinterpret_cast<PyObject*>(value);
}