mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Fix interpreter crash when debugger is not attached
This commit is contained in:
@@ -72,10 +72,12 @@ namespace Microsoft.Iris.Markup
|
|||||||
while (!errorsDetected)
|
while (!errorsDetected)
|
||||||
{
|
{
|
||||||
OpCode opCode = (OpCode)reader.ReadByte();
|
OpCode opCode = (OpCode)reader.ReadByte();
|
||||||
InterpreterEntry entry = new(opCode, reader.CurrentOffset, loadResult.Uri);
|
InterpreterEntry entry = new(new(opCode, reader.CurrentOffset, loadResult.Uri));
|
||||||
|
|
||||||
|
if (debugging)
|
||||||
|
{
|
||||||
// Fetch line and column numbers from the table
|
// Fetch line and column numbers from the table
|
||||||
if (debugging && context.LoadResult.LineNumberTable.TryLookup(reader.CurrentOffset, out int line, out int column))
|
if (context.LoadResult.LineNumberTable.TryLookup(reader.CurrentOffset, out int line, out int column))
|
||||||
{
|
{
|
||||||
bool ShouldBreak(Breakpoint b)
|
bool ShouldBreak(Breakpoint b)
|
||||||
=> b.Enabled && b.Equals(loadResult.Uri, line, column, reader.CurrentOffset);
|
=> b.Enabled && b.Equals(loadResult.Uri, line, column, reader.CurrentOffset);
|
||||||
@@ -83,15 +85,17 @@ namespace Microsoft.Iris.Markup
|
|||||||
// Check if a breakpoint has been set at this location
|
// Check if a breakpoint has been set at this location
|
||||||
bool shouldBreakHere = Application.DebugSettings.Breakpoints.Any(ShouldBreak);
|
bool shouldBreakHere = Application.DebugSettings.Breakpoints.Any(ShouldBreak);
|
||||||
if (shouldBreakHere)
|
if (shouldBreakHere)
|
||||||
{
|
|
||||||
Application.Debugger.DebuggerCommand = InterpreterCommand.Break;
|
Application.Debugger.DebuggerCommand = InterpreterCommand.Break;
|
||||||
//System.Diagnostics.Debugger.Break();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Stop exeuction while the debugger is in break mode
|
||||||
while (Application.Debugger.DebuggerCommand == InterpreterCommand.Break) ;
|
while (Application.Debugger.DebuggerCommand == InterpreterCommand.Break) ;
|
||||||
|
|
||||||
|
// If the debugger requested a single step, immediately set the debugger
|
||||||
|
// to break again for the next instruction
|
||||||
if (Application.Debugger.DebuggerCommand == InterpreterCommand.Step)
|
if (Application.Debugger.DebuggerCommand == InterpreterCommand.Step)
|
||||||
Application.Debugger.DebuggerCommand = InterpreterCommand.Break;
|
Application.Debugger.DebuggerCommand = InterpreterCommand.Break;
|
||||||
|
}
|
||||||
|
|
||||||
switch (opCode)
|
switch (opCode)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user