1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 03:28:20 +02:00

Soft error on some malformed PDB cases

This commit is contained in:
Brian Fiete 2022-04-22 19:19:43 -07:00
parent cf6ade5e45
commit 1abccdedf8
6 changed files with 48 additions and 7 deletions

View file

@ -12860,7 +12860,7 @@ namespace IDE
deferredOutput.Append(param);
}
else if (cmd == "error")
else if ((cmd == "error") || (cmd == "errorsoft"))
{
if ((mRunningTestScript) && (!IsCrashDump) && (!mScriptManager.IsErrorExpected(param, false)))
mScriptManager.Fail(param);
@ -12944,7 +12944,7 @@ namespace IDE
}
OutputLineSmart(scope String("ERROR: ", scope String(errorMsg)));
if (gApp.mRunningTestScript)
if ((gApp.mRunningTestScript) || (cmd == "errorsoft"))
{
// The 'OutputLineSmart' would already call 'Fail' when running test scripts
}

View file

@ -773,7 +773,7 @@ DbgSubprogram* COFF::CvParseMethod(DbgType* parentType, const char* methodName,
}
else
{
Fail(StrFormat("Unhandled func type at tagId %d ipi %d", tagIdx, ipi));
SoftFail(StrFormat("Unhandled func type at tagId %d ipi %d", tagIdx, ipi));
}
@ -996,6 +996,12 @@ void COFF::CvParseMembers(DbgType* parentType, int tagIdx, bool ipi)
CvAutoReleaseTempData releaseTempData(this, listData);
int16 trLeafType = GET_FROM(listData, int16);
if (trLeafType != LF_METHODLIST)
{
SoftFail("Invalid LF_METHOD member");
return;
}
BF_ASSERT(trLeafType == LF_METHODLIST);
for (int methodIdx = 0; methodIdx < count; methodIdx++)
@ -1178,7 +1184,8 @@ void COFF::CvParseMembers(DbgType* parentType, int tagIdx, bool ipi)
}
break;
default:
HardFail(StrFormat("Unhandled leaf id 0x%X", leafType));
SoftFail(StrFormat("Unhandled leaf id 0x%X", leafType));
return;
}
PTR_ALIGN(data, sectionStart, 4);
@ -5831,6 +5838,11 @@ void COFF::Fail(const StringImpl& error)
DbgModule::Fail(StrFormat("%s in %s", error.c_str(), mPDBPath.c_str()));
}
void COFF::SoftFail(const StringImpl& error)
{
DbgModule::SoftFail(StrFormat("%s in %s", error.c_str(), mPDBPath.c_str()));
}
void COFF::HardFail(const StringImpl& error)
{
DbgModule::HardFail(StrFormat("%s in %s", error.c_str(), mPDBPath.c_str()));
@ -6444,7 +6456,7 @@ intptr COFF::EvaluateLocation(DbgSubprogram* dwSubprogram, const uint8* locData,
break;
default:
if (!mFailed)
Fail(StrFormat("Unknown symbol type '0x%X' in EvaluateLocation", symType));
SoftFail(StrFormat("Unknown symbol type '0x%X' in EvaluateLocation", symType));
return 0;
}
@ -7192,7 +7204,7 @@ void COFF::ParseFrameDescriptors(uint8* data, int size, addr_target baseAddr)
else
{
failed = true;
Fail(StrFormat("Invalid COFF frame program: %s", curCmd.c_str()));
SoftFail(StrFormat("Invalid COFF frame program: %s", curCmd.c_str()));
}
}
if (c == 0)

View file

@ -297,6 +297,7 @@ public:
public:
virtual void Fail(const StringImpl& error) override;
virtual void SoftFail(const StringImpl& error);
virtual void HardFail(const StringImpl& error) override;
virtual void ParseGlobalsData() override;

View file

@ -2313,6 +2313,28 @@ void DbgModule::Fail(const StringImpl& error)
mFailed = true;
}
void DbgModule::SoftFail(const StringImpl& error)
{
if (mFailMsgPtr != NULL)
{
if (mFailMsgPtr->IsEmpty())
*mFailMsgPtr = error;
}
String errorStr = "errorsoft ";
if (!mFilePath.IsEmpty())
{
errorStr += "Error in ";
errorStr += mFilePath;
errorStr += ": ";
}
errorStr += error;
errorStr += "\n";
mDebugger->OutputRawMessage(errorStr);
mFailed = true;
}
void DbgModule::HardFail(const StringImpl& error)
{
if (mFailMsgPtr != NULL)

View file

@ -1232,8 +1232,9 @@ public:
virtual addr_target LocateSymbol(const StringImpl& name) { return 0; }
virtual DbgSubprogram* FindSubprogram(DbgType* dbgType, const char* methodName);
const char* GetStringTable(DataStream* stream, int stringTablePos);
virtual void Fail(const StringImpl& error);
virtual void SoftFail(const StringImpl& error);
virtual void HardFail(const StringImpl& error);
void FindTemplateStr(const char*& name, int& templateNameIdx);
void TempRemoveTemplateStr(const char*& name, int& templateNameIdx);

View file

@ -9508,6 +9508,9 @@ static void PdbTestFile(WinDebugger* debugger, const StringImpl& path)
coffFile.ParseTypeData();
coffFile.ParseSymbolData();
coffFile.ParseGlobalsData();
for (int i = 0; i < coffFile.mTypes.mSize; i++)
coffFile.mTypes[i]->PopulateType();
}
static void PdbTest(WinDebugger* debugger, const StringImpl& path)
@ -9622,6 +9625,8 @@ String WinDebugger::Evaluate(const StringImpl& expr, DwFormatInfo formatInfo, in
{
PdbTest(this, "c:\\");
}
else if (cmd.StartsWith("!pdbtest "))
PdbTestFile(this, cmd.Substring(9));
}
}