mirror of
https://github.com/ZuneDev/MicrosoftIris.git
synced 2026-07-27 13:13:29 -07:00
[WIP] Add debug symbol models
This commit is contained in:
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace Microsoft.Iris.Debug.Symbols;
|
||||
|
||||
public class ApplicationDebugSymbols
|
||||
{
|
||||
public List<FileDebugSymbols> Files { get; set; }
|
||||
}
|
||||
|
||||
public class FileDebugSymbols
|
||||
{
|
||||
public string SourceFileName { get; set; }
|
||||
|
||||
public string CompiledFileName { get; set; }
|
||||
|
||||
public Dictionary<uint, ScriptDebugSymbols> ScriptSymbols { get; set; }
|
||||
}
|
||||
|
||||
public class ScriptDebugSymbols
|
||||
{
|
||||
public string SourceCode { get; set; }
|
||||
|
||||
public Dictionary<uint, SourceSpan> 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;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,14 @@
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Microsoft.Iris.Debug.Symbols;
|
||||
|
||||
public static class DebugSymbolsJsonParser
|
||||
{
|
||||
public static ApplicationDebugSymbols ParseForApplication(string json) => JsonConvert.DeserializeObject<ApplicationDebugSymbols>(json);
|
||||
|
||||
public static FileDebugSymbols ParseForFile(string json) => JsonConvert.DeserializeObject<FileDebugSymbols>(json);
|
||||
|
||||
public static string Serialize(ApplicationDebugSymbols symbols) => JsonConvert.SerializeObject(symbols);
|
||||
|
||||
public static string Serialize(FileDebugSymbols symbols) => JsonConvert.SerializeObject(symbols);
|
||||
}
|
||||
Reference in New Issue
Block a user