1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-05-31 06:48:12 +00:00

HackStudio: Gracefully handle unfound source files

This commit is contained in:
Itamar 2020-05-05 14:14:29 +03:00 committed by Andreas Kling
parent 5fd64045b1
commit b931771d24
3 changed files with 25 additions and 11 deletions

View file

@ -609,13 +609,17 @@ int main(int argc, char** argv)
dbg() << "Program stopped";
auto source_position = Debugger::the().session()->debug_info().get_source_position(regs.eip);
ASSERT(source_position.has_value());
if (!source_position.has_value()) {
dbg() << "Could not find source position for address: " << (void*)regs.eip;
return Debugger::HasControlPassedToUser::No;
}
current_editor_in_execution = get_editor_of_file(source_position.value().file_path);
current_editor_in_execution->editor().set_execution_position(source_position.value().line_number - 1);
debug_info_widget.update_variables(regs);
continue_action->set_enabled(true);
single_step_action->set_enabled(true);
reveal_action_tab(debug_info_widget);
return Debugger::HasControlPassedToUser::Yes;
},
[&]() {
dbg() << "Program continued";