Debug bridge improvements

This commit is contained in:
Yoshi Askharoun
2022-06-07 14:30:29 -05:00
parent 649cab5d8d
commit 3700afad88
8 changed files with 91 additions and 20 deletions
+25
View File
@@ -0,0 +1,25 @@
#if !ZUNE5
using Microsoft.Iris.Debug.Data;
namespace Microsoft.Iris.Debug
{
/// <summary>
/// A dummy implementation of <see cref="IBridge"/>, used to avoid conditional
/// code in consuming libraries.
/// </summary>
public class Bridge : IBridge
{
public void LogDispatcher(string message)
{
}
public void LogInterpreterOpCode(object context, InterpreterEntry entry)
{
}
}
}
#endif
+1 -4
View File
@@ -2,16 +2,13 @@
using OwlCore.Remoting;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Microsoft.Iris.Debug
{
[RemoteProperty]
[RemoteMethod]
[RemoteOptions(RemotingDirection.Bidirectional)]
public class Bridge : IDisposable
public class Bridge : IBridge, IDisposable
{
private readonly MemberRemote _memberRemote;
+20 -6
View File
@@ -1,4 +1,5 @@
using System;
using System.Collections.Generic;
using System.Linq;
namespace Microsoft.Iris.Debug.Data
@@ -8,17 +9,22 @@ namespace Microsoft.Iris.Debug.Data
public InterpreterEntry(object opCode, params OpCodeArgument[] args)
{
OpCode = opCode;
Arguments = args;
if (args != null)
Arguments = args;
else
Arguments = new List<OpCodeArgument>();
}
public object OpCode { get; private set; }
public OpCodeArgument[] Arguments { get; private set; }
public object OpCode { get; }
public IList<OpCodeArgument> Arguments { get; }
public IList<object> ReturnValues { get; } = new List<object>();
public override string ToString()
{
var args =
#if ZUNE5
(System.Collections.Generic.IEnumerable<OpCodeArgument>)Arguments;
Arguments;
#else
Arguments.Select(a => a.ToString()).ToArray();
#endif
@@ -28,8 +34,16 @@ namespace Microsoft.Iris.Debug.Data
public class OpCodeArgument
{
public Type Type { get; private set; }
public object Value { get; private set; }
public string Name { get; set; }
public Type Type { get; set; }
public object Value { get; set; }
public OpCodeArgument(string name, Type type, object value)
{
Name = name;
Type = type;
Value = value;
}
public override string ToString() => $"{Type} {Value}";
}
+15
View File
@@ -0,0 +1,15 @@
namespace Microsoft.Iris.Debug
{
internal interface IBridge
{
/// <summary>
/// Logs the context, opcode, and arguments of an instruction
/// executed by <c>Microsoft.Iris.Markup.Interpreter</c>.
/// </summary>
/// <param name="context"></param>
/// <param name="entry"></param>
public void LogInterpreterOpCode(object context, Data.InterpreterEntry entry);
public void LogDispatcher(string message);
}
}
+1
View File
@@ -14,6 +14,7 @@
<ItemGroup Condition=" '$(UseZune5)' == 'true' ">
<PackageReference Include="OwlCore" Version="0.0.67" />
<PackageReference Include="Cauldron.BasicInterceptors" Version="3.2.3" />
</ItemGroup>
<PropertyGroup Condition=" '$(UseZune5)' == 'true' ">