summaryrefslogtreecommitdiff
path: root/editor/debugger/debug_adapter
diff options
context:
space:
mode:
Diffstat (limited to 'editor/debugger/debug_adapter')
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_parser.cpp14
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.cpp40
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_protocol.h12
-rw-r--r--editor/debugger/debug_adapter/debug_adapter_types.h7
4 files changed, 38 insertions, 35 deletions
diff --git a/editor/debugger/debug_adapter/debug_adapter_parser.cpp b/editor/debugger/debug_adapter/debug_adapter_parser.cpp
index e7baeeeded..0caeb90108 100644
--- a/editor/debugger/debug_adapter/debug_adapter_parser.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_parser.cpp
@@ -381,12 +381,12 @@ Dictionary DebugAdapterParser::req_scopes(const Dictionary &p_params) const {
DAP::StackFrame frame;
frame.id = frame_id;
- Map<DAP::StackFrame, List<int>>::Element *E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
+ HashMap<DAP::StackFrame, List<int>, DAP::StackFrame>::Iterator E = DebugAdapterProtocol::get_singleton()->stackframe_list.find(frame);
if (E) {
- ERR_FAIL_COND_V(E->value().size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
+ ERR_FAIL_COND_V(E->value.size() != 3, prepare_error_response(p_params, DAP::ErrorType::UNKNOWN));
for (int i = 0; i < 3; i++) {
DAP::Scope scope;
- scope.variablesReference = E->value()[i];
+ scope.variablesReference = E->value[i];
switch (i) {
case 0:
scope.name = "Locals";
@@ -424,16 +424,16 @@ Dictionary DebugAdapterParser::req_variables(const Dictionary &p_params) const {
Dictionary args = p_params["arguments"];
int variable_id = args["variablesReference"];
- Map<int, Array>::Element *E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
+ HashMap<int, Array>::Iterator E = DebugAdapterProtocol::get_singleton()->variable_list.find(variable_id);
if (E) {
if (!DebugAdapterProtocol::get_singleton()->get_current_peer()->supportsVariableType) {
- for (int i = 0; i < E->value().size(); i++) {
- Dictionary variable = E->value()[i];
+ for (int i = 0; i < E->value.size(); i++) {
+ Dictionary variable = E->value[i];
variable.erase("type");
}
}
- body["variables"] = E ? E->value() : Array();
+ body["variables"] = E ? E->value : Array();
return response;
} else {
return Dictionary();
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
index babe8af8bc..92ea0f15e9 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.cpp
@@ -268,12 +268,12 @@ int DebugAdapterProtocol::parse_variant(const Variant &p_var) {
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];
- x.variablesReference = parse_variant(transform.elements[0]);
- y.variablesReference = parse_variant(transform.elements[1]);
- origin.variablesReference = parse_variant(transform.elements[2]);
+ x.value = transform.columns[0];
+ y.value = transform.columns[1];
+ origin.value = transform.columns[2];
+ x.variablesReference = parse_variant(transform.columns[0]);
+ y.variablesReference = parse_variant(transform.columns[1]);
+ origin.variablesReference = parse_variant(transform.columns[2]);
Array arr;
arr.push_back(x.to_json());
@@ -349,20 +349,20 @@ 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);
+ const String type_vec3 = Variant::get_type_name(Variant::VECTOR3);
DAP::Variable x, y, z;
x.name = "x";
y.name = "y";
z.name = "z";
- 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];
- x.variablesReference = parse_variant(basis.elements[0]);
- y.variablesReference = parse_variant(basis.elements[1]);
- z.variablesReference = parse_variant(basis.elements[2]);
+ x.type = type_vec3;
+ y.type = type_vec3;
+ z.type = type_vec3;
+ x.value = basis.rows[0];
+ y.value = basis.rows[1];
+ z.value = basis.rows[2];
+ x.variablesReference = parse_variant(basis.rows[0]);
+ y.variablesReference = parse_variant(basis.rows[1]);
+ z.variablesReference = parse_variant(basis.rows[2]);
Array arr;
arr.push_back(x.to_json());
@@ -918,11 +918,11 @@ void DebugAdapterProtocol::on_debug_stack_frame_vars(const int &p_size) {
DAP::StackFrame frame;
frame.id = _current_frame;
ERR_FAIL_COND(!stackframe_list.has(frame));
- List<int> scope_ids = stackframe_list.find(frame)->value();
+ List<int> scope_ids = stackframe_list.find(frame)->value;
for (List<int>::Element *E = scope_ids.front(); E; E = E->next()) {
int variable_id = E->get();
if (variable_list.has(variable_id)) {
- variable_list.find(variable_id)->value().clear();
+ variable_list.find(variable_id)->value.clear();
} else {
variable_list.insert(variable_id, Array());
}
@@ -937,7 +937,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
DAP::StackFrame frame;
frame.id = _current_frame;
- List<int> scope_ids = stackframe_list.find(frame)->value();
+ List<int> scope_ids = stackframe_list.find(frame)->value;
ERR_FAIL_COND(scope_ids.size() != 3);
ERR_FAIL_INDEX(stack_var.type, 3);
int variable_id = scope_ids[stack_var.type];
@@ -949,7 +949,7 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
variable.type = Variant::get_type_name(stack_var.value.get_type());
variable.variablesReference = parse_variant(stack_var.value);
- variable_list.find(variable_id)->value().push_back(variable.to_json());
+ variable_list.find(variable_id)->value.push_back(variable.to_json());
_remaining_vars--;
}
diff --git a/editor/debugger/debug_adapter/debug_adapter_protocol.h b/editor/debugger/debug_adapter/debug_adapter_protocol.h
index b54a5f1f3f..a17e550dfc 100644
--- a/editor/debugger/debug_adapter/debug_adapter_protocol.h
+++ b/editor/debugger/debug_adapter/debug_adapter_protocol.h
@@ -76,7 +76,7 @@ class DebugAdapterProtocol : public Object {
private:
static DebugAdapterProtocol *singleton;
- DebugAdapterParser *parser;
+ DebugAdapterParser *parser = nullptr;
List<Ref<DAPeer>> clients;
Ref<TCPServer> server;
@@ -111,12 +111,12 @@ private:
String _current_request;
Ref<DAPeer> _current_peer;
- int breakpoint_id;
- int stackframe_id;
- int variable_id;
+ int breakpoint_id = 0;
+ int stackframe_id = 0;
+ int variable_id = 0;
List<DAP::Breakpoint> breakpoint_list;
- Map<DAP::StackFrame, List<int>> stackframe_list;
- Map<int, Array> variable_list;
+ HashMap<DAP::StackFrame, List<int>, DAP::StackFrame> stackframe_list;
+ HashMap<int, Array> variable_list;
public:
friend class DebugAdapterServer;
diff --git a/editor/debugger/debug_adapter/debug_adapter_types.h b/editor/debugger/debug_adapter/debug_adapter_types.h
index 77b70909b3..4d77b6d51c 100644
--- a/editor/debugger/debug_adapter/debug_adapter_types.h
+++ b/editor/debugger/debug_adapter/debug_adapter_types.h
@@ -219,8 +219,11 @@ struct StackFrame {
int line;
int column;
- bool operator<(const StackFrame &p_other) const {
- return id < p_other.id;
+ static uint32_t hash(const StackFrame &p_frame) {
+ return hash_djb2_one_32(p_frame.id);
+ }
+ bool operator==(const StackFrame &p_other) const {
+ return id == p_other.id;
}
_FORCE_INLINE_ void from_json(const Dictionary &p_params) {