HackStudio: Attach debuggee to "Console" terminal tab

Previously the debuggee process used the same tty of the HackStudio
process.

We now set things up so the debuggee gets attached to the
TerminalWrapper in the "Console" tab.
This commit is contained in:
Itamar 2021-12-20 22:42:03 +02:00 committed by Brian Gianforcaro
commit 1ec917aa23
Notes: sideshowbarker 2024-07-17 22:22:39 +09:00
3 changed files with 24 additions and 1 deletions

View file

@ -797,6 +797,20 @@ NonnullRefPtr<GUI::Action> HackStudioWidget::create_debug_action()
}
Debugger::the().set_executable_path(get_project_executable_path());
m_terminal_wrapper->clear_including_history();
// The debugger calls wait() on the debugee, so the TerminalWrapper can't do that.
auto ptm_res = m_terminal_wrapper->setup_master_pseudoterminal(TerminalWrapper::WaitForChildOnExit::No);
if (ptm_res.is_error()) {
perror("setup_master_pseudoterminal");
return;
}
Debugger::the().set_child_setup_callback([this, ptm_res]() {
return m_terminal_wrapper->setup_slave_pseudoterminal(ptm_res.value());
});
m_debugger_thread = Threading::Thread::construct(Debugger::start_static);
m_debugger_thread->start();
m_stop_action->set_enabled(true);