You've already forked godot
mirror of
https://github.com/godotengine/godot.git
synced 2025-11-20 14:45:44 +00:00
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
This commit is contained in:
@@ -34,7 +34,6 @@
|
||||
#include "scene/main/scene_tree.h"
|
||||
|
||||
void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, bool p_is_error_breakpoint) {
|
||||
|
||||
if (!target_function.empty()) {
|
||||
String current_function = p_script->debug_get_stack_level_function(0);
|
||||
if (current_function != target_function) {
|
||||
@@ -51,7 +50,6 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
int current_frame = 0;
|
||||
int total_frames = p_script->debug_get_stack_level_count();
|
||||
while (true) {
|
||||
|
||||
OS::get_singleton()->print("debug> ");
|
||||
String line = OS::get_singleton()->get_stdin_string().strip_edges();
|
||||
|
||||
@@ -65,15 +63,12 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
} else if (line == "c" || line == "continue")
|
||||
break;
|
||||
else if (line == "bt" || line == "breakpoint") {
|
||||
|
||||
for (int i = 0; i < total_frames; i++) {
|
||||
|
||||
String cfi = (current_frame == i) ? "*" : " "; //current frame indicator
|
||||
print_line(cfi + "Frame " + itos(i) + " - " + p_script->debug_get_stack_level_source(i) + ":" + itos(p_script->debug_get_stack_level_line(i)) + " in function '" + p_script->debug_get_stack_level_function(i) + "'");
|
||||
}
|
||||
|
||||
} else if (line.begins_with("fr") || line.begins_with("frame")) {
|
||||
|
||||
if (line.get_slice_count(" ") == 1) {
|
||||
print_line("*Frame " + itos(current_frame) + " - " + p_script->debug_get_stack_level_source(current_frame) + ":" + itos(p_script->debug_get_stack_level_line(current_frame)) + " in function '" + p_script->debug_get_stack_level_function(current_frame) + "'");
|
||||
} else {
|
||||
@@ -87,9 +82,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
} else if (line.begins_with("set")) {
|
||||
|
||||
if (line.get_slice_count(" ") == 1) {
|
||||
|
||||
for (Map<String, String>::Element *E = options.front(); E; E = E->next()) {
|
||||
print_line("\t" + E->key() + "=" + E->value());
|
||||
}
|
||||
@@ -101,13 +94,11 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
if (value_pos < 0) {
|
||||
print_line("Error: Invalid set format. Use: set key=value");
|
||||
} else {
|
||||
|
||||
String key = key_value.left(value_pos);
|
||||
|
||||
if (!options.has(key)) {
|
||||
print_line("Error: Unknown option " + key);
|
||||
} else {
|
||||
|
||||
// Allow explicit tab character
|
||||
String value = key_value.right(value_pos + 1).replace("\\t", "\t");
|
||||
|
||||
@@ -117,49 +108,41 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
} else if (line == "lv" || line == "locals") {
|
||||
|
||||
List<String> locals;
|
||||
List<Variant> values;
|
||||
p_script->debug_get_stack_level_locals(current_frame, &locals, &values);
|
||||
print_variables(locals, values, variable_prefix);
|
||||
|
||||
} else if (line == "gv" || line == "globals") {
|
||||
|
||||
List<String> globals;
|
||||
List<Variant> values;
|
||||
p_script->debug_get_globals(&globals, &values);
|
||||
print_variables(globals, values, variable_prefix);
|
||||
|
||||
} else if (line == "mv" || line == "members") {
|
||||
|
||||
List<String> members;
|
||||
List<Variant> values;
|
||||
p_script->debug_get_stack_level_members(current_frame, &members, &values);
|
||||
print_variables(members, values, variable_prefix);
|
||||
|
||||
} else if (line.begins_with("p") || line.begins_with("print")) {
|
||||
|
||||
if (line.get_slice_count(" ") <= 1) {
|
||||
print_line("Usage: print <expre>");
|
||||
} else {
|
||||
|
||||
String expr = line.get_slicec(' ', 2);
|
||||
String res = p_script->debug_parse_stack_level_expression(current_frame, expr);
|
||||
print_line(res);
|
||||
}
|
||||
|
||||
} else if (line == "s" || line == "step") {
|
||||
|
||||
set_depth(-1);
|
||||
set_lines_left(1);
|
||||
break;
|
||||
} else if (line == "n" || line == "next") {
|
||||
|
||||
set_depth(0);
|
||||
set_lines_left(1);
|
||||
break;
|
||||
} else if (line == "fin" || line == "finish") {
|
||||
|
||||
String current_function = p_script->debug_get_stack_level_function(0);
|
||||
|
||||
for (int i = 0; i < total_frames; i++) {
|
||||
@@ -175,9 +158,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
target_function = "";
|
||||
|
||||
} else if (line.begins_with("br") || line.begins_with("break")) {
|
||||
|
||||
if (line.get_slice_count(" ") <= 1) {
|
||||
|
||||
const Map<int, Set<StringName>> &breakpoints = get_breakpoints();
|
||||
if (breakpoints.size() == 0) {
|
||||
print_line("No Breakpoints.");
|
||||
@@ -190,7 +171,6 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
Pair<String, int> breakpoint = to_breakpoint(line);
|
||||
|
||||
String source = breakpoint.first;
|
||||
@@ -205,7 +185,6 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
} else if (line == "q" || line == "quit") {
|
||||
|
||||
// Do not stop again on quit
|
||||
clear_breakpoints();
|
||||
ScriptDebugger::get_singleton()->set_depth(-1);
|
||||
@@ -214,11 +193,9 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
SceneTree::get_singleton()->quit();
|
||||
break;
|
||||
} else if (line.begins_with("delete")) {
|
||||
|
||||
if (line.get_slice_count(" ") <= 1) {
|
||||
clear_breakpoints();
|
||||
} else {
|
||||
|
||||
Pair<String, int> breakpoint = to_breakpoint(line);
|
||||
|
||||
String source = breakpoint.first;
|
||||
@@ -233,7 +210,6 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
} else if (line == "h" || line == "help") {
|
||||
|
||||
print_line("Built-In Debugger command list:\n");
|
||||
print_line("\tc,continue\t\t Continue execution.");
|
||||
print_line("\tbt,backtrace\t\t Show stack trace (frames).");
|
||||
@@ -256,18 +232,15 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::print_variables(const List<String> &names, const List<Variant> &values, const String &variable_prefix) {
|
||||
|
||||
String value;
|
||||
Vector<String> value_lines;
|
||||
const List<Variant>::Element *V = values.front();
|
||||
for (const List<String>::Element *E = names.front(); E; E = E->next()) {
|
||||
|
||||
value = String(V->get());
|
||||
|
||||
if (variable_prefix.empty()) {
|
||||
print_line(E->get() + ": " + String(V->get()));
|
||||
} else {
|
||||
|
||||
print_line(E->get() + ":");
|
||||
value_lines = value.split("\n");
|
||||
for (int i = 0; i < value_lines.size(); ++i) {
|
||||
@@ -280,7 +253,6 @@ void ScriptDebuggerLocal::print_variables(const List<String> &names, const List<
|
||||
}
|
||||
|
||||
Pair<String, int> ScriptDebuggerLocal::to_breakpoint(const String &p_line) {
|
||||
|
||||
String breakpoint_part = p_line.get_slicec(' ', 1);
|
||||
Pair<String, int> breakpoint;
|
||||
|
||||
@@ -297,14 +269,12 @@ Pair<String, int> ScriptDebuggerLocal::to_breakpoint(const String &p_line) {
|
||||
}
|
||||
|
||||
struct _ScriptDebuggerLocalProfileInfoSort {
|
||||
|
||||
bool operator()(const ScriptLanguage::ProfilingInfo &A, const ScriptLanguage::ProfilingInfo &B) const {
|
||||
return A.total_time > B.total_time;
|
||||
}
|
||||
};
|
||||
|
||||
void ScriptDebuggerLocal::profiling_set_frame_times(float p_frame_time, float p_idle_time, float p_physics_time, float p_physics_frame_time) {
|
||||
|
||||
frame_time = p_frame_time;
|
||||
idle_time = p_idle_time;
|
||||
physics_time = p_physics_time;
|
||||
@@ -312,7 +282,6 @@ void ScriptDebuggerLocal::profiling_set_frame_times(float p_frame_time, float p_
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::idle_poll() {
|
||||
|
||||
if (!profiling)
|
||||
return;
|
||||
|
||||
@@ -336,7 +305,6 @@ void ScriptDebuggerLocal::idle_poll() {
|
||||
uint64_t script_time_us = 0;
|
||||
|
||||
for (int i = 0; i < ofs; i++) {
|
||||
|
||||
script_time_us += pinfo[i].self_time;
|
||||
}
|
||||
|
||||
@@ -349,7 +317,6 @@ void ScriptDebuggerLocal::idle_poll() {
|
||||
print_line("FRAME: total: " + rtos(frame_time) + " script: " + rtos(script_time) + "/" + itos(script_time * 100 / total_time) + " %");
|
||||
|
||||
for (int i = 0; i < ofs; i++) {
|
||||
|
||||
print_line(itos(i) + ":" + pinfo[i].signature);
|
||||
float tt = USEC_TO_SEC(pinfo[i].total_time);
|
||||
float st = USEC_TO_SEC(pinfo[i].self_time);
|
||||
@@ -358,7 +325,6 @@ void ScriptDebuggerLocal::idle_poll() {
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::profiling_start() {
|
||||
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
ScriptServer::get_language(i)->profiling_start();
|
||||
}
|
||||
@@ -373,7 +339,6 @@ void ScriptDebuggerLocal::profiling_start() {
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::profiling_end() {
|
||||
|
||||
int ofs = 0;
|
||||
|
||||
for (int i = 0; i < ScriptServer::get_language_count(); i++) {
|
||||
@@ -391,7 +356,6 @@ void ScriptDebuggerLocal::profiling_end() {
|
||||
float total_time = total_us / 1000000.0;
|
||||
|
||||
for (int i = 0; i < ofs; i++) {
|
||||
|
||||
print_line(itos(i) + ":" + pinfo[i].signature);
|
||||
float tt = USEC_TO_SEC(pinfo[i].total_time);
|
||||
float st = USEC_TO_SEC(pinfo[i].self_time);
|
||||
@@ -406,18 +370,15 @@ void ScriptDebuggerLocal::profiling_end() {
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::send_message(const String &p_message, const Array &p_args) {
|
||||
|
||||
// This needs to be cleaned up entirely.
|
||||
// print_line("MESSAGE: '" + p_message + "' - " + String(Variant(p_args)));
|
||||
}
|
||||
|
||||
void ScriptDebuggerLocal::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) {
|
||||
|
||||
print_line("ERROR: '" + (p_descr.empty() ? p_err : p_descr) + "'");
|
||||
}
|
||||
|
||||
ScriptDebuggerLocal::ScriptDebuggerLocal() {
|
||||
|
||||
profiling = false;
|
||||
idle_accum = OS::get_singleton()->get_ticks_usec();
|
||||
options["variable_prefix"] = "";
|
||||
|
||||
Reference in New Issue
Block a user