Support object inspection through DAP `evaluate` request
This commit is contained in:
parent
91cedc1e09
commit
870254b168
|
@ -492,9 +492,12 @@ Dictionary DebugAdapterParser::req_evaluate(const Dictionary &p_params) const {
|
||||||
|
|
||||||
Dictionary args = p_params["arguments"];
|
Dictionary args = p_params["arguments"];
|
||||||
|
|
||||||
String value = EditorDebuggerNode::get_singleton()->get_var_value(args["expression"]);
|
String eval = args["expression"];
|
||||||
|
String value = EditorDebuggerNode::get_singleton()->get_var_value(eval);
|
||||||
|
HashMap<String, DebugAdapterProtocol::DAPVarID>::ConstIterator variableID = DebugAdapterProtocol::get_singleton()->variable_eval_list.find(eval);
|
||||||
|
|
||||||
body["result"] = value;
|
body["result"] = value;
|
||||||
body["variablesReference"] = 0;
|
body["variablesReference"] = variableID ? variableID->value : 0;
|
||||||
|
|
||||||
return response;
|
return response;
|
||||||
}
|
}
|
||||||
|
|
|
@ -186,6 +186,7 @@ void DebugAdapterProtocol::reset_stack_info() {
|
||||||
|
|
||||||
stackframe_list.clear();
|
stackframe_list.clear();
|
||||||
variable_list.clear();
|
variable_list.clear();
|
||||||
|
variable_eval_list.clear();
|
||||||
object_list.clear();
|
object_list.clear();
|
||||||
object_pending_set.clear();
|
object_pending_set.clear();
|
||||||
}
|
}
|
||||||
|
@ -1131,6 +1132,9 @@ void DebugAdapterProtocol::on_debug_stack_frame_var(const Array &p_data) {
|
||||||
variable.value = stack_var.value;
|
variable.value = stack_var.value;
|
||||||
variable.type = Variant::get_type_name(stack_var.value.get_type());
|
variable.type = Variant::get_type_name(stack_var.value.get_type());
|
||||||
variable.variablesReference = parse_variant(stack_var.value);
|
variable.variablesReference = parse_variant(stack_var.value);
|
||||||
|
if (variable.variablesReference != 0) {
|
||||||
|
variable_eval_list.insert(variable.name, variable.variablesReference);
|
||||||
|
}
|
||||||
|
|
||||||
variable_list.find(var_id)->value.push_back(variable.to_json());
|
variable_list.find(var_id)->value.push_back(variable.to_json());
|
||||||
_remaining_vars--;
|
_remaining_vars--;
|
||||||
|
|
|
@ -125,6 +125,7 @@ private:
|
||||||
List<DAP::Breakpoint> breakpoint_list;
|
List<DAP::Breakpoint> breakpoint_list;
|
||||||
HashMap<DAP::StackFrame, List<int>, DAP::StackFrame> stackframe_list;
|
HashMap<DAP::StackFrame, List<int>, DAP::StackFrame> stackframe_list;
|
||||||
HashMap<DAPVarID, Array> variable_list;
|
HashMap<DAPVarID, Array> variable_list;
|
||||||
|
HashMap<String, DAPVarID> variable_eval_list;
|
||||||
|
|
||||||
HashMap<ObjectID, DAPVarID> object_list;
|
HashMap<ObjectID, DAPVarID> object_list;
|
||||||
HashSet<ObjectID> object_pending_set;
|
HashSet<ObjectID> object_pending_set;
|
||||||
|
|
Loading…
Reference in New Issue