More decompiler fixes

This commit is contained in:
Yoshi Askharoun
2022-07-05 12:00:18 -05:00
parent 8074aef7b8
commit 62e3a05189
4 changed files with 43 additions and 21 deletions
+5 -5
View File
@@ -5,9 +5,9 @@ using System;
namespace Microsoft.Iris.Debug namespace Microsoft.Iris.Debug
{ {
[RemoteProperty] //[RemoteProperty]
[RemoteMethod] //[RemoteMethod]
[RemoteOptions(RemotingDirection.Bidirectional)] //[RemoteOptions(RemotingDirection.Bidirectional)]
public class Bridge : IBridge, IDisposable public class Bridge : IBridge, IDisposable
{ {
private readonly MemberRemote _memberRemote; private readonly MemberRemote _memberRemote;
@@ -24,13 +24,13 @@ namespace Microsoft.Iris.Debug
_memberRemote = new MemberRemote(this, typeof(Bridge).Assembly.FullName, handler); _memberRemote = new MemberRemote(this, typeof(Bridge).Assembly.FullName, handler);
} }
[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)] //[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)]
public void LogInterpreterOpCode(object context, Data.InterpreterEntry entry) public void LogInterpreterOpCode(object context, Data.InterpreterEntry entry)
{ {
InterpreterStep?.Invoke(context, new(entry)); InterpreterStep?.Invoke(context, new(entry));
} }
[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)] //[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)]
public void LogDispatcher(string message) public void LogDispatcher(string message)
{ {
DispatcherStep?.Invoke(message); DispatcherStep?.Invoke(message);
+5 -4
View File
@@ -22,13 +22,14 @@ namespace Microsoft.Iris.Debug.Data
public override string ToString() public override string ToString()
{ {
var args =
#if OPENZUNE #if OPENZUNE
Arguments; var args = Arguments;
var ret = ReturnValues;
#else #else
Arguments.Select(a => a.ToString()).ToArray(); var args = Arguments.Select(a => a.ToString()).ToArray();
var ret = ReturnValues.Select(a => a.ToString()).ToArray();
#endif #endif
return $"{OpCode}({string.Join(", ", args)})"; return $"{OpCode}({string.Join(", ", args)}) -> [{ReturnValues}]";
} }
} }
+1 -1
View File
@@ -22,7 +22,7 @@ namespace Microsoft.Iris.Debug
public Bridge Bridge { get; } = public Bridge Bridge { get; } =
#if OPENZUNE #if OPENZUNE
new(OwlCore.Remoting.RemotingMode.Host); new(OwlCore.Remoting.RemotingMode.None);
#else #else
new(); new();
#endif #endif
+32 -11
View File
@@ -1022,6 +1022,7 @@ namespace Microsoft.Iris.Markup
TypeSchema typeSchema8 = (TypeSchema)stack.Pop(); TypeSchema typeSchema8 = (TypeSchema)stack.Pop();
object obj7 = stack.Pop(); object obj7 = stack.Pop();
typeSchema8.InitializeInstance(ref obj7); typeSchema8.InitializeInstance(ref obj7);
xmlStack.Pop();
var objXml7 = (XmlElement)xmlStack.Pop(); var objXml7 = (XmlElement)xmlStack.Pop();
objXml7.SetAttribute("Name", typeSchema8.Name); objXml7.SetAttribute("Name", typeSchema8.Name);
ReportErrorOnNull(obj7, "Initialize", typeSchema8.Name); ReportErrorOnNull(obj7, "Initialize", typeSchema8.Name);
@@ -1055,6 +1056,7 @@ namespace Microsoft.Iris.Markup
case OpCode.WriteSymbolPeek: case OpCode.WriteSymbolPeek:
{ {
object value = (opCode == OpCode.WriteSymbolPeek) ? stack.Peek() : stack.Pop(); object value = (opCode == OpCode.WriteSymbolPeek) ? stack.Peek() : stack.Pop();
if (opCode == OpCode.WriteSymbol) xmlStack.Pop();
int num9 = reader.ReadUInt16(); int num9 = reader.ReadUInt16();
SymbolReference symbolRef2 = symbolReferenceTable[num9]; SymbolReference symbolRef2 = symbolReferenceTable[num9];
@@ -1088,6 +1090,7 @@ namespace Microsoft.Iris.Markup
if (isPropInitIndirect) if (isPropInitIndirect)
{ {
typeSchema9 = (TypeSchema)stack.Pop(); typeSchema9 = (TypeSchema)stack.Pop();
xmlStack.Pop();
} }
int num11 = reader.ReadUInt16(); int num11 = reader.ReadUInt16();
PropertySchema propertySchema = importTables.PropertyImports[num11]; PropertySchema propertySchema = importTables.PropertyImports[num11];
@@ -1147,13 +1150,23 @@ namespace Microsoft.Iris.Markup
var destObjXml = xmlStack.Peek(); var destObjXml = xmlStack.Peek();
if (!IsDefaultValue(value2) && valueXml2 != null) if (!IsDefaultValue(value2) && valueXml2 != null)
{ {
// Create element if needed if (propertySchema != null)
if (destObjXml.SelectSingleNode(propertySchema.Name) is not XmlElement propXmlElem2)
{ {
propXmlElem2 = XmlDoc.CreateElement(propertySchema.Name); // Create element if needed
destObjXml.AppendChild(propXmlElem2); if (destObjXml.SelectSingleNode(propertySchema.Name) is not XmlElement propXmlElem2)
{
propXmlElem2 = XmlDoc.CreateElement(propertySchema.Name);
destObjXml.AppendChild(propXmlElem2);
}
propXmlElem2.AppendChild(valueXml2);
}
else
{
// Add straight to parent element
var valueXmlElem2 = XmlDoc.CreateElement("String");
valueXmlElem2.AppendChild(valueXml2);
destObjXml.AppendChild(valueXmlElem2);
} }
propXmlElem2.AppendChild(valueXml2);
} }
} }
break; break;
@@ -1238,13 +1251,13 @@ namespace Microsoft.Iris.Markup
PropertySchema propertySchema4 = importTables.PropertyImports[num13]; PropertySchema propertySchema4 = importTables.PropertyImports[num13];
object instance3 = null; object instance3 = null;
XmlElement xmlInstance3 = null;
if (opCode != OpCode.PropertyGetStatic) if (opCode != OpCode.PropertyGetStatic)
{ {
bool pop = opCode == OpCode.PropertyGet; bool pop = opCode == OpCode.PropertyGet;
instance3 = pop ? stack.Pop() : stack.Peek(); instance3 = pop ? stack.Pop() : stack.Peek();
xmlInstance3 = (XmlElement)(pop ? xmlStack.Pop() : xmlStack.Peek()); if (pop) xmlStack.Pop();
ReportErrorOnNullOrDisposed(instance3, "Property Get", propertySchema4.Name, propertySchema4.Owner); ReportErrorOnNullOrDisposed(instance3, "Property Get", propertySchema4.Name, propertySchema4.Owner);
if (ErrorsDetected(watermark, ref result, ref flag)) if (ErrorsDetected(watermark, ref result, ref flag))
{ {
@@ -1683,11 +1696,19 @@ namespace Microsoft.Iris.Markup
if (!prop.CanWrite || !prop.CanRead) if (!prop.CanWrite || !prop.CanRead)
continue; continue;
object value = prop.GetValue(obj, null); try
if (IsDefaultValue(value)) {
continue; object value = prop.GetValue(obj, null);
if (IsDefaultValue(value))
continue;
SetXmlPropValue(objXml, prop.Name, value, recursionLevel - 1); SetXmlPropValue(objXml, prop.Name, value, recursionLevel - 1);
}
catch
{
// Ignore errors, sometimes things aren't initialized yet
continue;
}
} }
return objXml; return objXml;