mirror of
https://github.com/beefytech/Beef.git
synced 2025-06-10 12:32:20 +02:00
Reworked partial debug definitions
This commit is contained in:
parent
9a5d563c6f
commit
f1e2148769
3 changed files with 46 additions and 27 deletions
|
@ -1462,11 +1462,7 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
|
||||||
int dataSize = (int)CvParseConstant(data);
|
int dataSize = (int)CvParseConstant(data);
|
||||||
|
|
||||||
const char* name = _ParseString();
|
const char* name = _ParseString();
|
||||||
|
|
||||||
if (strstr(name, "Derived") != NULL)
|
|
||||||
{
|
|
||||||
NOP;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if ((strstr(name, "`") != NULL) || (strstr(name, "::__l") != NULL))
|
// if ((strstr(name, "`") != NULL) || (strstr(name, "::__l") != NULL))
|
||||||
// {
|
// {
|
||||||
|
@ -1474,11 +1470,23 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
|
||||||
// }
|
// }
|
||||||
|
|
||||||
// Remove "enum " from type names
|
// Remove "enum " from type names
|
||||||
|
|
||||||
|
bool isPartialDef = false;
|
||||||
|
|
||||||
for (int i = 0; true; i++)
|
for (int i = 0; true; i++)
|
||||||
{
|
{
|
||||||
char c = name[i];
|
char c = name[i];
|
||||||
if (c == 0)
|
if (c == 0)
|
||||||
|
{
|
||||||
|
if ((i >= 4) && (strcmp(&name[i - 5], "$part") == 0))
|
||||||
|
{
|
||||||
|
if (!strMadeCopy)
|
||||||
|
name = DbgDupString(name, "CvParseType.LF_CLASS");
|
||||||
|
((char*)name)[i - 5] = '\0';
|
||||||
|
isPartialDef = true;
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
if ((c == ' ') && (i >= 5))
|
if ((c == ' ') && (i >= 5))
|
||||||
{
|
{
|
||||||
if ((name[i - 4] == 'e') &&
|
if ((name[i - 4] == 'e') &&
|
||||||
|
@ -1503,6 +1511,8 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
|
||||||
dbgType = CvCreateType();
|
dbgType = CvCreateType();
|
||||||
dbgType->mCompileUnit = mMasterCompileUnit;
|
dbgType->mCompileUnit = mMasterCompileUnit;
|
||||||
dbgType->mIsDeclaration = classInfo.property.fwdref;
|
dbgType->mIsDeclaration = classInfo.property.fwdref;
|
||||||
|
if (isPartialDef)
|
||||||
|
dbgType->mIsDeclaration = true;
|
||||||
dbgType->mName = name;
|
dbgType->mName = name;
|
||||||
dbgType->mTypeName = name;
|
dbgType->mTypeName = name;
|
||||||
//SplitName(dbgType->mName, dbgType->mTypeName, dbgType->mTemplateParams);
|
//SplitName(dbgType->mName, dbgType->mTypeName, dbgType->mTemplateParams);
|
||||||
|
@ -1511,6 +1521,8 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
|
||||||
else
|
else
|
||||||
dbgType->mTypeCode = DbgType_Struct;
|
dbgType->mTypeCode = DbgType_Struct;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
DbgType* baseType = NULL;
|
DbgType* baseType = NULL;
|
||||||
if (classInfo.derived != 0)
|
if (classInfo.derived != 0)
|
||||||
{
|
{
|
||||||
|
@ -1549,13 +1561,9 @@ DbgType* COFF::CvParseType(int tagIdx, bool ipi)
|
||||||
|
|
||||||
dbgType->mIsIncomplete = true;
|
dbgType->mIsIncomplete = true;
|
||||||
|
|
||||||
if (classInfo.field != 0)
|
// if (classInfo.field != 0)
|
||||||
dbgType->mDefinedMembersSize = CvGetTagSize(classInfo.field, ipi);
|
// dbgType->mDefinedMembersSize = CvGetTagSize(classInfo.field, ipi);
|
||||||
|
|
||||||
// This helps differentiate '
|
|
||||||
// if (classInfo.field != 0)
|
|
||||||
// dbgType->mDefinedMembersCount++;
|
|
||||||
|
|
||||||
//CvParseMembers(dbgType, classInfo.field, sectionData);
|
//CvParseMembers(dbgType, classInfo.field, sectionData);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -1889,8 +1889,16 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
|
||||||
bool wantsDIForwardDecl = (type->GetModule() != mModule) && (!type->IsFunction());
|
bool wantsDIForwardDecl = (type->GetModule() != mModule) && (!type->IsFunction());
|
||||||
// Forward declarations of valuetypes don't work in LLVM backend for Win32.....
|
// Forward declarations of valuetypes don't work in LLVM backend for Win32.....
|
||||||
//TODO: Why was this commented out?
|
//TODO: Why was this commented out?
|
||||||
if ((!mIsBeefBackend) && (type->IsValueType()))
|
|
||||||
wantsDIForwardDecl = false;
|
bool wantsDIPartialDef = false;
|
||||||
|
if (wantsDIForwardDecl)
|
||||||
|
{
|
||||||
|
if ((!mIsBeefBackend) && (type->IsValueType()))
|
||||||
|
{
|
||||||
|
wantsDIPartialDef = true;
|
||||||
|
wantsDIForwardDecl = false;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (mModule->mExtensionCount != 0)
|
if (mModule->mExtensionCount != 0)
|
||||||
wantsDIForwardDecl = true;
|
wantsDIForwardDecl = true;
|
||||||
if (forceDbgDefine)
|
if (forceDbgDefine)
|
||||||
|
@ -2171,7 +2179,10 @@ void BfIRBuilder::CreateTypeDeclaration(BfType* type, bool forceDbgDefine)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
if (wantsDIPartialDef)
|
||||||
|
typeName += "$part";
|
||||||
|
|
||||||
// Will fill in later (during definition phase)
|
// Will fill in later (during definition phase)
|
||||||
int flags = 0;
|
int flags = 0;
|
||||||
diForwardDecl = DbgCreateReplaceableCompositeType(llvm::dwarf::DW_TAG_structure_type,
|
diForwardDecl = DbgCreateReplaceableCompositeType(llvm::dwarf::DW_TAG_structure_type,
|
||||||
|
|
|
@ -2856,22 +2856,22 @@ void DbgModule::MapTypes(int startingTypeIdx)
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
// if (prevType->mDefinedMembersSize > 0)
|
if (prevType->mDefinedMembersSize > 0)
|
||||||
// {
|
|
||||||
// if (dbgType->mDefinedMembersSize > 0)
|
|
||||||
// {
|
|
||||||
// // We create an 'alternates' list for all types that define at least one static field
|
|
||||||
// if (prevType->mHasStaticMembers)
|
|
||||||
// prevType->mAlternates.PushFront(dbgType, &mAlloc);
|
|
||||||
// }
|
|
||||||
// continue;
|
|
||||||
// }
|
|
||||||
|
|
||||||
if (prevType->mDefinedMembersSize > dbgType->mDefinedMembersSize)
|
|
||||||
{
|
{
|
||||||
|
if (dbgType->mDefinedMembersSize > 0)
|
||||||
|
{
|
||||||
|
// We create an 'alternates' list for all types that define at least one static field
|
||||||
|
if (prevType->mHasStaticMembers)
|
||||||
|
prevType->mAlternates.PushFront(dbgType, &mAlloc);
|
||||||
|
}
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// if (prevType->mDefinedMembersSize > dbgType->mDefinedMembersSize)
|
||||||
|
// {
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
|
|
||||||
if (prevType->mMethodsWithParamsCount > dbgType->mMethodsWithParamsCount)
|
if (prevType->mMethodsWithParamsCount > dbgType->mMethodsWithParamsCount)
|
||||||
{
|
{
|
||||||
// This handles a special case where methods without line data like <Enum>.HasFlags doesn't show containing
|
// This handles a special case where methods without line data like <Enum>.HasFlags doesn't show containing
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue