From 1b26ce4d5f2a3bb9f3009c65f108c33073101131 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Tue, 23 May 2023 20:28:19 -0500 Subject: [PATCH] Add new, more robust Breakpoint struct --- UIX/Microsoft/Iris/Debug/Breakpoint.cs | 29 +++++++++++++++++++++++ UIX/Microsoft/Iris/Debug/DebugSettings.cs | 4 ++-- UIX/Microsoft/Iris/Markup/Interpreter.cs | 2 +- 3 files changed, 32 insertions(+), 3 deletions(-) create mode 100644 UIX/Microsoft/Iris/Debug/Breakpoint.cs diff --git a/UIX/Microsoft/Iris/Debug/Breakpoint.cs b/UIX/Microsoft/Iris/Debug/Breakpoint.cs new file mode 100644 index 0000000..a61dc37 --- /dev/null +++ b/UIX/Microsoft/Iris/Debug/Breakpoint.cs @@ -0,0 +1,29 @@ +using System; + +namespace Microsoft.Iris.Debug; + +public struct Breakpoint : IEquatable +{ + public Breakpoint(string uri, int line, int column) + { + Uri = uri; + Line = line; + Column = column; + } + + public string Uri { get; set; } + + public int Line { get; set; } + + public int Column { get; set; } + + public bool Equals(string uri, int line, int column) => uri == Uri && line == Line && column == Column; + + public bool Equals(Breakpoint other) => Equals(other.Uri, other.Line, other.Column); + + public static bool operator ==(Breakpoint left, Breakpoint right) => left.Equals(right); + + public static bool operator !=(Breakpoint left, Breakpoint right) => !(left == right); + + public override bool Equals(object obj) => obj is Breakpoint bp && Equals(bp); +} diff --git a/UIX/Microsoft/Iris/Debug/DebugSettings.cs b/UIX/Microsoft/Iris/Debug/DebugSettings.cs index d3a5018..e6d12f8 100644 --- a/UIX/Microsoft/Iris/Debug/DebugSettings.cs +++ b/UIX/Microsoft/Iris/Debug/DebugSettings.cs @@ -20,7 +20,7 @@ namespace Microsoft.Iris.Debug public bool GenerateDataMappingModels { get; set; } = false; public DataMappingModelsList DataMappingModels { get; } = new DataMappingModelsList(); - public List Breakpoints { get; } = new List(); + public List Breakpoints { get; } = new(); public string DebugConnectionUri { get; set; } } @@ -39,7 +39,7 @@ namespace Microsoft.Iris.Debug public class DataMappingModel { - internal DataMappingModel(string provider, string type, string generatedCode) + public DataMappingModel(string provider, string type, string generatedCode) { Provider = provider; Type = type; diff --git a/UIX/Microsoft/Iris/Markup/Interpreter.cs b/UIX/Microsoft/Iris/Markup/Interpreter.cs index 7a6680e..9f0b7e7 100644 --- a/UIX/Microsoft/Iris/Markup/Interpreter.cs +++ b/UIX/Microsoft/Iris/Markup/Interpreter.cs @@ -26,7 +26,7 @@ namespace Microsoft.Iris.Markup byteCodeReader = context.LoadResult.ObjectSection; num = (long)(ulong)byteCodeReader.CurrentOffset; byteCodeReader.CurrentOffset = context.InitialBytecodeOffset; - if (Application.DebugSettings.UseDecompiler || Application.DebugSettings.Breakpoints.Contains(context.ToString())) + if (Application.DebugSettings.UseDecompiler) result = RunDecompile(context, byteCodeReader); else result = Run(context, byteCodeReader);