160 } |
160 } |
161 |
161 |
162 |
162 |
163 /* protocol commands */ |
163 /* protocol commands */ |
164 |
164 |
165 def update_thread(thread_name: String, debug_states: List[Debugger.Debug_State]) |
165 def update_thread(thread_name: String, debug_states: List[Debugger.Debug_State]): Unit = |
166 { |
166 { |
167 state.change(_.update_thread(thread_name, debug_states)) |
167 state.change(_.update_thread(thread_name, debug_states)) |
168 delay_update.invoke() |
168 delay_update.invoke() |
169 } |
169 } |
170 |
170 |
171 def add_output(thread_name: String, entry: Command.Results.Entry) |
171 def add_output(thread_name: String, entry: Command.Results.Entry): Unit = |
172 { |
172 { |
173 state.change(_.add_output(thread_name, entry)) |
173 state.change(_.add_output(thread_name, entry)) |
174 delay_update.invoke() |
174 delay_update.invoke() |
175 } |
175 } |
176 |
176 |
177 def is_active(): Boolean = session.is_ready && state.value.is_active |
177 def is_active(): Boolean = session.is_ready && state.value.is_active |
178 |
178 |
179 def ready() |
179 def ready(): Unit = |
180 { |
180 { |
181 if (is_active()) |
181 if (is_active()) |
182 session.protocol_command("Debugger.init") |
182 session.protocol_command("Debugger.init") |
183 } |
183 } |
184 |
184 |
199 session.protocol_command("Debugger.exit") |
199 session.protocol_command("Debugger.exit") |
200 st1 |
200 st1 |
201 }) |
201 }) |
202 |
202 |
203 def is_break(): Boolean = state.value.break |
203 def is_break(): Boolean = state.value.break |
204 def set_break(b: Boolean) |
204 def set_break(b: Boolean): Unit = |
205 { |
205 { |
206 state.change(st => { |
206 state.change(st => { |
207 val st1 = st.set_break(b) |
207 val st1 = st.set_break(b) |
208 session.protocol_command("Debugger.break", b.toString) |
208 session.protocol_command("Debugger.break", b.toString) |
209 st1 |
209 st1 |
218 } |
218 } |
219 |
219 |
220 def breakpoint_state(breakpoint: Long): Boolean = |
220 def breakpoint_state(breakpoint: Long): Boolean = |
221 state.value.active_breakpoints(breakpoint) |
221 state.value.active_breakpoints(breakpoint) |
222 |
222 |
223 def toggle_breakpoint(command: Command, breakpoint: Long) |
223 def toggle_breakpoint(command: Command, breakpoint: Long): Unit = |
224 { |
224 { |
225 state.change(st => |
225 state.change(st => |
226 { |
226 { |
227 val (breakpoint_state, st1) = st.toggle_breakpoint(breakpoint) |
227 val (breakpoint_state, st1) = st.toggle_breakpoint(breakpoint) |
228 session.protocol_command( |
228 session.protocol_command( |
264 def continue(thread_name: String): Unit = input(thread_name, "continue") |
264 def continue(thread_name: String): Unit = input(thread_name, "continue") |
265 def step(thread_name: String): Unit = input(thread_name, "step") |
265 def step(thread_name: String): Unit = input(thread_name, "step") |
266 def step_over(thread_name: String): Unit = input(thread_name, "step_over") |
266 def step_over(thread_name: String): Unit = input(thread_name, "step_over") |
267 def step_out(thread_name: String): Unit = input(thread_name, "step_out") |
267 def step_out(thread_name: String): Unit = input(thread_name, "step_out") |
268 |
268 |
269 def clear_output(thread_name: String) |
269 def clear_output(thread_name: String): Unit = |
270 { |
270 { |
271 state.change(_.clear_output(thread_name)) |
271 state.change(_.clear_output(thread_name)) |
272 delay_update.invoke() |
272 delay_update.invoke() |
273 } |
273 } |
274 |
274 |
275 def eval(c: Debugger.Context, SML: Boolean, context: String, expression: String) |
275 def eval(c: Debugger.Context, SML: Boolean, context: String, expression: String): Unit = |
276 { |
276 { |
277 state.change(st => { |
277 state.change(st => { |
278 input(c.thread_name, "eval", c.debug_index.getOrElse(0).toString, |
278 input(c.thread_name, "eval", c.debug_index.getOrElse(0).toString, |
279 SML.toString, Symbol.encode(context), Symbol.encode(expression)) |
279 SML.toString, Symbol.encode(context), Symbol.encode(expression)) |
280 st.clear_output(c.thread_name) |
280 st.clear_output(c.thread_name) |
281 }) |
281 }) |
282 delay_update.invoke() |
282 delay_update.invoke() |
283 } |
283 } |
284 |
284 |
285 def print_vals(c: Debugger.Context, SML: Boolean, context: String) |
285 def print_vals(c: Debugger.Context, SML: Boolean, context: String): Unit = |
286 { |
286 { |
287 require(c.debug_index.isDefined) |
287 require(c.debug_index.isDefined) |
288 |
288 |
289 state.change(st => { |
289 state.change(st => { |
290 input(c.thread_name, "print_vals", c.debug_index.getOrElse(0).toString, |
290 input(c.thread_name, "print_vals", c.debug_index.getOrElse(0).toString, |