Removed ScriptDebuggerRemote.

This commit is contained in:
Relintai 2023-12-16 22:58:27 +01:00
parent 74204cdd37
commit c74948a3fd
7 changed files with 2 additions and 1529 deletions

View File

@ -52,7 +52,6 @@
#include "main/performance.h" #include "main/performance.h"
#include "modules/register_module_types.h" #include "modules/register_module_types.h"
#include "platform/register_platform_apis.h" #include "platform/register_platform_apis.h"
#include "scene/debugger/script_debugger_remote.h"
#include "scene/main/scene_tree.h" #include "scene/main/scene_tree.h"
#include "scene/main/viewport.h" #include "scene/main/viewport.h"
#include "scene/register_scene_types.h" #include "scene/register_scene_types.h"
@ -400,7 +399,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
bool upwards = false; bool upwards = false;
String debug_mode; String debug_mode;
String debug_host; String debug_host;
bool skip_breakpoints = false;
String main_pack; String main_pack;
bool quiet_stdout = false; bool quiet_stdout = false;
int rtm = -1; int rtm = -1;
@ -831,8 +829,6 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
print_fps = true; print_fps = true;
} else if (I->get() == "--disable-crash-handler") { } else if (I->get() == "--disable-crash-handler") {
OS::get_singleton()->disable_crash_handler(); OS::get_singleton()->disable_crash_handler();
} else if (I->get() == "--skip-breakpoints") {
skip_breakpoints = true;
} else if (I->get() == "--benchmark") { } else if (I->get() == "--benchmark") {
OS::get_singleton()->set_use_benchmark(true); OS::get_singleton()->set_use_benchmark(true);
} else if (I->get() == "--benchmark-file") { } else if (I->get() == "--benchmark-file") {
@ -912,28 +908,11 @@ Error Main::setup(const char *execpath, int argc, char *argv[], bool p_second_ph
GLOBAL_DEF_RST("network/limits/debugger_stdout/max_warnings_per_second", 100); GLOBAL_DEF_RST("network/limits/debugger_stdout/max_warnings_per_second", 100);
ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger_stdout/max_warnings_per_second", PropertyInfo(Variant::INT, "network/limits/debugger_stdout/max_warnings_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater")); ProjectSettings::get_singleton()->set_custom_property_info("network/limits/debugger_stdout/max_warnings_per_second", PropertyInfo(Variant::INT, "network/limits/debugger_stdout/max_warnings_per_second", PROPERTY_HINT_RANGE, "0, 200, 1, or_greater"));
if (debug_mode == "remote") { if (debug_mode == "local") {
ScriptDebuggerRemote *sdr = memnew(ScriptDebuggerRemote);
uint16_t debug_port = 6007;
if (debug_host.find(":") != -1) {
int sep_pos = debug_host.rfind(":");
debug_port = debug_host.substr(sep_pos + 1, debug_host.length()).to_int();
debug_host = debug_host.substr(0, sep_pos);
}
Error derr = sdr->connect_to_host(debug_host, debug_port);
sdr->set_skip_breakpoints(skip_breakpoints);
if (derr != OK) {
memdelete(sdr);
} else {
script_debugger = sdr;
sdr->set_allow_focus_steal_pid(allow_focus_steal_pid);
}
} else if (debug_mode == "local") {
script_debugger = memnew(ScriptDebuggerLocal); script_debugger = memnew(ScriptDebuggerLocal);
OS::get_singleton()->initialize_debugging(); OS::get_singleton()->initialize_debugging();
} }
if (script_debugger) { if (script_debugger) {
//there is a debugger, parse breakpoints //there is a debugger, parse breakpoints
@ -1719,12 +1698,6 @@ bool Main::start() {
if (!project_manager && !editor) { // game if (!project_manager && !editor) { // game
if (game_path != "" || script != "") { if (game_path != "" || script != "") {
if (script_debugger && script_debugger->is_remote()) {
ScriptDebuggerRemote *remote_debugger = static_cast<ScriptDebuggerRemote *>(script_debugger);
remote_debugger->set_scene_tree(sml);
}
//autoload //autoload
List<PropertyInfo> props; List<PropertyInfo> props;
ProjectSettings::get_singleton()->get_property_list(&props); ProjectSettings::get_singleton()->get_property_list(&props);

View File

@ -1,5 +0,0 @@
#!/usr/bin/env python
Import("env")
env.add_source_files(env.scene_sources, "*.cpp")

File diff suppressed because it is too large Load Diff

View File

@ -1,211 +0,0 @@
#ifndef SCRIPT_DEBUGGER_REMOTE_H
#define SCRIPT_DEBUGGER_REMOTE_H
/*************************************************************************/
/* script_debugger_remote.h */
/*************************************************************************/
/* This file is part of: */
/* GODOT ENGINE */
/* https://godotengine.org */
/*************************************************************************/
/* Copyright (c) 2007-2022 Juan Linietsky, Ariel Manzur. */
/* Copyright (c) 2014-2022 Godot Engine contributors (cf. AUTHORS.md). */
/* */
/* Permission is hereby granted, free of charge, to any person obtaining */
/* a copy of this software and associated documentation files (the */
/* "Software"), to deal in the Software without restriction, including */
/* without limitation the rights to use, copy, modify, merge, publish, */
/* distribute, sublicense, and/or sell copies of the Software, and to */
/* permit persons to whom the Software is furnished to do so, subject to */
/* the following conditions: */
/* */
/* The above copyright notice and this permission notice shall be */
/* included in all copies or substantial portions of the Software. */
/* */
/* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, */
/* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF */
/* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.*/
/* IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY */
/* CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, */
/* TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE */
/* SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */
/*************************************************************************/
#include "core/containers/list.h"
#include "core/io/packet_peer.h"
#include "core/io/stream_peer_tcp.h"
#include "core/object/script_language.h"
#include "core/os/os.h"
#include "core/os/thread.h"
class SceneTree;
class ScriptDebuggerRemote : public ScriptDebugger {
struct Message {
String message;
Array data;
};
struct ProfileInfoSort {
bool operator()(ScriptLanguage::ProfilingInfo *A, ScriptLanguage::ProfilingInfo *B) const {
return A->total_time < B->total_time;
}
};
Vector<ScriptLanguage::ProfilingInfo> profile_info;
Vector<ScriptLanguage::ProfilingInfo *> profile_info_ptrs;
Vector<MultiplayerAPI::ProfilingInfo> network_profile_info;
RBMap<StringName, int> profiler_function_signature_map;
float frame_time, process_time, physics_time, physics_frame_time;
bool profiling;
bool profiling_network;
int max_frame_functions;
bool skip_profile_frame;
bool reload_all_scripts;
Ref<StreamPeerTCP> tcp_client;
Ref<PacketPeerStream> packet_peer_stream;
uint64_t last_perf_time;
uint64_t last_net_prof_time;
uint64_t last_net_bandwidth_time;
Object *performance;
bool requested_quit;
Mutex mutex;
struct OutputError {
int hr;
int min;
int sec;
int msec;
String source_file;
String source_func;
int source_line;
String error;
String error_descr;
bool warning;
Array callstack;
};
struct OutputString {
String message;
int type;
Thread::ID thread;
};
List<OutputString> output_strings;
HashMap<Thread::ID, List<Message>> incoming_messages;
HashMap<Thread::ID, List<Message>> outgoing_messages;
int max_messages_per_frame;
int n_messages_dropped;
List<OutputError> errors;
int max_errors_per_second;
int max_warnings_per_second;
int n_errors_dropped;
int n_warnings_dropped;
int max_cps;
int char_count;
int err_count;
int warn_count;
uint64_t last_msec;
uint64_t msec_count;
OS::ProcessID allow_focus_steal_pid;
bool locking; //hack to avoid a deadloop
static void _print_handler(void *p_this, const String &p_string, bool p_error);
PrintHandlerList phl;
void _poll_messages();
bool _has_incoming_messages();
Array _get_incoming_message();
bool _has_outgoing_messages();
Message _get_outgoing_message();
void _get_output();
void _poll_events();
uint32_t poll_every;
SceneTree *scene_tree;
void _set_object_property(ObjectID p_id, const String &p_property, const Variant &p_value);
void _send_object_id(ObjectID p_id);
void _send_video_memory();
Ref<MultiplayerAPI> multiplayer;
ErrorHandlerList eh;
static void _err_handler(void *, const char *, const char *, int p_line, const char *, const char *, ErrorHandlerType p_type);
void _send_profiling_data(bool p_for_frame);
void _send_network_profiling_data();
void _send_network_bandwidth_usage();
struct FrameData {
StringName name;
Array data;
};
Vector<FrameData> profile_frame_data;
void _put_variable(const String &p_name, const Variant &p_variable);
void _save_node(ObjectID id, const String &p_path);
bool skip_breakpoints;
public:
enum MessageType {
MESSAGE_TYPE_LOG,
MESSAGE_TYPE_ERROR,
};
struct ResourceUsage {
String path;
String format;
String type;
RID id;
int vram;
bool operator<(const ResourceUsage &p_img) const { return vram == p_img.vram ? id < p_img.id : vram > p_img.vram; }
};
typedef void (*ResourceUsageFunc)(List<ResourceUsage> *);
static ResourceUsageFunc resource_usage_func;
Error connect_to_host(const String &p_host, uint16_t p_port);
virtual void debug(ScriptLanguage *p_script, bool p_can_continue = true, bool p_is_error_breakpoint = false);
virtual void idle_poll();
virtual void line_poll();
virtual bool is_remote() const { return true; }
virtual void request_quit();
virtual void send_message(const String &p_message, const Array &p_args);
virtual void send_error(const String &p_func, const String &p_file, int p_line, const String &p_err, const String &p_descr, ErrorHandlerType p_type, const Vector<ScriptLanguage::StackInfo> &p_stack_info);
virtual void set_multiplayer(Ref<MultiplayerAPI> p_multiplayer);
virtual bool is_profiling() const;
virtual void add_profiling_frame_data(const StringName &p_name, const Array &p_data);
virtual void profiling_start();
virtual void profiling_end();
virtual void profiling_set_frame_times(float p_frame_time, float p_process_time, float p_physics_time, float p_physics_frame_time);
virtual void set_skip_breakpoints(bool p_skip_breakpoints);
void set_scene_tree(SceneTree *p_scene_tree) { scene_tree = p_scene_tree; };
void set_allow_focus_steal_pid(OS::ProcessID p_pid);
ScriptDebuggerRemote();
~ScriptDebuggerRemote();
};
#endif // SCRIPT_DEBUGGER_REMOTE_H

View File

@ -43,7 +43,6 @@
#include "main/input_default.h" #include "main/input_default.h"
#include "node.h" #include "node.h"
#include "scene/animation/scene_tree_tween.h" #include "scene/animation/scene_tree_tween.h"
#include "scene/debugger/script_debugger_remote.h"
#include "scene/main/control.h" #include "scene/main/control.h"
#include "scene/main/scene_string_names.h" #include "scene/main/scene_string_names.h"
#include "scene/resources/material/material.h" #include "scene/resources/material/material.h"
@ -2017,11 +2016,6 @@ SceneTree::SceneTree() {
_update_root_rect(); _update_root_rect();
if (ScriptDebugger::get_singleton()) { if (ScriptDebugger::get_singleton()) {
if (ScriptDebugger::get_singleton()->is_remote()) {
ScriptDebuggerRemote *remote_debugger = static_cast<ScriptDebuggerRemote *>(ScriptDebugger::get_singleton());
remote_debugger->set_scene_tree(this);
}
ScriptDebugger::get_singleton()->set_multiplayer(multiplayer); ScriptDebugger::get_singleton()->set_multiplayer(multiplayer);
} }

View File

@ -227,8 +227,6 @@ private:
SelfList<Node>::List xform_change_list; SelfList<Node>::List xform_change_list;
friend class ScriptDebuggerRemote;
Ref<ShortCut> debugger_stop_shortcut; Ref<ShortCut> debugger_stop_shortcut;
enum { enum {

View File

@ -55,29 +55,9 @@
#include "physics_2d/physics_2d_server_sw.h" #include "physics_2d/physics_2d_server_sw.h"
#include "physics_2d/physics_2d_server_wrap_mt.h" #include "physics_2d/physics_2d_server_wrap_mt.h"
#include "rendering/shader_types.h" #include "rendering/shader_types.h"
#include "scene/debugger/script_debugger_remote.h"
#include "servers/physics_2d_server.h" #include "servers/physics_2d_server.h"
#include "servers/rendering_server.h" #include "servers/rendering_server.h"
static void _debugger_get_resource_usage(List<ScriptDebuggerRemote::ResourceUsage> *r_usage) {
List<RS::TextureInfo> tinfo;
RS::get_singleton()->texture_debug_usage(&tinfo);
for (List<RS::TextureInfo>::Element *E = tinfo.front(); E; E = E->next()) {
ScriptDebuggerRemote::ResourceUsage usage;
usage.path = E->get().path;
usage.vram = E->get().bytes;
usage.id = E->get().texture;
usage.type = "Texture";
if (E->get().depth == 0) {
usage.format = itos(E->get().width) + "x" + itos(E->get().height) + " " + Image::get_format_name(E->get().format);
} else {
usage.format = itos(E->get().width) + "x" + itos(E->get().height) + "x" + itos(E->get().depth) + " " + Image::get_format_name(E->get().format);
}
r_usage->push_back(usage);
}
}
ShaderTypes *shader_types = nullptr; ShaderTypes *shader_types = nullptr;
Physics2DServer *_createPandemoniumPhysics2DCallback() { Physics2DServer *_createPandemoniumPhysics2DCallback() {
@ -161,8 +141,6 @@ void register_server_types() {
ClassDB::register_class<Physics2DTestMotionResult>(); ClassDB::register_class<Physics2DTestMotionResult>();
ClassDB::register_class<Physics2DShapeQueryParameters>(); ClassDB::register_class<Physics2DShapeQueryParameters>();
ScriptDebuggerRemote::resource_usage_func = _debugger_get_resource_usage;
// Physics 2D // Physics 2D
GLOBAL_DEF(Physics2DServerManager::setting_property_name, "DEFAULT"); GLOBAL_DEF(Physics2DServerManager::setting_property_name, "DEFAULT");
ProjectSettings::get_singleton()->set_custom_property_info(Physics2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Physics2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT")); ProjectSettings::get_singleton()->set_custom_property_info(Physics2DServerManager::setting_property_name, PropertyInfo(Variant::STRING, Physics2DServerManager::setting_property_name, PROPERTY_HINT_ENUM, "DEFAULT"));