Files
MicrosoftIris/Tests/SimpleDebugClient/Program.cs
T

66 lines
1.9 KiB
C#
Raw Normal View History

2022-06-07 01:00:15 -05:00
using Microsoft.Iris.Debug;
2023-05-23 20:12:35 -05:00
using Microsoft.Iris.Debug.Data;
2023-06-01 20:18:53 -05:00
using Microsoft.Iris.Debug.SystemNet;
2023-05-23 20:12:35 -05:00
using System;
using System.Threading;
2022-06-07 01:00:15 -05:00
2023-05-23 20:12:35 -05:00
namespace SimpleDebugClient;
internal class Program
2022-06-07 01:00:15 -05:00
{
2023-05-23 20:12:35 -05:00
static IDebuggerClient? Debugger { get; set; }
static int Main(string[] args)
2022-06-07 01:00:15 -05:00
{
2023-06-01 20:18:53 -05:00
var connectionString = args.Length >= 2
? new Uri(args[1]) : DebugRemoting.DEFAULT_TCP_URI;
2022-10-07 09:34:08 -05:00
2023-06-01 20:18:53 -05:00
Debugger = new NetDebuggerClient(connectionString);
//Debugger.DispatcherStep += Debugger_DispatcherStep;
Debugger.InterpreterStep += Debugger_InterpreterStep;
Debugger.InterpreterStateChanged += Debugger_InterpreterStateChanged;
2022-06-12 21:21:29 -05:00
Console.WriteLine($"Listening for debug messages at '{Debugger.ConnectionUri}'. Press Ctrl-C or 'x' to exit.");
while (true)
{
var cmd = Console.ReadLine();
if (cmd[0] == 'x')
{
if (Debugger is IDisposable debugger)
debugger.Dispose();
break;
}
switch (cmd[0])
{
case 's':
Debugger.DebuggerCommand = InterpreterCommand.Step;
break;
case 'c':
Debugger.DebuggerCommand = InterpreterCommand.Continue;
break;
}
}
return 0;
2023-05-23 20:12:35 -05:00
}
private static void Debugger_InterpreterStateChanged(InterpreterCommand state)
2023-05-23 20:12:35 -05:00
{
Console.WriteLine($"Interpreter is in {state} mode");
2023-05-23 20:12:35 -05:00
}
private static void Debugger_DispatcherStep(string obj)
{
Console.WriteLine($"[Dispatcher] {obj}");
2023-05-23 20:12:35 -05:00
}
private static void Debugger_InterpreterStep(object? sender, InterpreterEntry e)
{
if (e.LoadUri.EndsWith("TopToolbarSignIn.uix"))
return;
2023-05-25 21:01:48 -05:00
Console.WriteLine($"[Interpreter] {e}");
2022-06-07 01:00:15 -05:00
}
}