7
7
using System ;
8
8
using System . Collections . Generic ;
9
9
using System . IO ;
10
- using System . Threading ;
11
10
using System . Linq ;
12
11
using System . Net ;
12
+ using System . Threading ;
13
13
using Microsoft . VisualStudio . Shared . VSCodeDebugProtocol . Messages ;
14
14
using Mono . Debugging . Client ;
15
- using VSCodeDebug ;
15
+ using Mono . Debugging . Soft ;
16
16
using MonoDevelop . Debugger . Soft . Unity ;
17
17
using MonoDevelop . Unity . Debugger ;
18
18
using Newtonsoft . Json . Linq ;
19
+ using VSCodeDebug ;
19
20
using Breakpoint = Mono . Debugging . Client . Breakpoint ;
20
- using ResponseBreakpoint = Microsoft . VisualStudio . Shared . VSCodeDebugProtocol . Messages . Breakpoint ;
21
21
using ExceptionBreakpointsFilter = VSCodeDebug . ExceptionBreakpointsFilter ;
22
22
using InitializedEvent = VSCodeDebug . InitializedEvent ;
23
23
using OutputEvent = VSCodeDebug . OutputEvent ;
24
+ using ResponseBreakpoint = Microsoft . VisualStudio . Shared . VSCodeDebugProtocol . Messages . Breakpoint ;
24
25
using Scope = VSCodeDebug . Scope ;
25
26
using Source = VSCodeDebug . Source ;
26
27
using SourceBreakpoint = VSCodeDebug . SourceBreakpoint ;
27
28
using StackFrame = Mono . Debugging . Client . StackFrame ;
28
29
using StoppedEvent = VSCodeDebug . StoppedEvent ;
29
30
using TerminatedEvent = VSCodeDebug . TerminatedEvent ;
31
+ using Thread = VSCodeDebug . Thread ;
30
32
using ThreadEvent = VSCodeDebug . ThreadEvent ;
31
33
using UnityProcessInfo = MonoDevelop . Debugger . Soft . Unity . UnityProcessInfo ;
32
34
using Variable = VSCodeDebug . Variable ;
@@ -46,24 +48,26 @@ internal class UnityDebugSession : DebugSession
46
48
private const int MAX_CONNECTION_ATTEMPTS = 10 ;
47
49
private const int CONNECTION_ATTEMPT_INTERVAL = 500 ;
48
50
49
- private AutoResetEvent m_ResumeEvent = new AutoResetEvent ( false ) ;
51
+ private AutoResetEvent m_ResumeEvent ;
50
52
private bool m_DebuggeeExecuting ;
51
53
private readonly object m_Lock = new object ( ) ;
52
- private Mono . Debugging . Soft . SoftDebuggerSession m_Session ;
54
+ private SoftDebuggerSession m_Session ;
53
55
private ProcessInfo m_ActiveProcess ;
54
- SourceBreakpoint [ ] m_Breakpoints = new SourceBreakpoint [ 0 ] ;
56
+ SourceBreakpoint [ ] m_Breakpoints ;
55
57
private List < Catchpoint > m_Catchpoints ;
56
58
private DebuggerSessionOptions m_DebuggerSessionOptions ;
57
59
58
60
private Handles < ObjectValue [ ] > m_VariableHandles ;
59
61
private Handles < StackFrame > m_FrameHandles ;
60
62
private ObjectValue m_Exception ;
61
- private Dictionary < int , VSCodeDebug . Thread > m_SeenThreads ;
63
+ private Dictionary < int , Thread > m_SeenThreads ;
62
64
private bool m_Terminated ;
63
65
IUnityDbgConnector unityDebugConnector ;
64
66
65
67
public UnityDebugSession ( ) : base ( )
66
68
{
69
+ m_ResumeEvent = new AutoResetEvent ( false ) ;
70
+ m_Breakpoints = new SourceBreakpoint [ 0 ] ;
67
71
m_VariableHandles = new Handles < ObjectValue [ ] > ( ) ;
68
72
m_FrameHandles = new Handles < Mono . Debugging . Client . StackFrame > ( ) ;
69
73
m_SeenThreads = new Dictionary < int , VSCodeDebug . Thread > ( ) ;
@@ -157,7 +161,7 @@ public UnityDebugSession() : base()
157
161
m_Session . TargetThreadStarted += ( sender , e ) => {
158
162
int tid = ( int ) e . Thread . Id ;
159
163
lock ( m_SeenThreads ) {
160
- m_SeenThreads [ tid ] = new VSCodeDebug . Thread ( tid , e . Thread . Name ) ;
164
+ m_SeenThreads [ tid ] = new Thread ( tid , e . Thread . Name ) ;
161
165
}
162
166
SendEvent ( new ThreadEvent ( "started" , tid ) ) ;
163
167
} ;
@@ -275,12 +279,12 @@ private void Connect(IPAddress address, int port)
275
279
{
276
280
lock ( m_Lock ) {
277
281
278
- var args0 = new Mono . Debugging . Soft . SoftDebuggerConnectArgs ( string . Empty , address , port ) {
282
+ var args0 = new SoftDebuggerConnectArgs ( string . Empty , address , port ) {
279
283
MaxConnectionAttempts = MAX_CONNECTION_ATTEMPTS ,
280
284
TimeBetweenConnectionAttempts = CONNECTION_ATTEMPT_INTERVAL
281
285
} ;
282
286
283
- m_Session . Run ( new Mono . Debugging . Soft . SoftDebuggerStartInfo ( args0 ) , m_DebuggerSessionOptions ) ;
287
+ m_Session . Run ( new SoftDebuggerStartInfo ( args0 ) , m_DebuggerSessionOptions ) ;
284
288
285
289
m_DebuggeeExecuting = true ;
286
290
}
@@ -361,7 +365,7 @@ public override void SetFunctionBreakpoints(Response response, dynamic arguments
361
365
public override void Continue ( Response response , dynamic args )
362
366
{
363
367
WaitForSuspend ( ) ;
364
- SendResponse ( response ) ;
368
+ SendResponse ( response , new ContinueResponseBody ( ) ) ;
365
369
lock ( m_Lock ) {
366
370
if ( m_Session == null || m_Session . IsRunning || m_Session . HasExited ) return ;
367
371
@@ -656,16 +660,16 @@ public override void Variables(Response response, dynamic args)
656
660
657
661
public override void Threads ( Response response , dynamic args )
658
662
{
659
- var threads = new List < VSCodeDebug . Thread > ( ) ;
663
+ var threads = new List < Thread > ( ) ;
660
664
var process = m_ActiveProcess ;
661
665
if ( process != null ) {
662
- Dictionary < int , VSCodeDebug . Thread > d ;
666
+ Dictionary < int , Thread > d ;
663
667
lock ( m_SeenThreads ) {
664
- d = new Dictionary < int , VSCodeDebug . Thread > ( m_SeenThreads ) ;
668
+ d = new Dictionary < int , Thread > ( m_SeenThreads ) ;
665
669
}
666
670
foreach ( var t in process . GetThreads ( ) ) {
667
671
int tid = ( int ) t . Id ;
668
- d [ tid ] = new VSCodeDebug . Thread ( tid , t . Name ) ;
672
+ d [ tid ] = new Thread ( tid , t . Name ) ;
669
673
}
670
674
threads = d . Values . ToList ( ) ;
671
675
}
0 commit comments