HackStudio: Create a progress bar update callback for each debug session

Instead of moving it out of the Debugger, which would lead to it
being null when trying to create next debug sessions afterwards.
This commit is contained in:
0GreenClover0 2023-11-03 17:30:03 +01:00 committed by Andreas Kling
parent eeddbb6fa6
commit 8c7b393939
Notes: sideshowbarker 2024-07-17 01:46:00 +09:00

View File

@ -140,13 +140,24 @@ Debugger::CreateDebugSessionResult Debugger::create_debug_session()
return m_child_setup_callback();
return ErrorOr<void> {};
};
auto debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root, move(child_setup_callback), move(m_on_initialization_progress));
auto on_initialization_progress = [this](float progress) {
if (m_on_initialization_progress)
m_on_initialization_progress(progress);
};
auto debug_session = Debug::DebugSession::exec_and_attach(m_executable_path, m_source_root, move(child_setup_callback), move(on_initialization_progress));
VERIFY(!!debug_session);
return { debug_session.release_nonnull(), Debug::DebugSession::Running };
}
if (m_pid_to_attach.has_value()) {
auto debug_session = Debug::DebugSession::attach(m_pid_to_attach.value(), m_source_root, move(m_on_initialization_progress));
auto on_initialization_progress = [this](float progress) {
if (m_on_initialization_progress)
m_on_initialization_progress(progress);
};
auto debug_session = Debug::DebugSession::attach(m_pid_to_attach.value(), m_source_root, move(on_initialization_progress));
VERIFY(!!debug_session);
return { debug_session.release_nonnull(), Debug::DebugSession::Stopped };
}