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
{
[RemoteProperty]
[RemoteMethod]
[RemoteOptions(RemotingDirection.Bidirectional)]
//[RemoteProperty]
//[RemoteMethod]
//[RemoteOptions(RemotingDirection.Bidirectional)]
public class Bridge : IBridge, IDisposable
{
private readonly MemberRemote _memberRemote;
@@ -24,13 +24,13 @@ namespace Microsoft.Iris.Debug
_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)
{
InterpreterStep?.Invoke(context, new(entry));
}
[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)]
//[RemoteMethod, RemoteOptions(RemotingDirection.HostToClient)]
public void LogDispatcher(string message)
{
DispatcherStep?.Invoke(message);
+5 -4
View File
@@ -22,13 +22,14 @@ namespace Microsoft.Iris.Debug.Data
public override string ToString()
{
var args =
#if OPENZUNE
Arguments;
var args = Arguments;
var ret = ReturnValues;
#else
Arguments.Select(a => a.ToString()).ToArray();
var args = Arguments.Select(a => a.ToString()).ToArray();
var ret = ReturnValues.Select(a => a.ToString()).ToArray();
#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; } =
#if OPENZUNE
new(OwlCore.Remoting.RemotingMode.Host);
new(OwlCore.Remoting.RemotingMode.None);
#else
new();
#endif
+32 -11
View File
@@ -1022,6 +1022,7 @@ namespace Microsoft.Iris.Markup
TypeSchema typeSchema8 = (TypeSchema)stack.Pop();
object obj7 = stack.Pop();
typeSchema8.InitializeInstance(ref obj7);
xmlStack.Pop();
var objXml7 = (XmlElement)xmlStack.Pop();
objXml7.SetAttribute("Name", typeSchema8.Name);
ReportErrorOnNull(obj7, "Initialize", typeSchema8.Name);
@@ -1055,6 +1056,7 @@ namespace Microsoft.Iris.Markup
case OpCode.WriteSymbolPeek:
{
object value = (opCode == OpCode.WriteSymbolPeek) ? stack.Peek() : stack.Pop();
if (opCode == OpCode.WriteSymbol) xmlStack.Pop();
int num9 = reader.ReadUInt16();
SymbolReference symbolRef2 = symbolReferenceTable[num9];
@@ -1088,6 +1090,7 @@ namespace Microsoft.Iris.Markup
if (isPropInitIndirect)
{
typeSchema9 = (TypeSchema)stack.Pop();
xmlStack.Pop();
}
int num11 = reader.ReadUInt16();
PropertySchema propertySchema = importTables.PropertyImports[num11];
@@ -1147,13 +1150,23 @@ namespace Microsoft.Iris.Markup
var destObjXml = xmlStack.Peek();
if (!IsDefaultValue(value2) && valueXml2 != null)
{
// Create element if needed
if (destObjXml.SelectSingleNode(propertySchema.Name) is not XmlElement propXmlElem2)
if (propertySchema != null)
{
propXmlElem2 = XmlDoc.CreateElement(propertySchema.Name);
destObjXml.AppendChild(propXmlElem2);
// Create element if needed
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;
@@ -1238,13 +1251,13 @@ namespace Microsoft.Iris.Markup
PropertySchema propertySchema4 = importTables.PropertyImports[num13];
object instance3 = null;
XmlElement xmlInstance3 = null;
if (opCode != OpCode.PropertyGetStatic)
{
bool pop = opCode == OpCode.PropertyGet;
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);
if (ErrorsDetected(watermark, ref result, ref flag))
{
@@ -1683,11 +1696,19 @@ namespace Microsoft.Iris.Markup
if (!prop.CanWrite || !prop.CanRead)
continue;
object value = prop.GetValue(obj, null);
if (IsDefaultValue(value))
continue;
try
{
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;