@@ -30,7 +30,6 @@ impl CairoDebugger {
3030 | Command :: Completions ( _)
3131 | Command :: DataBreakpointInfo ( _)
3232 | Command :: Disassemble ( _)
33- | Command :: Disconnect ( _)
3433 | Command :: Goto ( _)
3534 | Command :: ExceptionInfo ( _)
3635 | Command :: GotoTargets ( _)
@@ -54,6 +53,12 @@ impl CairoDebugger {
5453 bail ! ( "Unsupported request" ) ;
5554 }
5655
56+ // It makes no sense to send `attach` in the current architecture.
57+ Command :: Attach ( _) => {
58+ self . connection . send_error ( request, "Attach is not supported" ) ?;
59+ bail ! ( "Unsupported request" ) ;
60+ }
61+
5762 // These may be supported after the MVP.
5863 // Nonetheless, if we receive these with current capabilities,
5964 // it is the client's fault.
@@ -71,13 +76,9 @@ impl CairoDebugger {
7176 bail ! ( "Set function breakpoints is not yet supported" ) ;
7277 }
7378
74- // It makes no sense to send `attach` in the current architecture.
75- Command :: Attach ( _) => {
76- self . connection . send_error ( request, "Attach is not supported" ) ?;
77- bail ! ( "Unsupported request" ) ;
78- }
79-
8079 // Supported requests.
80+
81+ // Initialize flow requests.
8182 Command :: Initialize ( args) => {
8283 trace ! ( "Initialized a client: {:?}" , args. client_name) ;
8384 self . connection . send_success (
@@ -90,26 +91,17 @@ impl CairoDebugger {
9091 self . connection . send_event ( Event :: Initialized ) ?;
9192 Ok ( HandleResult :: Handled )
9293 }
93- Command :: ConfigurationDone => {
94- trace ! ( "Configuration done" ) ;
95- self . connection . send_success ( request, ResponseBody :: ConfigurationDone ) ?;
96- Ok ( HandleResult :: Trigger ( NextAction :: FinishInit ) )
97- }
98- Command :: Continue ( _) => {
99- self . connection . send_success (
100- request,
101- ResponseBody :: Continue ( ContinueResponse { all_threads_continued : Some ( true ) } ) ,
102- ) ?;
103- Ok ( HandleResult :: Trigger ( NextAction :: Resume ) )
104- }
10594 Command :: Launch ( _) => {
106- // Start running the Cairo program here.
10795 self . connection . send_success ( request, ResponseBody :: Launch ) ?;
10896 Ok ( HandleResult :: Handled )
10997 }
110- Command :: Next ( _) => {
111- todo ! ( )
98+ Command :: ConfigurationDone => {
99+ // Start running the Cairo program here.
100+ trace ! ( "Configuration done" ) ;
101+ self . connection . send_success ( request, ResponseBody :: ConfigurationDone ) ?;
102+ Ok ( HandleResult :: Trigger ( NextAction :: FinishInit ) )
112103 }
104+
113105 Command :: Pause ( _) => {
114106 self . connection . send_event ( Event :: Stopped ( StoppedEventBody {
115107 reason : StoppedEventReason :: Pause ,
@@ -123,6 +115,14 @@ impl CairoDebugger {
123115 self . connection . send_success ( request, ResponseBody :: Pause ) ?;
124116 Ok ( HandleResult :: Trigger ( NextAction :: Stop ) )
125117 }
118+ Command :: Continue ( _) => {
119+ self . connection . send_success (
120+ request,
121+ ResponseBody :: Continue ( ContinueResponse { all_threads_continued : Some ( true ) } ) ,
122+ ) ?;
123+ Ok ( HandleResult :: Trigger ( NextAction :: Resume ) )
124+ }
125+
126126 Command :: SetBreakpoints ( args) => {
127127 let mut response_bps = Vec :: new ( ) ;
128128 if let Some ( requested_bps) = & args. breakpoints {
@@ -144,8 +144,16 @@ impl CairoDebugger {
144144 ) ?;
145145 Ok ( HandleResult :: Handled )
146146 }
147- Command :: Source ( _) => {
148- todo ! ( )
147+
148+ Command :: Threads => {
149+ self . connection . send_success (
150+ request,
151+ ResponseBody :: Threads ( ThreadsResponse {
152+ // Return a single thread.
153+ threads : vec ! [ Thread { id: 0 , name: "" . to_string( ) } ] ,
154+ } ) ,
155+ ) ?;
156+ Ok ( HandleResult :: Handled )
149157 }
150158 Command :: StackTrace ( _) => {
151159 self . connection . send_success (
@@ -166,12 +174,37 @@ impl CairoDebugger {
166174 ) ?;
167175 Ok ( HandleResult :: Handled )
168176 }
177+ Command :: Scopes ( _) => {
178+ // Return no scopes.
179+ self . connection . send_success (
180+ request,
181+ ResponseBody :: Scopes ( ScopesResponse { scopes : vec ! [ ] } ) ,
182+ ) ?;
183+ Ok ( HandleResult :: Handled )
184+ }
185+ Command :: Variables ( _) => {
186+ self . connection . send_success (
187+ request,
188+ ResponseBody :: Variables ( VariablesResponse {
189+ // Return no variables.
190+ variables : vec ! [ ] ,
191+ } ) ,
192+ ) ?;
193+ Ok ( HandleResult :: Handled )
194+ }
195+
196+ Command :: Next ( _) => {
197+ todo ! ( )
198+ }
169199 Command :: StepIn ( _) => {
170200 todo ! ( )
171201 }
172202 Command :: StepOut ( _) => {
173203 todo ! ( )
174204 }
205+ Command :: Source ( _) => {
206+ todo ! ( )
207+ }
175208
176209 Command :: Evaluate ( _) => {
177210 self . connection . send_success (
@@ -189,33 +222,9 @@ impl CairoDebugger {
189222 ) ?;
190223 Ok ( HandleResult :: Handled )
191224 }
192- Command :: Threads => {
193- self . connection . send_success (
194- request,
195- ResponseBody :: Threads ( ThreadsResponse {
196- // Return a single thread.
197- threads : vec ! [ Thread { id: 0 , name: "" . to_string( ) } ] ,
198- } ) ,
199- ) ?;
200- Ok ( HandleResult :: Handled )
201- }
202- Command :: Variables ( _) => {
203- self . connection . send_success (
204- request,
205- ResponseBody :: Variables ( VariablesResponse {
206- // Return no variables.
207- variables : vec ! [ ] ,
208- } ) ,
209- ) ?;
210- Ok ( HandleResult :: Handled )
211- }
212- Command :: Scopes ( _) => {
213- // Return no scopes.
214- self . connection . send_success (
215- request,
216- ResponseBody :: Scopes ( ScopesResponse { scopes : vec ! [ ] } ) ,
217- ) ?;
218- Ok ( HandleResult :: Handled )
225+
226+ Command :: Disconnect ( _) => {
227+ todo ! ( )
219228 }
220229 }
221230 }
0 commit comments