Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[3.x] Fix infinite loop on EOF in the command line debugger #80400

Merged
merged 1 commit into from
Aug 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions core/script_debugger_local.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
// Cache options
String variable_prefix = options["variable_prefix"];

if (line == "") {
if (line.empty() && !feof(stdin)) {
print_line("\nDebugger Break, Reason: '" + p_script->debug_get_error() + "'");
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) + "'");
print_line("Enter \"help\" for assistance.");
Expand Down Expand Up @@ -185,7 +185,7 @@ void ScriptDebuggerLocal::debug(ScriptLanguage *p_script, bool p_can_continue, b
print_line("Added breakpoint at " + source + ":" + itos(linenr));
}

} else if (line == "q" || line == "quit") {
} else if (line == "q" || line == "quit" || (line.empty() && feof(stdin))) {
// Do not stop again on quit
clear_breakpoints();
ScriptDebugger::get_singleton()->set_depth(-1);
Expand Down