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

Comptime debugging fix with non-incremental builds (ie: Release)

This commit is contained in:
Brian Fiete 2022-03-21 11:14:19 -07:00
parent cab7f3cdb7
commit 18794e7db6
3 changed files with 25 additions and 12 deletions

View file

@ -14,6 +14,7 @@ namespace IDE
case Normal; case Normal;
case RunAfter; case RunAfter;
case DebugAfter; case DebugAfter;
case DebugComptime;
case Test; case Test;
public bool WantsRunAfter public bool WantsRunAfter

View file

@ -4282,8 +4282,14 @@ namespace IDE
return disassemblyPanel; return disassemblyPanel;
} }
[IDECommand] [IDECommand]
void Compile() void Compile()
{
Compile(.Normal);
}
void Compile(CompileKind compileKind)
{ {
CompilerLog("IDEApp.Compile"); CompilerLog("IDEApp.Compile");
for (let project in gApp.mWorkspace.mProjects) for (let project in gApp.mWorkspace.mProjects)
@ -4343,11 +4349,11 @@ namespace IDE
if (mExecutionQueue.Count == 0) if (mExecutionQueue.Count == 0)
{ {
mOutputPanel.Clear(); mOutputPanel.Clear();
if (mDebugger?.mIsComptimeDebug == true) if (compileKind == .DebugComptime)
OutputLine("Compiling with comptime debugging..."); OutputLine("Compiling with comptime debugging...");
else else
OutputLine("Compiling..."); OutputLine("Compiling...");
Compile(.Normal, null); Compile(compileKind, null);
} }
} }
else else
@ -4355,7 +4361,7 @@ namespace IDE
mOutputPanel.Clear(); mOutputPanel.Clear();
OutputLine("Hot Compiling..."); OutputLine("Hot Compiling...");
Project runningProject = mWorkspace.mStartupProject; Project runningProject = mWorkspace.mStartupProject;
Compile(.Normal, runningProject); Compile(compileKind, runningProject);
} }
} }
@ -4461,12 +4467,7 @@ namespace IDE
return; return;
CheckDebugVisualizers(); CheckDebugVisualizers();
mTargetDidInitBreak = true; Compile(.DebugComptime);
mTargetStartWithStep = false;
mDebugger.ComptimeAttach(mBfBuildCompiler);
mDebugger.RehupBreakpoints(true);
mBfBuildCompiler.ForceRebuild();
Compile();
} }
[IDECommand] [IDECommand]
@ -10730,7 +10731,7 @@ namespace IDE
mOutputPanel.Clear(); mOutputPanel.Clear();
OutputLine("Compiling..."); OutputLine("Compiling...");
if (!Compile(debug ? .DebugAfter : .RunAfter)) if (!Compile(debug ? .DebugAfter : .RunAfter, null))
return false; return false;
return true; return true;
} }
@ -10905,7 +10906,7 @@ namespace IDE
} }
} }
protected bool Compile(CompileKind compileKind = .Normal, Project hotProject = null) protected bool Compile(CompileKind compileKind, Project hotProject)
{ {
Debug.Assert(mBuildContext == null); Debug.Assert(mBuildContext == null);
@ -11145,6 +11146,15 @@ namespace IDE
} }
} }
if (compileKind == .DebugComptime)
{
mTargetDidInitBreak = true;
mTargetStartWithStep = false;
mDebugger.ComptimeAttach(mBfBuildCompiler);
mDebugger.RehupBreakpoints(true);
mBfBuildCompiler.ForceRebuild();
}
bool lastCompileHadMessages = mLastCompileHadMessages; bool lastCompileHadMessages = mLastCompileHadMessages;
mLastCompileFailed = false; mLastCompileFailed = false;
mLastCompileSucceeded = false; mLastCompileSucceeded = false;
@ -11164,7 +11174,7 @@ namespace IDE
if ((mDebugger != null) && (mDebugger.mIsRunning) && (hotProject == null)) if ((mDebugger != null) && (mDebugger.mIsRunning) && (hotProject == null))
{ {
Debug.Assert(!mDebugger.mIsRunningCompiled); Debug.Assert(!mDebugger.mIsRunningCompiled);
Debug.Assert(compileKind == .Normal); Debug.Assert((compileKind == .Normal) || (compileKind == .DebugComptime));
} }
mHaveSourcesChangedExternallySinceLastCompile = false; mHaveSourcesChangedExternallySinceLastCompile = false;

View file

@ -8487,6 +8487,8 @@ CeMachine::CeMachine(BfCompiler* compiler)
CeMachine::~CeMachine() CeMachine::~CeMachine()
{ {
BF_ASSERT(mDebugger == NULL);
for (auto context : mContextList) for (auto context : mContextList)
delete context; delete context;