Quellcode durchsuchen

Soft error on some malformed PDB cases

Brian Fiete vor 3 Jahren
Ursprung
Commit
1abccdedf8
6 geänderte Dateien mit 48 neuen und 7 gelöschten Zeilen
  1. 2 2
      IDE/src/IDEApp.bf
  2. 16 4
      IDEHelper/COFF.cpp
  3. 1 0
      IDEHelper/COFF.h
  4. 22 0
      IDEHelper/DbgModule.cpp
  5. 2 1
      IDEHelper/DbgModule.h
  6. 5 0
      IDEHelper/WinDebugger.cpp

+ 2 - 2
IDE/src/IDEApp.bf

@@ -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
 									}

+ 16 - 4
IDEHelper/COFF.cpp

@@ -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)

+ 1 - 0
IDEHelper/COFF.h

@@ -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;

+ 22 - 0
IDEHelper/DbgModule.cpp

@@ -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)

+ 2 - 1
IDEHelper/DbgModule.h

@@ -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);

+ 5 - 0
IDEHelper/WinDebugger.cpp

@@ -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));
 		}
 	}