1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-08 11:38:21 +02:00

Added @Script: support to breakpoints

This commit is contained in:
Brian Fiete 2024-08-25 09:30:49 -04:00
parent 2d8bf1b11b
commit 2a2913f857
4 changed files with 83 additions and 18 deletions

View file

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

View file

@ -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,14 +1779,26 @@ 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;
}
[IDECommand]
public void SelectCallStackWithStr(String str)
{
if (!DoSelectCallStackWithStr(str))
mScriptManager.Fail("Failed to find stack frame containing string '{}'", 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()
{ {
if (!gApp.mDebugger.mIsRunning) if (!gApp.mDebugger.mIsRunning)

View file

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

View file

@ -4092,6 +4092,14 @@ 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("@Script:"))
{
displayString = "script ";
displayString += expr.Substring(8);
}
else
{
if (expr.StartsWith("@Beef:")) if (expr.StartsWith("@Beef:"))
{ {
expr.Remove(0, 6); expr.Remove(0, 6);
@ -4108,6 +4116,7 @@ bool WinDebugger::CheckConditionalBreakpoint(WdBreakpoint* breakpoint, DbgSubpro
displayString.Insert(0, "log "); displayString.Insert(0, "log ");
displayString.Append("\n"); displayString.Append("\n");
}
mDebugManager->mOutMessages.push_back(displayString); mDebugManager->mOutMessages.push_back(displayString);