Switched to DebugSettings

This commit is contained in:
Yoshi Askharoun
2022-06-06 23:10:30 -05:00
parent c1fe12288c
commit 8cb0b9dfdf
5 changed files with 17 additions and 7 deletions
+1 -1
View File
@@ -135,7 +135,7 @@ namespace Microsoft.Iris
get => DllResources.StaticDllResourcesOnly; get => DllResources.StaticDllResourcesOnly;
} }
public static bool IsDebug { get; set; } public static Debug.DebugSettings DebugSettings { get; set; }
public static void Initialize() public static void Initialize()
{ {
+12
View File
@@ -0,0 +1,12 @@
using System.Collections.Generic;
namespace Microsoft.Iris.Debug
{
public class DebugSettings
{
public bool UseDecompiler { get; set; } = false;
public bool OpenDebugPipe { get; set; } = false;
public List<System.Xml.XmlDocument> DecompileResults { get; } = new List<System.Xml.XmlDocument>();
public TraceSettings TraceSettings { get; } = TraceSettings.Current;
}
}
+2 -2
View File
@@ -25,7 +25,7 @@ namespace Microsoft.Iris.Markup
byteCodeReader = context.LoadResult.ObjectSection; byteCodeReader = context.LoadResult.ObjectSection;
num = (long)((ulong)byteCodeReader.CurrentOffset); num = (long)((ulong)byteCodeReader.CurrentOffset);
byteCodeReader.CurrentOffset = context.InitialBytecodeOffset; byteCodeReader.CurrentOffset = context.InitialBytecodeOffset;
if (InterpreterContext.UseDecompile) if (Application.DebugSettings.UseDecompiler)
result = RunDecompile(context, byteCodeReader); result = RunDecompile(context, byteCodeReader);
else else
result = Run(context, byteCodeReader); result = Run(context, byteCodeReader);
@@ -1561,7 +1561,7 @@ namespace Microsoft.Iris.Markup
} }
CleanUpXmlDoc(); CleanUpXmlDoc();
InterpreterContext.DecompileResults.Add(XmlDoc); Application.DebugSettings.DecompileResults.Add(XmlDoc);
return result; return result;
} }
@@ -19,8 +19,6 @@ namespace Microsoft.Iris.Markup
private ParameterContext _parameterContext; private ParameterContext _parameterContext;
private Map<object, object> _scopedLocals; private Map<object, object> _scopedLocals;
private static Stack s_cache = new Stack(); private static Stack s_cache = new Stack();
public static bool UseDecompile = false;
public static List<System.Xml.XmlDocument> DecompileResults = new List<System.Xml.XmlDocument>();
private InterpreterContext() private InterpreterContext()
{ {
+2 -2
View File
@@ -145,7 +145,7 @@ namespace Microsoft.Iris.Queues
{ {
get get
{ {
if (_debugPipe == null && Application.IsDebug) if (_debugPipe == null && Application.DebugSettings.OpenDebugPipe)
{ {
_debugPipe = new NamedPipeClientStream(System.Reflection.Assembly.GetExecutingAssembly().FullName); _debugPipe = new NamedPipeClientStream(System.Reflection.Assembly.GetExecutingAssembly().FullName);
_debugPipe.Connect(); _debugPipe.Connect();
@@ -180,7 +180,7 @@ namespace Microsoft.Iris.Queues
/// <param name="message"></param> /// <param name="message"></param>
public static void SendDebugMessage(string message) public static void SendDebugMessage(string message)
{ {
if (Application.IsDebug && DebugPipe.IsConnected && DebugPipe.CanWrite) if (Application.DebugSettings.OpenDebugPipe && DebugPipe.IsConnected && DebugPipe.CanWrite)
{ {
DebugPipe.WriteByte(0x01); DebugPipe.WriteByte(0x01);
byte[] buffer = System.Text.Encoding.Unicode.GetBytes(message); byte[] buffer = System.Text.Encoding.Unicode.GetBytes(message);