diff options
Diffstat (limited to 'editor/debugger/debug_adapter')
7 files changed, 58 insertions, 29 deletions
diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.cpp b/editor/debugger/debug_adapter/debug_adapter_parser.cpp index 485d58f4a3..e7baeeeded 100644 --- a/editor/debugger/debug_adapter/debug_adapter_parser.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_parser.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ @@ -34,6 +34,7 @@ #include "editor/debugger/script_editor_debugger.h" #include "editor/editor_node.h" #include "editor/editor_run_native.h" +#include "editor/plugins/script_editor_plugin.h" void DebugAdapterParser::_bind_methods() { // Requests @@ -109,7 +110,7 @@ Dictionary DebugAdapterParser::prepare_error_response(const Dictionary &p_params case DAP::ErrorType::UNKNOWN: default: error = "unknown"; - error_desc = "An unknown error has ocurred when processing the request."; + error_desc = "An unknown error has occurred when processing the request."; break; } @@ -412,7 +413,7 @@ Dictionary DebugAdapterParser::req_scopes(const Dictionary &p_params) const { } Dictionary DebugAdapterParser::req_variables(const Dictionary &p_params) const { - // If _remaining_vars > 0, the debugee is still sending a stack dump to the editor. + // If _remaining_vars > 0, the debuggee is still sending a stack dump to the editor. if (DebugAdapterProtocol::get_singleton()->_remaining_vars > 0) { return Dictionary(); } diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.h b/editor/debugger/debug_adapter/debug_adapter_parser.h index 4c93464e39..f458151e17 100644 --- a/editor/debugger/debug_adapter/debug_adapter_parser.h +++ b/editor/debugger/debug_adapter/debug_adapter_parser.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp index 2e0e6cb7c8..babe8af8bc 100644 --- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ @@ -192,10 +192,12 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::VECTOR2I: { int id = variable_id++; Vector2 vec = p_var; + const String type_scalar = Variant::get_type_name(p_var.get_type() == Variant::VECTOR2 ? Variant::FLOAT : Variant::INT); DAP::Variable x, y; x.name = "x"; y.name = "y"; - x.type = y.type = Variant::get_type_name(p_var.get_type() == Variant::VECTOR2 ? Variant::FLOAT : Variant::INT); + x.type = type_scalar; + y.type = type_scalar; x.value = rtos(vec.x); y.value = rtos(vec.y); @@ -209,12 +211,16 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::RECT2I: { int id = variable_id++; Rect2 rect = p_var; + const String type_scalar = Variant::get_type_name(p_var.get_type() == Variant::RECT2 ? Variant::FLOAT : Variant::INT); DAP::Variable x, y, w, h; x.name = "x"; y.name = "y"; w.name = "w"; h.name = "h"; - x.type = y.type = w.type = h.type = Variant::get_type_name(p_var.get_type() == Variant::RECT2 ? Variant::FLOAT : Variant::INT); + x.type = type_scalar; + y.type = type_scalar; + w.type = type_scalar; + h.type = type_scalar; x.value = rtos(rect.position.x); y.value = rtos(rect.position.y); w.value = rtos(rect.size.x); @@ -232,11 +238,14 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::VECTOR3I: { int id = variable_id++; Vector3 vec = p_var; + const String type_scalar = Variant::get_type_name(p_var.get_type() == Variant::VECTOR3 ? Variant::FLOAT : Variant::INT); DAP::Variable x, y, z; x.name = "x"; y.name = "y"; z.name = "z"; - x.type = y.type = z.type = Variant::get_type_name(p_var.get_type() == Variant::VECTOR3 ? Variant::FLOAT : Variant::INT); + x.type = type_scalar; + y.type = type_scalar; + z.type = type_scalar; x.value = rtos(vec.x); y.value = rtos(vec.y); z.value = rtos(vec.z); @@ -251,11 +260,14 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::TRANSFORM2D: { int id = variable_id++; Transform2D transform = p_var; + const String type_vec2 = Variant::get_type_name(Variant::VECTOR2); DAP::Variable x, y, origin; x.name = "x"; y.name = "y"; origin.name = "origin"; - x.type = y.type = origin.type = Variant::get_type_name(Variant::VECTOR2); + x.type = type_vec2; + y.type = type_vec2; + origin.type = type_vec2; x.value = transform.elements[0]; y.value = transform.elements[1]; origin.value = transform.elements[2]; @@ -291,12 +303,16 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::QUATERNION: { int id = variable_id++; Quaternion quat = p_var; + const String type_float = Variant::get_type_name(Variant::FLOAT); DAP::Variable x, y, z, w; x.name = "x"; y.name = "y"; z.name = "z"; w.name = "w"; - x.type = y.type = z.type = w.type = Variant::get_type_name(Variant::FLOAT); + x.type = type_float; + y.type = type_float; + z.type = type_float; + w.type = type_float; x.value = rtos(quat.x); y.value = rtos(quat.y); z.value = rtos(quat.z); @@ -313,10 +329,12 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::AABB: { int id = variable_id++; AABB aabb = p_var; + const String type_vec3 = Variant::get_type_name(Variant::VECTOR3); DAP::Variable position, size; position.name = "position"; size.name = "size"; - position.type = size.type = Variant::get_type_name(Variant::VECTOR3); + position.type = type_vec3; + size.type = type_vec3; position.value = aabb.position; size.value = aabb.size; position.variablesReference = parse_variant(aabb.position); @@ -331,11 +349,14 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::BASIS: { int id = variable_id++; Basis basis = p_var; + const String type_vec2 = Variant::get_type_name(Variant::VECTOR2); DAP::Variable x, y, z; x.name = "x"; y.name = "y"; z.name = "z"; - x.type = y.type = z.type = Variant::get_type_name(Variant::VECTOR2); + x.type = type_vec2; + y.type = type_vec2; + z.type = type_vec2; x.value = basis.elements[0]; y.value = basis.elements[1]; z.value = basis.elements[2]; @@ -372,12 +393,16 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) { case Variant::COLOR: { int id = variable_id++; Color color = p_var; + const String type_float = Variant::get_type_name(Variant::FLOAT); DAP::Variable r, g, b, a; r.name = "r"; g.name = "g"; b.name = "b"; a.name = "a"; - r.type = g.type = b.type = a.type = Variant::get_type_name(Variant::FLOAT); + r.type = type_float; + g.type = type_float; + b.type = type_float; + a.type = type_float; r.value = rtos(color.r); g.value = rtos(color.g); b.value = rtos(color.b); diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.h b/editor/debugger/debug_adapter/debug_adapter_protocol.h index d4291992bf..e4760bea54 100644 --- a/editor/debugger/debug_adapter/debug_adapter_protocol.h +++ b/editor/debugger/debug_adapter/debug_adapter_protocol.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ @@ -76,7 +76,7 @@ class DebugAdapterProtocol : public Object { private: static DebugAdapterProtocol *singleton; - DebugAdapterParser *parser; + DebugAdapterParser *parser = nullptr; List<Ref<DAPeer>> clients; Ref<TCPServer> server; diff --git a/editor/debugger/debug_adapter/debug_adapter_server.cpp b/editor/debugger/debug_adapter/debug_adapter_server.cpp index 4775e2c8b0..e9fc7ec913 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.cpp +++ b/editor/debugger/debug_adapter/debug_adapter_server.cpp @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ @@ -42,12 +42,14 @@ DebugAdapterServer::DebugAdapterServer() { void DebugAdapterServer::_notification(int p_what) { switch (p_what) { - case NOTIFICATION_ENTER_TREE: + case NOTIFICATION_ENTER_TREE: { start(); - break; - case NOTIFICATION_EXIT_TREE: + } break; + + case NOTIFICATION_EXIT_TREE: { stop(); - break; + } break; + case NOTIFICATION_INTERNAL_PROCESS: { // The main loop can be run again during request processing, which modifies internal state of the protocol. // Thus, "polling" is needed to prevent it from parsing other requests while the current one isn't finished. @@ -57,6 +59,7 @@ void DebugAdapterServer::_notification(int p_what) { polling = false; } } break; + case EditorSettings::NOTIFICATION_EDITOR_SETTINGS_CHANGED: { protocol._request_timeout = EditorSettings::get_singleton()->get("network/debug_adapter/request_timeout"); protocol._sync_breakpoints = EditorSettings::get_singleton()->get("network/debug_adapter/sync_breakpoints"); diff --git a/editor/debugger/debug_adapter/debug_adapter_server.h b/editor/debugger/debug_adapter/debug_adapter_server.h index c449403cc2..a2b01f92c6 100644 --- a/editor/debugger/debug_adapter/debug_adapter_server.h +++ b/editor/debugger/debug_adapter/debug_adapter_server.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ diff --git a/editor/debugger/debug_adapter/debug_adapter_types.h b/editor/debugger/debug_adapter/debug_adapter_types.h index 5156c91d14..77b70909b3 100644 --- a/editor/debugger/debug_adapter/debug_adapter_types.h +++ b/editor/debugger/debug_adapter/debug_adapter_types.h @@ -5,8 +5,8 @@ /* GODOT ENGINE */ /* https://godotengine.org */ /*************************************************************************/ -/* Copyright (c) 2007-2021 Juan Linietsky, Ariel Manzur. */ -/* Copyright (c) 2014-2021 Godot Engine contributors (cf. AUTHORS.md). */ +/* 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 */ |