Allow interpreter breakpoints to check for multiple URIs

This commit is contained in:
Joshua "Yoshi" Askharoun
2025-12-05 20:00:00 -06:00
parent 1ab545d4e2
commit d87e9d33db
2 changed files with 16 additions and 6 deletions
+13 -4
View File
@@ -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);
+3 -2
View File
@@ -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);