mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 07:47:35 +00:00
LibDebug: Make sure current_breakpoint has value before usage
Previously this caused a crash when no breakpoint was active since we tried to get value().address before the has_value() check.
This commit is contained in:
parent
643faa1144
commit
da8eea69e4
1 changed files with 23 additions and 21 deletions
|
@ -278,9 +278,10 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac
|
|||
|
||||
bool did_single_step = false;
|
||||
|
||||
auto current_breakpoint_address = bit_cast<FlatPtr>(current_breakpoint.value().address);
|
||||
// Re-enable the breakpoint if it wasn't removed by the user
|
||||
if (current_breakpoint.has_value() && m_breakpoints.contains(current_breakpoint_address)) {
|
||||
if (current_breakpoint.has_value()) {
|
||||
auto current_breakpoint_address = bit_cast<FlatPtr>(current_breakpoint.value().address);
|
||||
if (m_breakpoints.contains(current_breakpoint_address)) {
|
||||
// The current breakpoint was removed to make it transparent to the user.
|
||||
// We now want to re-enable it - the code execution flow could hit it again.
|
||||
// To re-enable the breakpoint, we first perform a single step and execute the
|
||||
|
@ -303,6 +304,7 @@ void DebugSession::run(DesiredInitialDebugeeState initial_debugee_state, Callbac
|
|||
state = State::ConsecutiveBreakpoint;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (decision == DebugDecision::SingleStep) {
|
||||
state = State::SingleStep;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue