forked from qt-creator/qt-creator
Debugger: Use type name from symbol
Type names generated from module and type id are sometimes incorrect. Change-Id: I4bbd4db029e7952703efe09f9beb92f703e400d9 Reviewed-by: Christian Stenger <christian.stenger@qt.io>
This commit is contained in:
@@ -350,11 +350,12 @@ void type_Dealloc(Type *self)
|
|||||||
|
|
||||||
PyObject *createType(ULONG64 module, ULONG typeId, const std::string &name)
|
PyObject *createType(ULONG64 module, ULONG typeId, const std::string &name)
|
||||||
{
|
{
|
||||||
|
std::string typeName = SymbolGroupValue::stripClassPrefixes(name);
|
||||||
Type *type = PyObject_New(Type, type_pytype());
|
Type *type = PyObject_New(Type, type_pytype());
|
||||||
type->m_module = module;
|
type->m_module = module;
|
||||||
type->m_typeId = typeId;
|
type->m_typeId = typeId;
|
||||||
type->m_resolved = true;
|
type->m_resolved = true;
|
||||||
type->m_name = name.empty() ? nullptr : strdup(name.c_str());
|
type->m_name = typeName.empty() ? nullptr : strdup(typeName.c_str());
|
||||||
return reinterpret_cast<PyObject *>(type);
|
return reinterpret_cast<PyObject *>(type);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -52,15 +52,31 @@ PyObject *value_Name(Value *self)
|
|||||||
return Py_BuildValue("s", symbolName.c_str());
|
return Py_BuildValue("s", symbolName.c_str());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *getTypeName(Value *value)
|
||||||
|
{
|
||||||
|
char *typeName = nullptr;
|
||||||
|
ULONG size = 0;
|
||||||
|
value->m_symbolGroup->GetSymbolTypeName(value->m_index, NULL, 0, &size);
|
||||||
|
if (size > 0) {
|
||||||
|
typeName = new char[size+3];
|
||||||
|
if (SUCCEEDED(value->m_symbolGroup->GetSymbolTypeName(value->m_index, typeName, size, NULL)))
|
||||||
|
return typeName;
|
||||||
|
delete[] typeName;
|
||||||
|
}
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
PyObject *value_Type(Value *self)
|
PyObject *value_Type(Value *self)
|
||||||
{
|
{
|
||||||
if (!self->m_symbolGroup)
|
if (!self->m_symbolGroup)
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
DEBUG_SYMBOL_PARAMETERS params;
|
DEBUG_SYMBOL_PARAMETERS params;
|
||||||
const HRESULT hr = self->m_symbolGroup->GetSymbolParameters(self->m_index, 1, ¶ms);
|
if (FAILED(self->m_symbolGroup->GetSymbolParameters(self->m_index, 1, ¶ms)))
|
||||||
if (FAILED(hr))
|
|
||||||
Py_RETURN_NONE;
|
Py_RETURN_NONE;
|
||||||
return createType(params.Module, params.TypeId);
|
char *typeName = getTypeName(self);
|
||||||
|
auto ret = createType(params.Module, params.TypeId, typeName ? typeName : std::string());
|
||||||
|
delete[] typeName;
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
PyObject *value_Bitsize(Value *self)
|
PyObject *value_Bitsize(Value *self)
|
||||||
|
|||||||
Reference in New Issue
Block a user