summaryrefslogtreecommitdiff
path: root/main
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-09-14 16:20:02 +0200
committerGitHub <noreply@github.com>2021-09-14 16:20:02 +0200
commit3cc01b2824c01d2f231f8a3179cc55cad4b2f4ef (patch)
tree1f31d4c48ac0888e07568e73582f3caaac661d76 /main
parent1cec7057bfb2eea0f1c3ac5ab3731f279002e244 (diff)
parent4123612eeb54b8cf1e689be05c01fc1ead972d36 (diff)
Merge pull request #52226 from Faless/debugger/4.x_start_options
Diffstat (limited to 'main')
-rw-r--r--main/main.cpp17
1 files changed, 17 insertions, 0 deletions
diff --git a/main/main.cpp b/main/main.cpp
index fe6df43364..4b035fa511 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");
@@ -875,6 +877,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;
@@ -2347,6 +2361,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) {