Skip to content

Commit

Permalink
Обратносовместимый метод остановки отладчика
Browse files Browse the repository at this point in the history
  • Loading branch information
EvilBeaver committed Nov 12, 2024
1 parent ae58ec6 commit 0aea6cd
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
4 changes: 3 additions & 1 deletion src/OneScript.DebugProtocol/IDebugEventListener.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ namespace OneScript.DebugProtocol
/// </summary>
public interface IDebugEventListener
{
void ThreadStopped(int threadId, ThreadStopReason reason, string errorMessage);
void ThreadStopped(int threadId, ThreadStopReason reason);

void ThreadStoppedEx(int threadId, ThreadStopReason reason, string errorMessage);

void ProcessExited(int exitCode);
}
Expand Down
3 changes: 2 additions & 1 deletion src/OneScript.DebugServices/DefaultDebugController.cs
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ private void ThreadManagerOnThreadStopped(object sender, ThreadStoppedEventArgs
{
var token = _threadManager.GetTokenForThread(e.ThreadId);
token.Reset();
_callbackService.ThreadStopped(e.ThreadId, ConvertStopReason(e.StopReason), e.ErrorMessage);

_callbackService.ThreadStoppedEx(e.ThreadId, ConvertStopReason(e.StopReason), e.ErrorMessage);
token.Wait();
}

Expand Down
10 changes: 8 additions & 2 deletions src/OneScript.DebugServices/TcpEventCallbackChannel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,15 @@ public TcpEventCallbackChannel(ICommunicationChannel channel)
_channel = channel;
}

public void ThreadStopped(int threadId, ThreadStopReason reason, string errorMessage)
public void ThreadStoppedEx(int threadId, ThreadStopReason reason, string errorMessage)
{
var dto = RpcCall.Create(nameof(IDebugEventListener), nameof(ThreadStopped), threadId, reason, errorMessage);
var dto = RpcCall.Create(nameof(IDebugEventListener), nameof(ThreadStoppedEx), threadId, reason, errorMessage);
_channel.Write(dto);
}

public void ThreadStopped(int threadId, ThreadStopReason reason)
{
var dto = RpcCall.Create(nameof(IDebugEventListener), nameof(ThreadStopped), threadId, reason);
_channel.Write(dto);
}

Expand Down
11 changes: 10 additions & 1 deletion src/VSCode.DebugAdapter/OscriptDebugSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,16 @@ private string NormalizeDriveLetter(string path)

}

public void ThreadStopped(int threadId, ThreadStopReason reason, string errorMessage)
public void ThreadStopped(int threadId, ThreadStopReason reason)
{
LogEventOccured();
_framesHandles.Reset();
_variableHandles.Reset();

SendEvent(new StoppedEvent(threadId, reason.ToString()));
}

public void ThreadStoppedEx(int threadId, ThreadStopReason reason, string errorMessage)
{
LogEventOccured();
_framesHandles.Reset();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -120,10 +120,10 @@ private void WriteCommand(object[] data, [CallerMemberName] string command = "")
private T GetResponse<T>()
{
var rpcResult = _processor.GetResult();
Log.Verbose("Response received {Result} = {Value}", rpcResult.Id, rpcResult.ReturnValue);
Log.Debug("Response received {Result} = {Value}", rpcResult.Id, rpcResult.ReturnValue);
if (rpcResult.ReturnValue is RpcExceptionDto excDto)
{
Log.Verbose("RPC Exception received: {Description}", excDto.Description);
Log.Debug("RPC Exception received: {Description}", excDto.Description);
throw new RpcOperationException(excDto);
}

Expand Down

0 comments on commit 0aea6cd

Please sign in to comment.