Debug bridge improvements

This commit is contained in:
Yoshi Askharoun
2022-06-07 14:30:29 -05:00
parent 649cab5d8d
commit 3700afad88
8 changed files with 91 additions and 20 deletions
@@ -8,5 +8,12 @@ namespace Microsoft.Iris.Debug
public bool OpenDebugPipe { get; set; } = false;
public List<System.Xml.XmlDocument> DecompileResults { get; } = new List<System.Xml.XmlDocument>();
public TraceSettings TraceSettings { get; } = TraceSettings.Current;
public Bridge Bridge { get; } =
#if ZUNE
new(OwlCore.Remoting.RemotingMode.Host);
#else
new();
#endif
}
}
+21 -5
View File
@@ -840,9 +840,6 @@ namespace Microsoft.Iris.Markup
}
}
public static System.Collections.Generic.List<OpCode> ExecutedOpCodes { get; set; }
= new System.Collections.Generic.List<OpCode>();
/// <summary>
/// Attempts to generate source UIX from a compiled result
/// </summary>
@@ -883,7 +880,8 @@ namespace Microsoft.Iris.Markup
while (!flag)
{
OpCode opCode = (OpCode)reader.ReadByte();
ExecutedOpCodes.Add(opCode);
var entry = new Debug.Data.InterpreterEntry(opCode);
switch (opCode)
{
case OpCode.ConstructObject:
@@ -898,6 +896,9 @@ namespace Microsoft.Iris.Markup
typeName = typeName.Substring(0, idxTilde);
var objXml = XmlDoc.CreateElement(typeName);
entry.Arguments.Add(new Debug.Data.OpCodeArgument(
"type", typeof(TypeSchema), typeSchema));
ReportErrorOnNull(obj, "Construction", typeSchema.Name);
if (!ErrorsDetected(watermark, ref result, ref flag))
{
@@ -1034,10 +1035,16 @@ namespace Microsoft.Iris.Markup
{
int num8 = reader.ReadUInt16();
SymbolReference symbolRef = symbolReferenceTable[num8];
entry.Arguments.Add(new Debug.Data.OpCodeArgument(
"symbolRef", typeof(SymbolReference), symbolRef));
object obj8 = context.ReadSymbol(symbolRef);
var objXml8 = XmlDoc.CreateElement(obj8.GetType().Name);
stack.Push(obj8);
xmlStack.Push(objXml8);
entry.ReturnValues.Add(obj8);
if (Trace.IsCategoryEnabled(TraceCategory.Markup))
{
}
@@ -1049,7 +1056,14 @@ namespace Microsoft.Iris.Markup
object value = (opCode == OpCode.WriteSymbolPeek) ? stack.Peek() : stack.Pop();
int num9 = reader.ReadUInt16();
SymbolReference symbolRef2 = symbolReferenceTable[num9];
entry.Arguments.Add(new Debug.Data.OpCodeArgument(
"symbolRef", typeof(SymbolReference), symbolRef2));
entry.Arguments.Add(new Debug.Data.OpCodeArgument(
"value", typeof(object), value));
context.WriteSymbol(symbolRef2, value);
if (Trace.IsCategoryEnabled(TraceCategory.Markup))
{
}
@@ -1549,10 +1563,12 @@ namespace Microsoft.Iris.Markup
}
}
Application.DebugSettings.Bridge.LogInterpreterOpCode(opCode, entry);
if (stack.Count != xmlStack.Count)
throw new InvalidOperationException(
$"Invalid stacks, stack:{stack.Count} != xmlStack{xmlStack.Count}! " +
$"Check implementations for {opCode} and {ExecutedOpCodes[ExecutedOpCodes.Count - 2]}");
$"Check implementations for {opCode}");
}
while (stack.Count > count)
{
+1 -5
View File
@@ -175,10 +175,6 @@ namespace Microsoft.Iris.Queues
}
}
#if ZUNE5
private static Bridge Bridge { get; } = new(OwlCore.Remoting.RemotingMode.Host);
#endif
/// <summary>
/// Sends a message via <see cref="debugPipe"/>
/// </summary>
@@ -186,7 +182,7 @@ namespace Microsoft.Iris.Queues
public static void SendDebugMessage(string message)
{
#if ZUNE5
Bridge.LogDispatcher(message);
Application.DebugSettings.Bridge.LogDispatcher(message);
#else
if (Application.DebugSettings.OpenDebugPipe && DebugPipe.IsConnected && DebugPipe.CanWrite)
{