mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-08 11:38:21 +02:00
Changed debug info for enums
This commit is contained in:
parent
c7f76f879a
commit
54fa1e0811
4 changed files with 35 additions and 38 deletions
|
@ -2063,13 +2063,6 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
||||||
diFieldTypes.push_back(inheritanceType);
|
diFieldTypes.push_back(inheritanceType);
|
||||||
DbgMakePermanent(diForwardDecl, derivedFrom, diFieldTypes);
|
DbgMakePermanent(diForwardDecl, derivedFrom, diFieldTypes);
|
||||||
}
|
}
|
||||||
else if (isPrimEnum)
|
|
||||||
{
|
|
||||||
BF_ASSERT(type->mSize > 0);
|
|
||||||
|
|
||||||
diForwardDecl = DbgCreateSizedForwardDecl(llvm::dwarf::DW_TAG_enumeration_type,
|
|
||||||
typeName, curDIScope, fileDIScope, 0, (int64)BF_ALIGN(type->mSize, type->mAlign) * 8, (int64)type->mAlign * 8);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
diForwardDecl = DbgCreateSizedForwardDecl(llvm::dwarf::DW_TAG_structure_type,
|
diForwardDecl = DbgCreateSizedForwardDecl(llvm::dwarf::DW_TAG_structure_type,
|
||||||
|
@ -2080,7 +2073,7 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDefine)
|
||||||
{
|
{
|
||||||
// Will fill in later (during definition phase)
|
// Will fill in later (during definition phase)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
diForwardDecl = DbgCreateReplaceableCompositeType(isPrimEnum ? llvm::dwarf::DW_TAG_enumeration_type : llvm::dwarf::DW_TAG_structure_type,
|
diForwardDecl = DbgCreateReplaceableCompositeType(llvm::dwarf::DW_TAG_structure_type,
|
||||||
typeName, curDIScope, fileDIScope, 0, (int64)BF_ALIGN(typeInstance->mInstSize, typeInstance->mInstAlign) * 8, (int64)typeInstance->mInstAlign * 8, flags);
|
typeName, curDIScope, fileDIScope, 0, (int64)BF_ALIGN(typeInstance->mInstSize, typeInstance->mInstAlign) * 8, (int64)typeInstance->mInstAlign * 8, flags);
|
||||||
|
|
||||||
|
|
||||||
|
@ -2549,11 +2542,11 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||||
if (typeInstance->IsTypedPrimitive())
|
if (typeInstance->IsTypedPrimitive())
|
||||||
declaredBaseType = typeInstance->GetUnderlyingType();
|
declaredBaseType = typeInstance->GetUnderlyingType();
|
||||||
|
|
||||||
if (isPrimEnum)
|
/*if (isPrimEnum)
|
||||||
{
|
{
|
||||||
// Handled below
|
// Handled below
|
||||||
}
|
}
|
||||||
else if (type->IsBoxed())
|
else*/ if (type->IsBoxed())
|
||||||
{
|
{
|
||||||
auto underlyingType = ((BfBoxedType*)type)->GetModifiedElementType();
|
auto underlyingType = ((BfBoxedType*)type)->GetModifiedElementType();
|
||||||
if (!underlyingType->IsValuelessType())
|
if (!underlyingType->IsValuelessType())
|
||||||
|
@ -2572,12 +2565,6 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||||
diFieldTypes.push_back(memberType);
|
diFieldTypes.push_back(memberType);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if ((typeInstance->IsTypedPrimitive()) && (typeInstance->mBaseType != NULL) && (!typeInstance->mBaseType->IsTypedPrimitive()))
|
|
||||||
{
|
|
||||||
auto underlyingType = typeInstance->GetUnderlyingType();
|
|
||||||
auto inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(underlyingType), 0, llvm::DINode::FlagPublic);
|
|
||||||
diFieldTypes.push_back(inheritanceType);
|
|
||||||
}
|
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
auto baseType = typeInstance->mBaseType;
|
auto baseType = typeInstance->mBaseType;
|
||||||
|
@ -2592,6 +2579,21 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||||
inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(baseType), 0, llvm::DINode::FlagPublic);
|
inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(baseType), 0, llvm::DINode::FlagPublic);
|
||||||
diFieldTypes.push_back(inheritanceType);
|
diFieldTypes.push_back(inheritanceType);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Typed primitives are expressed as multiple inheritance
|
||||||
|
if ((typeInstance->IsTypedPrimitive()) && (typeInstance->mBaseType != NULL) && (!typeInstance->mBaseType->IsTypedPrimitive()))
|
||||||
|
{
|
||||||
|
auto underlyingType = typeInstance->GetUnderlyingType();
|
||||||
|
// auto inheritanceType = DbgCreateInheritance(diForwardDecl, DbgGetType(underlyingType), 0, llvm::DINode::FlagPublic);
|
||||||
|
// diFieldTypes.push_back(inheritanceType);
|
||||||
|
|
||||||
|
int lineNum = 0;
|
||||||
|
int flags = llvm::DINode::FlagPublic;
|
||||||
|
auto memberType = DbgCreateMemberType(fileDIScope, "$prim", fileDIScope, lineNum,
|
||||||
|
underlyingType->mSize * 8, underlyingType->mAlign * 8, 0,
|
||||||
|
flags, DbgGetType(underlyingType));
|
||||||
|
diFieldTypes.push_back(memberType);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
BfIRMDNode derivedFrom;
|
BfIRMDNode derivedFrom;
|
||||||
|
@ -2622,7 +2624,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||||
int diFlags = 0;
|
int diFlags = 0;
|
||||||
|
|
||||||
BfIRMDNode diType;
|
BfIRMDNode diType;
|
||||||
if ((typeInstance->IsEnum()) && (typeInstance->IsTypedPrimitive()))
|
/*if ((typeInstance->IsEnum()) && (typeInstance->IsTypedPrimitive()))
|
||||||
{
|
{
|
||||||
llvm::SmallVector<BfIRMDNode, 8> diEnumValues;
|
llvm::SmallVector<BfIRMDNode, 8> diEnumValues;
|
||||||
|
|
||||||
|
@ -2644,7 +2646,7 @@ void BfIRBuilder::CreateDbgTypeDefinition(BfType* type)
|
||||||
DbgSetType(type, diType);
|
DbgSetType(type, diType);
|
||||||
DbgSetInstType(type, diType);
|
DbgSetInstType(type, diType);
|
||||||
}
|
}
|
||||||
else
|
else*/
|
||||||
{
|
{
|
||||||
BfIRMDNode diCompositeType = DbgMakePermanent(diForwardDecl, BfIRMDNode(), diFieldTypes);
|
BfIRMDNode diCompositeType = DbgMakePermanent(diForwardDecl, BfIRMDNode(), diFieldTypes);
|
||||||
diType = diCompositeType;
|
diType = diCompositeType;
|
||||||
|
|
|
@ -3430,7 +3430,7 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
||||||
}
|
}
|
||||||
|
|
||||||
String findName = identifierNode->ToString();
|
String findName = identifierNode->ToString();
|
||||||
if (findName[0] == '$')
|
if ((findName[0] == '$') && (findName != "$prim"))
|
||||||
{
|
{
|
||||||
if (IsAutoCompleteNode(identifierNode))
|
if (IsAutoCompleteNode(identifierNode))
|
||||||
{
|
{
|
||||||
|
@ -3484,7 +3484,11 @@ DbgTypedValue DbgExprEvaluator::LookupIdentifier(BfAstNode* identifierNode, bool
|
||||||
if (findName[i] == '$')
|
if (findName[i] == '$')
|
||||||
mayBeRegister = false;
|
mayBeRegister = false;
|
||||||
if (mayBeRegister)
|
if (mayBeRegister)
|
||||||
return GetRegister(findName.Substring(1));
|
{
|
||||||
|
DbgTypedValue val = GetRegister(findName.Substring(1));
|
||||||
|
if (val)
|
||||||
|
return val;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
DbgTypedValue result;
|
DbgTypedValue result;
|
||||||
|
|
|
@ -1002,14 +1002,8 @@ bool DbgType::IsTypedPrimitive()
|
||||||
{
|
{
|
||||||
if (mTypeCode != DbgType_Struct)
|
if (mTypeCode != DbgType_Struct)
|
||||||
return false;
|
return false;
|
||||||
auto baseType = GetBaseType();
|
|
||||||
if (baseType == NULL)
|
return mTypeParam != NULL;
|
||||||
return false;
|
|
||||||
if (!baseType->IsPrimitiveType() && !baseType->IsTypedPrimitive())
|
|
||||||
return false;
|
|
||||||
if (mTypeParam == NULL)
|
|
||||||
mTypeParam = baseType;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bool DbgType::IsBoolean()
|
bool DbgType::IsBoolean()
|
||||||
|
@ -5007,9 +5001,6 @@ void DbgModule::CommitHotTargetSections()
|
||||||
|
|
||||||
void DbgModule::HotReplaceType(DbgType* newType)
|
void DbgModule::HotReplaceType(DbgType* newType)
|
||||||
{
|
{
|
||||||
if (!newType->IsCompositeType())
|
|
||||||
return;
|
|
||||||
|
|
||||||
auto linkedModule = GetLinkedModule();
|
auto linkedModule = GetLinkedModule();
|
||||||
|
|
||||||
newType->PopulateType();
|
newType->PopulateType();
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue