diff --git a/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs b/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs index 7456ecc..c4642ae 100644 --- a/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs +++ b/UIX/Microsoft/Iris/Debug/Data/InterpreterEntry.cs @@ -1,31 +1,49 @@ using Microsoft.Iris.Markup; using System; using System.Collections.Generic; -using System.Linq; using System.Runtime.Serialization; +using System.Text; namespace Microsoft.Iris.Debug.Data; [Serializable] public class InterpreterEntry { - public InterpreterEntry(OpCode opCode, params OpCodeArgument[] args) + public InterpreterEntry(OpCode opCode, uint offset, string loadUri, params OpCodeArgument[] args) { OpCode = opCode; + Offset = offset; + LoadUri = loadUri; if (args != null && args.Length > 0) Arguments = args; - else - Arguments = new List(); } public OpCode OpCode { get; } + + public uint Offset { get; } + + public string LoadUri { get; } + public IList Arguments { get; } + public IList ReturnValues { get; } = new List(); public override string ToString() { - return $"{OpCode}({string.Join(", ", Arguments)}) -> [{string.Join(", ", ReturnValues)}]"; + StringBuilder sb = new($"[{LoadUri} @ 0x{Offset:X}] {OpCode}({string.Join(", ", Arguments)})"); + + if (ReturnValues.Count > 0) + { + sb.Append(" -> "); + + if (ReturnValues.Count == 1) + sb.Append(ReturnValues[0]); + else + sb.Append($"[{string.Join(", ", ReturnValues)}]"); + } + + return sb.ToString(); } } diff --git a/UIX/Microsoft/Iris/Markup/Interpreter.cs b/UIX/Microsoft/Iris/Markup/Interpreter.cs index e110a50..6f18731 100644 --- a/UIX/Microsoft/Iris/Markup/Interpreter.cs +++ b/UIX/Microsoft/Iris/Markup/Interpreter.cs @@ -71,7 +71,7 @@ namespace Microsoft.Iris.Markup while (!errorsDetected) { OpCode opCode = (OpCode)reader.ReadByte(); - Debug.Data.InterpreterEntry entry = new(opCode); + Debug.Data.InterpreterEntry entry = new(opCode, reader.CurrentOffset, loadResult.Uri); // Fetch line and column numbers from the table if (debugging && context.LoadResult.LineNumberTable.TryLookup(reader.CurrentOffset, out int line, out int column)) @@ -696,7 +696,7 @@ namespace Microsoft.Iris.Markup } } - Application.Debugger?.LogInterpreterOpCode(opCode, entry); + Application.Debugger?.LogInterpreterOpCode(context, entry); } while (stack.Count > count) { @@ -918,7 +918,7 @@ namespace Microsoft.Iris.Markup while (!flag) { OpCode opCode = (OpCode)reader.ReadByte(); - var entry = new Debug.Data.InterpreterEntry(opCode); + var entry = new Debug.Data.InterpreterEntry(opCode, reader.CurrentOffset, loadResult.Uri); switch (opCode) {