Forráskód Böngészése

Added @Script: support to breakpoints

Brian Fiete 1 éve
szülő
commit
2a2913f857
4 módosított fájl, 80 hozzáadás és 15 törlés
  1. 13 0
      IDE/src/IDEApp.bf
  2. 46 3
      IDE/src/ScriptManager.bf
  3. 1 1
      IDE/src/ui/WatchPanel.bf
  4. 20 11
      IDEHelper/WinDebugger.cpp

+ 13 - 0
IDE/src/IDEApp.bf

@@ -13690,6 +13690,19 @@ namespace IDE
 					{
 					{
 						mSymSrvStatus.Set(param);
 						mSymSrvStatus.Set(param);
 					}
 					}
+					else if (cmd == "script")
+					{
+						String absTestPath = scope String();
+						if (mWorkspace.mDir != null)
+							Path.GetAbsolutePath(param, mWorkspace.mDir, absTestPath);
+						else
+							Path.GetFullPath(param, absTestPath);
+						if (mScriptManager.mFailed)
+							mScriptManager.Clear();
+						mScriptManager.mSoftFail = true;
+						mScriptManager.SetTimeoutMS(20*60*1000); // 20 minute timeout
+						mScriptManager.QueueCommandFile(absTestPath);
+					}
                     else
                     else
                     {
                     {
                         Runtime.FatalError("Invalid debugger message type");
                         Runtime.FatalError("Invalid debugger message type");

+ 46 - 3
IDE/src/ScriptManager.bf

@@ -1562,6 +1562,15 @@ namespace IDE
 			}
 			}
 		}
 		}
 
 
+		[IDECommand]
+		public void PrintEval(String evalStr)
+		{
+			String outVal = scope String();
+			if (!Evaluate(evalStr, outVal))
+				return;
+			gApp.OutputLineSmart(outVal);
+		}
+
 		[IDECommand]
 		[IDECommand]
 		public void AssertTypeInfo(int compilerId, String typeName, String wantTypeInfo)
 		public void AssertTypeInfo(int compilerId, String typeName, String wantTypeInfo)
 		{
 		{
@@ -1729,7 +1738,29 @@ namespace IDE
 		}
 		}
 
 
 		[IDECommand]
 		[IDECommand]
-		public void SelectCallStackWithStr(String str)
+		public void PrintCallStack()
+		{
+			gApp.OutputLine("Callstack:");
+			int32 stackIdx = 0;
+			while (true)
+			{
+				int stackCount = gApp.mDebugger.GetCallStackCount();
+				if (stackIdx >= stackCount)
+				{
+					gApp.mDebugger.UpdateCallStack();
+					if (stackIdx >= gApp.mDebugger.GetCallStackCount())
+						break;
+				}
+
+				String file = scope .();
+				String stackFrameInfo = scope .();
+				gApp.mDebugger.GetStackFrameInfo(stackIdx, var addr, file, stackFrameInfo);
+				gApp.OutputLine(scope $" {stackIdx}: {stackFrameInfo}");
+				stackIdx++;
+			}
+		}
+
+		public bool DoSelectCallStackWithStr(String str)
 		{
 		{
 			int32 stackIdx = 0;
 			int32 stackIdx = 0;
 			while (true)
 			while (true)
@@ -1748,12 +1779,24 @@ namespace IDE
 				if (stackFrameInfo.Contains(str))
 				if (stackFrameInfo.Contains(str))
 				{
 				{
 					gApp.mDebugger.mActiveCallStackIdx = (.)stackIdx;
 					gApp.mDebugger.mActiveCallStackIdx = (.)stackIdx;
-					return;
+					return true;
 				}
 				}
 				stackIdx++;
 				stackIdx++;
 			}
 			}
+			return false;
+		}
 
 
-			mScriptManager.Fail("Failed to find stack frame containing string '{}'", str);
+		[IDECommand]
+		public void SelectCallStackWithStr(String str)
+		{
+			if (!DoSelectCallStackWithStr(str))
+				mScriptManager.Fail("Failed to find stack frame containing string '{}'", str);
+		}
+
+		[IDECommand]
+		public void TrySelectCallStackWithStr(String str)
+		{
+			DoSelectCallStackWithStr(str);
 		}
 		}
 
 
 		public bool AssertRunning()
 		public bool AssertRunning()

+ 1 - 1
IDE/src/ui/WatchPanel.bf

@@ -2859,7 +2859,7 @@ namespace IDE.ui
 
 
 			base.UpdateAll();
 			base.UpdateAll();
 			if (mWantRemoveSelf)
 			if (mWantRemoveSelf)
-				mParentItem.RemoveChildItem(this);
+				mParentItem?.RemoveChildItem(this);
 
 
 			if (mColumnIdx == 0)
 			if (mColumnIdx == 0)
 			{
 			{

+ 20 - 11
IDEHelper/WinDebugger.cpp

@@ -4092,22 +4092,31 @@ bool WinDebugger::CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubpro
 
 
 		String expr;
 		String expr;
 		_SplitExpr(headBreakpoint->mLogging, expr, formatInfo.mSubjectExpr);
 		_SplitExpr(headBreakpoint->mLogging, expr, formatInfo.mSubjectExpr);
-		if (expr.StartsWith("@Beef:"))
+
+		if (expr.StartsWith("@Script:"))
 		{
 		{
-			expr.Remove(0, 6);
-			formatInfo.mLanguage = DbgLanguage_Beef;
+			displayString = "script ";
+			displayString += expr.Substring(8);
 		}
 		}
-		else if (expr.StartsWith("@C:"))
+		else
 		{
 		{
-			expr.Remove(0, 3);
-			formatInfo.mLanguage = DbgLanguage_C;
-		}
+			if (expr.StartsWith("@Beef:"))
+			{
+				expr.Remove(0, 6);
+				formatInfo.mLanguage = DbgLanguage_Beef;
+			}
+			else if (expr.StartsWith("@C:"))
+			{
+				expr.Remove(0, 3);
+				formatInfo.mLanguage = DbgLanguage_C;
+			}
 
 
-		ProcessEvalString(dbgCompileUnit, DbgTypedValue(), expr, displayString, formatInfo, NULL, false);
-		mRunState = prevRunState;
+			ProcessEvalString(dbgCompileUnit, DbgTypedValue(), expr, displayString, formatInfo, NULL, false);
+			mRunState = prevRunState;
 
 
-		displayString.Insert(0, "log ");
-		displayString.Append("\n");
+			displayString.Insert(0, "log ");
+			displayString.Append("\n");
+		}
 
 
 		mDebugManager->mOutMessages.push_back(displayString);
 		mDebugManager->mOutMessages.push_back(displayString);