diff options
author | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-08-29 01:58:15 +0200 |
---|---|---|
committer | Fabio Alessandrelli <fabio.alessandrelli@gmail.com> | 2021-08-29 18:03:20 +0200 |
commit | 4123612eeb54b8cf1e689be05c01fc1ead972d36 (patch) | |
tree | 1ad5a54d55f129e0c6da84cc863f0f88ae80f7bf | |
parent | ecb2e8297c64c0f909878f379b408a3a17779715 (diff) |
[Editor] Add "--debug-server <uri>" option.
Allow starting the editor debugger server for the given protocol (and
optionally bound to the given ip/port combination:
godot -e --debug-server tcp://*:8080
-rw-r--r-- | main/main.cpp | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp index 44c0ba4902..cd2849adc0 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -145,6 +145,7 @@ static bool auto_quit = false; static OS::ProcessID allow_focus_steal_pid = 0; #ifdef TOOLS_ENABLED static bool auto_build_solutions = false; +static String debug_server_uri; #endif // Display @@ -286,6 +287,7 @@ void Main::print_help(const char *p_binary) { #ifdef TOOLS_ENABLED OS::get_singleton()->print(" -e, --editor Start the editor instead of running the scene.\n"); OS::get_singleton()->print(" -p, --project-manager Start the project manager, even if a project is auto-detected.\n"); + OS::get_singleton()->print(" --debug-server <uri> Start the editor debug server (<protocol>://<host/IP>[:<port>], e.g. tcp://127.0.0.1:6007)\n"); #endif OS::get_singleton()->print(" -q, --quit Quit after the first iteration.\n"); OS::get_singleton()->print(" -l, --language <locale> Use a specific locale (<locale> being a two-letter code).\n"); @@ -874,6 +876,18 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph } else if (I->get() == "-p" || I->get() == "--project-manager") { // starts project manager project_manager = true; + } else if (I->get() == "--debug-server") { + if (I->next()) { + debug_server_uri = I->next()->get(); + if (debug_server_uri.find("://") == -1) { // wrong address + OS::get_singleton()->print("Invalid debug server uri. It should be of the form <protocol>://<bind_address>:<port>.\n"); + goto error; + } + N = I->next()->next(); + } else { + OS::get_singleton()->print("Missing remote debug server uri, aborting.\n"); + goto error; + } } else if (I->get() == "--build-solutions") { // Build the scripting solution such C# auto_build_solutions = true; @@ -2346,6 +2360,9 @@ bool Main::start() { } } DisplayServer::get_singleton()->set_context(DisplayServer::CONTEXT_EDITOR); + if (!debug_server_uri.is_empty()) { + EditorDebuggerNode::get_singleton()->start(debug_server_uri); + } } #endif if (!editor) { |