From c45f44d85635a1d16a93c00cd8cb17f60dfa6336 Mon Sep 17 00:00:00 2001 From: Blazej Floch Date: Sun, 11 Feb 2018 06:08:37 -0500 Subject: Local debugger fixes and extensions - Adds q/quit option to console debugging - Adds options (variable_prefix) - Breaks into debugger with Ctrl-C in local debug mode (Unix/Windows) - Added option to list all breakpoints - Fixes add/remove breakpoint bug (invalid path parsing) - Minor cleanup --- drivers/unix/os_unix.cpp | 17 +++++++++++++++++ drivers/unix/os_unix.h | 1 + 2 files changed, 18 insertions(+) (limited to 'drivers/unix') diff --git a/drivers/unix/os_unix.cpp b/drivers/unix/os_unix.cpp index eeb3b31fc2..1e34d63b13 100644 --- a/drivers/unix/os_unix.cpp +++ b/drivers/unix/os_unix.cpp @@ -73,6 +73,23 @@ void OS_Unix::debug_break() { assert(false); }; +static void handle_interrupt(int sig) { + if (ScriptDebugger::get_singleton() == NULL) + return; + + ScriptDebugger::get_singleton()->set_depth(-1); + ScriptDebugger::get_singleton()->set_lines_left(1); +} + +void OS_Unix::initialize_debugging() { + + if (ScriptDebugger::get_singleton() != NULL) { + struct sigaction action; + action.sa_handler = handle_interrupt; + sigaction(SIGINT, &action, NULL); + } +} + int OS_Unix::unix_initialize_audio(int p_audio_driver) { return 0; diff --git a/drivers/unix/os_unix.h b/drivers/unix/os_unix.h index db0fe1e00b..95b74d23ff 100644 --- a/drivers/unix/os_unix.h +++ b/drivers/unix/os_unix.h @@ -101,6 +101,7 @@ public: virtual int get_processor_count() const; virtual void debug_break(); + virtual void initialize_debugging(); virtual String get_executable_path() const; virtual String get_user_data_dir() const; -- cgit v1.2.3