1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Merge pull request #97218 from wenqiangwang/local_debuggger_expr_evalulation

Add support for `print` command in local (command line `-d`) debugger
This commit is contained in:
Thaddeus Crews
2024-11-12 12:13:13 -06:00
2 changed files with 28 additions and 4 deletions

View File

@@ -43,6 +43,7 @@
#include "core/config/engine.h"
#include "core/core_constants.h"
#include "core/io/file_access.h"
#include "core/math/expression.h"
#ifdef TOOLS_ENABLED
#include "core/config/project_settings.h"
@@ -427,7 +428,30 @@ void GDScriptLanguage::debug_get_globals(List<String> *p_globals, List<Variant>
}
String GDScriptLanguage::debug_parse_stack_level_expression(int p_level, const String &p_expression, int p_max_subitems, int p_max_depth) {
return "";
List<String> names;
List<Variant> values;
debug_get_stack_level_locals(p_level, &names, &values, p_max_subitems, p_max_depth);
Vector<String> name_vector;
for (const String &name : names) {
name_vector.push_back(name);
}
Array value_array;
for (const Variant &value : values) {
value_array.push_back(value);
}
Expression expression;
if (expression.parse(p_expression, name_vector) == OK) {
ScriptInstance *instance = debug_get_stack_level_instance(p_level);
if (instance) {
Variant return_val = expression.execute(value_array, instance->get_owner());
return return_val.get_construct_string();
}
}
return String();
}
void GDScriptLanguage::get_recognized_extensions(List<String> *p_extensions) const {