forked from qt-creator/qt-creator
Debugger: Add option to get type name with module
Change-Id: I7d58d1e750e1982cce62647aae07f1b6f5e41091 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -172,7 +172,22 @@ char *getTypeName(ULONG64 module, ULONG typeId)
|
|||||||
return typeName;
|
return typeName;
|
||||||
}
|
}
|
||||||
|
|
||||||
const char *getTypeName(Type *type)
|
std::string getModuleName(Type *type)
|
||||||
|
{
|
||||||
|
if (type->m_targetType)
|
||||||
|
return getModuleName(type->m_targetType);
|
||||||
|
CIDebugSymbols *symbols = ExtensionCommandContext::instance()->symbols();
|
||||||
|
ULONG size;
|
||||||
|
symbols->GetModuleNameString(DEBUG_MODNAME_MODULE, DEBUG_ANY_ID, type->m_module, NULL, 0, &size);
|
||||||
|
std::string name(size - 1, '\0');
|
||||||
|
if (SUCCEEDED(symbols->GetModuleNameString(DEBUG_MODNAME_MODULE, DEBUG_ANY_ID,
|
||||||
|
type->m_module, &name[0], size, NULL))) {
|
||||||
|
return name;
|
||||||
|
}
|
||||||
|
return std::string();
|
||||||
|
}
|
||||||
|
|
||||||
|
const char *getTypeName(Type *type, const bool withModule)
|
||||||
{
|
{
|
||||||
if (type->m_name == nullptr) {
|
if (type->m_name == nullptr) {
|
||||||
if (type->m_targetType) {
|
if (type->m_targetType) {
|
||||||
@@ -187,7 +202,11 @@ const char *getTypeName(Type *type)
|
|||||||
type->m_name = getTypeName(type->m_module, type->m_typeId);
|
type->m_name = getTypeName(type->m_module, type->m_typeId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return type->m_name;
|
if (!withModule)
|
||||||
|
return type->m_name;
|
||||||
|
std::stringstream str;
|
||||||
|
str << getModuleName(type) << '!' << type->m_name;
|
||||||
|
return strdup(str.str().c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *type_Name(Type *self)
|
PyObject *type_Name(Type *self)
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ struct Type
|
|||||||
|
|
||||||
PyTypeObject *type_pytype();
|
PyTypeObject *type_pytype();
|
||||||
char *getTypeName(ULONG64 module, ULONG typeId);
|
char *getTypeName(ULONG64 module, ULONG typeId);
|
||||||
|
const char *getTypeName(Type *type, const bool withModule = false);
|
||||||
|
|
||||||
PyObject *lookupType(const std::string &typeName);
|
PyObject *lookupType(const std::string &typeName);
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user