2023-05-24 10:14:07 -05:00
|
|
|
using Microsoft.Iris.Markup;
|
|
|
|
|
using System;
|
2022-06-07 14:30:29 -05:00
|
|
|
using System.Collections.Generic;
|
2023-05-24 16:24:48 -05:00
|
|
|
using System.Text;
|
2022-06-07 01:00:15 -05:00
|
|
|
|
2023-05-22 18:04:22 -05:00
|
|
|
namespace Microsoft.Iris.Debug.Data;
|
|
|
|
|
|
2023-05-24 10:14:07 -05:00
|
|
|
[Serializable]
|
2023-05-22 18:04:22 -05:00
|
|
|
public class InterpreterEntry
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-25 01:01:57 -05:00
|
|
|
public InterpreterEntry(OpCode opCode, uint offset, string loadUri, params InterpreterObject[] args)
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-22 18:04:22 -05:00
|
|
|
OpCode = opCode;
|
2023-05-24 16:24:48 -05:00
|
|
|
Offset = offset;
|
|
|
|
|
LoadUri = loadUri;
|
2022-06-07 14:30:29 -05:00
|
|
|
|
2023-05-22 18:04:22 -05:00
|
|
|
if (args != null && args.Length > 0)
|
2023-05-25 01:01:57 -05:00
|
|
|
Parameters = args;
|
2023-05-24 17:48:16 -05:00
|
|
|
else
|
2023-05-25 01:01:57 -05:00
|
|
|
Parameters = new List<InterpreterObject>();
|
2022-06-07 01:00:15 -05:00
|
|
|
}
|
|
|
|
|
|
2023-05-24 10:14:07 -05:00
|
|
|
public OpCode OpCode { get; }
|
2023-05-24 16:24:48 -05:00
|
|
|
|
|
|
|
|
public uint Offset { get; }
|
|
|
|
|
|
|
|
|
|
public string LoadUri { get; }
|
|
|
|
|
|
2023-05-25 01:01:57 -05:00
|
|
|
public IList<InterpreterObject> Parameters { get; }
|
2023-05-24 16:24:48 -05:00
|
|
|
|
2023-05-25 01:01:57 -05:00
|
|
|
public IList<InterpreterObject> ReturnValues { get; } = new List<InterpreterObject>();
|
2023-05-22 18:04:22 -05:00
|
|
|
|
|
|
|
|
public override string ToString()
|
2022-06-07 01:00:15 -05:00
|
|
|
{
|
2023-05-25 01:01:57 -05:00
|
|
|
StringBuilder sb = new($"[{LoadUri} @ 0x{Offset:X}] {OpCode}({string.Join(", ", Parameters)})");
|
2023-05-24 16:24:48 -05:00
|
|
|
|
|
|
|
|
if (ReturnValues.Count > 0)
|
|
|
|
|
{
|
|
|
|
|
sb.Append(" -> ");
|
|
|
|
|
|
|
|
|
|
if (ReturnValues.Count == 1)
|
|
|
|
|
sb.Append(ReturnValues[0]);
|
|
|
|
|
else
|
|
|
|
|
sb.Append($"[{string.Join(", ", ReturnValues)}]");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return sb.ToString();
|
2022-06-07 01:00:15 -05:00
|
|
|
}
|
|
|
|
|
}
|