From 55815fe59d1473c620da082573bd6656139c0030 Mon Sep 17 00:00:00 2001 From: Yoshi Askharoun Date: Sat, 27 Sep 2025 02:22:15 -0500 Subject: [PATCH] [WIP] Add debug symbol models --- .../Debug/Symbols/ApplicationDebugSymbols.cs | 46 +++++++++++++++++++ .../Debug/Symbols/DebugSymbolsJsonParser.cs | 14 ++++++ 2 files changed, 60 insertions(+) create mode 100644 UIX/Microsoft/Iris/Debug/Symbols/ApplicationDebugSymbols.cs create mode 100644 UIX/Microsoft/Iris/Debug/Symbols/DebugSymbolsJsonParser.cs diff --git a/UIX/Microsoft/Iris/Debug/Symbols/ApplicationDebugSymbols.cs b/UIX/Microsoft/Iris/Debug/Symbols/ApplicationDebugSymbols.cs new file mode 100644 index 0000000..f86d39a --- /dev/null +++ b/UIX/Microsoft/Iris/Debug/Symbols/ApplicationDebugSymbols.cs @@ -0,0 +1,46 @@ +using System; +using System.Collections.Generic; +using System.Diagnostics; + +namespace Microsoft.Iris.Debug.Symbols; + +public class ApplicationDebugSymbols +{ + public List Files { get; set; } +} + +public class FileDebugSymbols +{ + public string SourceFileName { get; set; } + + public string CompiledFileName { get; set; } + + public Dictionary ScriptSymbols { get; set; } +} + +public class ScriptDebugSymbols +{ + public string SourceCode { get; set; } + + public Dictionary SourceMap { get; set; } +} + +[DebuggerDisplay("[{Start}..{End}]")] +public class SourceSpan +{ + public SourceSpan(int start, int end) + { + if (start > end) + throw new ArgumentException($"Source start index must be at or after end index."); + + Start = start; + End = end; + } + + public int Start { get; set; } + + public int End { get; set; } + + public int GetLength() => End - Start; +} + diff --git a/UIX/Microsoft/Iris/Debug/Symbols/DebugSymbolsJsonParser.cs b/UIX/Microsoft/Iris/Debug/Symbols/DebugSymbolsJsonParser.cs new file mode 100644 index 0000000..0331f59 --- /dev/null +++ b/UIX/Microsoft/Iris/Debug/Symbols/DebugSymbolsJsonParser.cs @@ -0,0 +1,14 @@ +using Newtonsoft.Json; + +namespace Microsoft.Iris.Debug.Symbols; + +public static class DebugSymbolsJsonParser +{ + public static ApplicationDebugSymbols ParseForApplication(string json) => JsonConvert.DeserializeObject(json); + + public static FileDebugSymbols ParseForFile(string json) => JsonConvert.DeserializeObject(json); + + public static string Serialize(ApplicationDebugSymbols symbols) => JsonConvert.SerializeObject(symbols); + + public static string Serialize(FileDebugSymbols symbols) => JsonConvert.SerializeObject(symbols); +}