HackStudio: Prevent crash when stepping through a program

The backtrace view expects that there is always a valid selection. This
is not true when we execute a step in the debugger. Therefore we need
to check if we have a valid selection in the on_selection_change
handler.
This commit is contained in:
Maurice Hieronymus 2021-07-11 18:28:16 +02:00 committed by Andreas Kling
parent ae8472f9ca
commit a205633643
Notes: sideshowbarker 2024-07-18 08:50:23 +09:00

View file

@ -67,8 +67,12 @@ DebugInfoWidget::DebugInfoWidget()
m_backtrace_view->on_selection_change = [this] {
const auto& index = m_backtrace_view->selection().first();
auto& model = static_cast<BacktraceModel&>(*m_backtrace_view->model());
if (!index.is_valid()) {
return;
}
auto& model = static_cast<BacktraceModel&>(*m_backtrace_view->model());
// Note: The reconstruction of the register set here is obviously incomplete.
// We currently only reconstruct eip & ebp. Ideally would also reconstruct the other registers somehow.
// (Other registers may be needed to get the values of variables who are not stored on the stack)