diff --git a/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs b/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs index 26aca79..f366128 100644 --- a/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs +++ b/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs @@ -6,7 +6,7 @@ using System.Text; namespace Microsoft.Iris.Debug.Data; [Serializable] -public class InterpreterEntry +public class InterpreterEntry : IComparable { public InterpreterEntry() { } @@ -23,6 +23,8 @@ public class InterpreterEntry public string LoadUri { get; set; } + public string InstructionString => ToInstructionString(); + public List Parameters { get; } = new(); public List ReturnValues { get; } = new(); @@ -43,4 +45,43 @@ public class InterpreterEntry return sb.ToString(); } + + public string ToInstructionString() + { + StringBuilder sb = new(); + sb.AppendFormat("0x{0:X4}", Offset); + sb.Append('\t'); + sb.Append(OpCode); + sb.Append(' ', 2); + + for (int p = 0; p < Parameters.Count; ++p) + { + var param = Parameters[p]; + + if (p != 0) + sb.Append(", "); + + if (param.Source == InstructionObjectSource.Inline) + sb.Append(param.Value ?? "NULL"); + else + sb.Append(param.Source); + + if (param.TableIndex != -1) + { + sb.Append('['); + sb.Append(param.TableIndex); + sb.Append(']'); + } + } + + return sb.ToString(); + } + + public int CompareTo(InterpreterEntry other) + { + int stringCmp = LoadUri.CompareTo(other.LoadUri); + return stringCmp != 0 + ? stringCmp + : Offset.CompareTo(other.Offset); + } } diff --git a/UIX/Microsoft/Iris/Debug/Data/InterpreterObject.cs b/UIX/Microsoft/Iris/Debug/Data/InterpreterObject.cs index a931da3..e59afcb 100644 --- a/UIX/Microsoft/Iris/Debug/Data/InterpreterObject.cs +++ b/UIX/Microsoft/Iris/Debug/Data/InterpreterObject.cs @@ -5,11 +5,25 @@ namespace Microsoft.Iris.Debug.Data; [Serializable] public class InterpreterObject { + private object _value; + public string Name { get; set; } public Type Type { get; set; } - public object Value { get; set; } + public object Value + { + get => _value; + set + { + if (Type == typeof(uint)) + _value = BitConverter.ToUInt32((byte[])value, 0); + else if (Type == typeof(ulong)) + _value = BitConverter.ToUInt64((byte[])value, 0); + else + _value = value; + } + } public InstructionObjectSource Source { get; set; } diff --git a/UIX/Microsoft/Iris/Markup/Interpreter.cs b/UIX/Microsoft/Iris/Markup/Interpreter.cs index 0506d2e..c604690 100644 --- a/UIX/Microsoft/Iris/Markup/Interpreter.cs +++ b/UIX/Microsoft/Iris/Markup/Interpreter.cs @@ -100,7 +100,7 @@ namespace Microsoft.Iris.Markup int typeIndex = reader.ReadUInt16(); TypeSchema typeSchema = importTables.TypeImports[typeIndex]; entry.Parameters.Add(new InterpreterObject("type", typeof(TypeSchema), - typeSchema, InstructionObjectSource.TypeImports)); + typeSchema, InstructionObjectSource.TypeImports, typeIndex)); object newObj = typeSchema.ConstructDefault();