mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
Allow interpreter breakpoints to check for multiple URIs
This commit is contained in:
@@ -1,4 +1,7 @@
|
||||
using System;
|
||||
using Microsoft.Iris.Markup;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
namespace Microsoft.Iris.Debug.Data;
|
||||
@@ -33,9 +36,15 @@ public struct Breakpoint : IEquatable<Breakpoint>
|
||||
|
||||
public bool Enabled { get; set; }
|
||||
|
||||
public bool Equals(string uri, int line, int column, uint offset = uint.MaxValue)
|
||||
public bool Equals(LoadResult loadResult, int line, int column, uint offset = uint.MaxValue)
|
||||
{
|
||||
if (!Uri.Equals(uri, StringComparison.OrdinalIgnoreCase))
|
||||
return Equals([loadResult.Uri, loadResult.UnderlyingUri], line, column, offset);
|
||||
}
|
||||
|
||||
public bool Equals(IEnumerable<string> uris, int line, int column, uint offset = uint.MaxValue)
|
||||
{
|
||||
var thisUri = Uri;
|
||||
if (uris.Any(uri => !thisUri.Equals(uri, StringComparison.OrdinalIgnoreCase)))
|
||||
return false;
|
||||
|
||||
if (Offset != uint.MaxValue && offset != uint.MaxValue)
|
||||
@@ -44,7 +53,7 @@ public struct Breakpoint : IEquatable<Breakpoint>
|
||||
return line == Line && column == Column;
|
||||
}
|
||||
|
||||
public bool Equals(Breakpoint other) => Equals(other.Uri, other.Line, other.Column);
|
||||
public bool Equals(Breakpoint other) => Equals([other.Uri], other.Line, other.Column);
|
||||
|
||||
public static bool operator ==(Breakpoint left, Breakpoint right) => left.Equals(right);
|
||||
|
||||
|
||||
@@ -78,11 +78,12 @@ namespace Microsoft.Iris.Markup
|
||||
Application.Debugger.LogInterpreterDecode(context, entry.Instruction);
|
||||
|
||||
// Fetch line and column numbers from the table
|
||||
uint offset = entry.Instruction.Offset;
|
||||
int line = -1, column = -1;
|
||||
context.LoadResult.LineNumberTable.TryLookup(entry.Instruction.Offset, out line, out column);
|
||||
context.LoadResult.LineNumberTable.TryLookup(offset, out line, out column);
|
||||
|
||||
bool ShouldBreak(Breakpoint b) =>
|
||||
b.Enabled && b.Equals(loadResult.Uri, line, column, entry.Instruction.Offset);
|
||||
b.Enabled && b.Equals(loadResult, line, column, offset);
|
||||
|
||||
// Check if a breakpoint has been set at this location
|
||||
bool shouldBreakHere = Application.DebugSettings.Breakpoints.Any(ShouldBreak);
|
||||
|
||||
Reference in New Issue
Block a user