From d87e9d33dbd0c441b476aa8e040840062d1c1699 Mon Sep 17 00:00:00 2001 From: "Joshua \"Yoshi\" Askharoun" Date: Fri, 5 Dec 2025 20:00:00 -0600 Subject: [PATCH] Allow interpreter breakpoints to check for multiple URIs --- UIX/Microsoft/Iris/Debug/Data/Breakpoint.cs | 17 +++++++++++++---- UIX/Microsoft/Iris/Markup/Interpreter.cs | 5 +++-- 2 files changed, 16 insertions(+), 6 deletions(-) diff --git a/UIX/Microsoft/Iris/Debug/Data/Breakpoint.cs b/UIX/Microsoft/Iris/Debug/Data/Breakpoint.cs index 04aafe1..75d0bd5 100644 --- a/UIX/Microsoft/Iris/Debug/Data/Breakpoint.cs +++ b/UIX/Microsoft/Iris/Debug/Data/Breakpoint.cs @@ -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 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 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 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); diff --git a/UIX/Microsoft/Iris/Markup/Interpreter.cs b/UIX/Microsoft/Iris/Markup/Interpreter.cs index 02cbda3..deedeab 100644 --- a/UIX/Microsoft/Iris/Markup/Interpreter.cs +++ b/UIX/Microsoft/Iris/Markup/Interpreter.cs @@ -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);