public async Task<bool> PauseAsync()
{
var result = true;
if (currentState == DebuggerState.Paused)
{
result = false;
return result;
}
EventHandler<StopRecord> onStoppedHandler = (sender, e) =>
{
if (e != null)
{
switch (e.Reason)
{
case StopReason.SignalReceived:
break;
default:
// indicate that the debugger has been interrupted for a reason other than signalling, i.e. stepping range ended.
result = false;
break;
}
}
if (waitForStop.CurrentCount == 0)
{
waitForStop.Release();
}
};
InternalStopped += onStoppedHandler;
if (asyncModeEnabled)
{
await new ExecInterruptCommand().Execute(this);
await waitForStop.WaitAsync();
}
else
{
await transmitRunner.InvokeAsync(() =>
{
do
{
Platform.SendSignal(process.Id, Platform.Signum.SIGINT);
} while (!waitForStop.Wait(100));
});
}
InternalStopped -= onStoppedHandler;
return result;
}