| 394 | } |
| 395 | |
| 396 | void RemoteDebugger::debug(bool p_can_continue, bool p_is_error_breakpoint) { |
| 397 | { |
| 398 | MutexLock lock(mutex); |
| 399 | // Tests that require mutex. |
| 400 | if (script_debugger->is_skipping_breakpoints() && !p_is_error_breakpoint) { |
| 401 | return; |
| 402 | } |
| 403 | |
| 404 | ERR_FAIL_COND_MSG(!is_peer_connected(), "Script Debugger failed to connect, but being used anyway."); |
| 405 | |
| 406 | if (!peer->can_block()) { |
| 407 | return; // Peer does not support blocking IO. We could at least send the error though. |
| 408 | } |
| 409 | } |
| 410 | |
| 411 | if (p_is_error_breakpoint && script_debugger->is_ignoring_error_breaks()) { |
| 412 | return; |
| 413 | } |
| 414 | |
| 415 | ScriptLanguage *script_lang = script_debugger->get_break_language(); |
| 416 | ERR_FAIL_NULL(script_lang); |
| 417 | |
| 418 | Array msg = { |
| 419 | p_can_continue, |
| 420 | script_lang->debug_get_error(), |
| 421 | script_lang->debug_get_stack_level_count() > 0, |
| 422 | Thread::get_caller_id() |
| 423 | }; |
| 424 | if (allow_focus_steal_fn) { |
| 425 | allow_focus_steal_fn(); |
| 426 | } |
| 427 | send_message("debug_enter", msg); |
| 428 | |
| 429 | Input::MouseMode mouse_mode = Input::MOUSE_MODE_VISIBLE; |
| 430 | |
| 431 | if (Thread::get_caller_id() == Thread::get_main_id()) { |
| 432 | mouse_mode = Input::get_singleton()->get_mouse_mode(); |
| 433 | if (mouse_mode != Input::MOUSE_MODE_VISIBLE) { |
| 434 | Input::get_singleton()->set_mouse_mode(Input::MOUSE_MODE_VISIBLE); |
| 435 | } |
| 436 | } else { |
| 437 | MutexLock mutex_lock(mutex); |
| 438 | messages.insert(Thread::get_caller_id(), List<Message>()); |
| 439 | } |
| 440 | |
| 441 | while (is_peer_connected()) { |
| 442 | flush_output(); |
| 443 | |
| 444 | _poll_messages(); |
| 445 | |
| 446 | if (_has_messages()) { |
| 447 | Array cmd = _get_message(); |
| 448 | |
| 449 | ERR_CONTINUE(cmd.size() != 2); |
| 450 | ERR_CONTINUE(cmd[0].get_type() != Variant::STRING); |
| 451 | ERR_CONTINUE(cmd[1].get_type() != Variant::ARRAY); |
| 452 | |
| 453 | String command = cmd[0]; |
no test coverage detected