diff --git a/share/qtcreator/debugger/cdbbridge.py b/share/qtcreator/debugger/cdbbridge.py index 021c4bf5146..af0036c47a8 100644 --- a/share/qtcreator/debugger/cdbbridge.py +++ b/share/qtcreator/debugger/cdbbridge.py @@ -421,7 +421,7 @@ class Dumper(DumperBase): return mem def findStaticMetaObject(self, typeName): - ptr = self.findValueByExpression('&' + typeName + '::staticMetaObject') + ptr = cdbext.getAddressByName(typeName + '::staticMetaObject') return ptr def warn(self, msg): diff --git a/src/libs/qtcreatorcdbext/pycdbextmodule.cpp b/src/libs/qtcreatorcdbext/pycdbextmodule.cpp index d3866b611bb..c4629bf7698 100644 --- a/src/libs/qtcreatorcdbext/pycdbextmodule.cpp +++ b/src/libs/qtcreatorcdbext/pycdbextmodule.cpp @@ -166,6 +166,20 @@ static PyObject *cdbext_getNameByAddress(PyObject *, PyObject *args) return ret; } +static PyObject *cdbext_getAddressByName(PyObject *, PyObject *args) +{ + char *name = 0; + if (!PyArg_ParseTuple(args, "s", &name)) + Py_RETURN_NONE; + + CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols(); + + ULONG64 address = 0; + if (FAILED(symbols->GetOffsetByName(name, &address))) + address = 0; + return Py_BuildValue("K", address); +} + static PyObject *cdbext_lookupType(PyObject *, PyObject *args) // -> Type { char *type; @@ -364,6 +378,8 @@ static PyMethodDef cdbextMethods[] = { "Returns a list of symbol names matching the given pattern"}, {"getNameByAddress", cdbext_getNameByAddress, METH_VARARGS, "Returns the name of the symbol at the given address"}, + {"getAddressByName", cdbext_getAddressByName, METH_VARARGS, + "Returns the address of the symbol with the given name"}, {"lookupType", cdbext_lookupType, METH_VARARGS, "Returns type object or None if the type can not be resolved"}, {"listOfLocals", cdbext_listOfLocals, METH_VARARGS,