HackStudio: Add icons for "step in" and "step out"
This commit is contained in:
parent
ebab512c03
commit
cb432ffe8c
Notes:
sideshowbarker
2024-07-19 03:20:13 +09:00
Author: https://github.com/itamar8910 Commit: https://github.com/SerenityOS/serenity/commit/cb432ffe8c2 Pull-request: https://github.com/SerenityOS/serenity/pull/3252
6 changed files with 21 additions and 20 deletions
BIN
Base/res/icons/16x16/debug-step-in.png
Normal file
BIN
Base/res/icons/16x16/debug-step-in.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 261 B |
BIN
Base/res/icons/16x16/debug-step-out.png
Normal file
BIN
Base/res/icons/16x16/debug-step-out.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 289 B |
|
@ -56,11 +56,19 @@ void DebugInfoWidget::init_toolbar()
|
|||
pthread_cond_signal(Debugger::the().continue_cond());
|
||||
pthread_mutex_unlock(Debugger::the().continue_mutex());
|
||||
});
|
||||
m_continue_action->set_enabled(false);
|
||||
m_singlestep_action->set_enabled(false);
|
||||
|
||||
m_step_in_action = GUI::Action::create("Step In", Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-in.png"), [&](auto&) {
|
||||
});
|
||||
|
||||
m_step_out_action = GUI::Action::create("Step Out", Gfx::Bitmap::load_from_file("/res/icons/16x16/debug-step-out.png"), [&](auto&) {
|
||||
});
|
||||
|
||||
m_toolbar->add_action(*m_continue_action);
|
||||
m_toolbar->add_action(*m_singlestep_action);
|
||||
m_toolbar->add_action(*m_step_in_action);
|
||||
m_toolbar->add_action(*m_step_out_action);
|
||||
|
||||
set_debug_actions_enabled(false);
|
||||
}
|
||||
|
||||
DebugInfoWidget::DebugInfoWidget()
|
||||
|
@ -140,16 +148,11 @@ void DebugInfoWidget::program_stopped()
|
|||
m_variables_view->set_model({});
|
||||
}
|
||||
|
||||
GUI::Action& DebugInfoWidget::continue_action()
|
||||
void DebugInfoWidget::set_debug_actions_enabled(bool enabled)
|
||||
{
|
||||
ASSERT(m_continue_action);
|
||||
return *m_continue_action;
|
||||
m_continue_action->set_enabled(enabled);
|
||||
m_singlestep_action->set_enabled(enabled);
|
||||
m_step_in_action->set_enabled(enabled);
|
||||
m_step_out_action->set_enabled(enabled);
|
||||
}
|
||||
|
||||
GUI::Action& DebugInfoWidget::singlestep_action()
|
||||
{
|
||||
ASSERT(m_singlestep_action);
|
||||
return *m_singlestep_action;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -45,9 +45,7 @@ public:
|
|||
|
||||
void update_state(const DebugSession&, const PtraceRegisters&);
|
||||
void program_stopped();
|
||||
|
||||
GUI::Action& continue_action();
|
||||
GUI::Action& singlestep_action();
|
||||
void set_debug_actions_enabled(bool enabled);
|
||||
|
||||
private:
|
||||
explicit DebugInfoWidget();
|
||||
|
@ -59,6 +57,8 @@ private:
|
|||
RefPtr<GUI::ToolBar> m_toolbar;
|
||||
RefPtr<GUI::Action> m_continue_action;
|
||||
RefPtr<GUI::Action> m_singlestep_action;
|
||||
RefPtr<GUI::Action> m_step_in_action;
|
||||
RefPtr<GUI::Action> m_step_out_action;
|
||||
};
|
||||
|
||||
}
|
||||
|
|
|
@ -78,7 +78,7 @@ void Debugger::on_breakpoint_change(const String& file, size_t line, BreakpointC
|
|||
auto address = session->debug_info().get_instruction_from_source(position.file_path, position.line_number);
|
||||
if (!address.has_value()) {
|
||||
dbg() << "Warning: couldn't get instruction address from source";
|
||||
// TODO: Currently, the GUI will indicate that a breakpoint was inserted/remove at this line,
|
||||
// TODO: Currently, the GUI will indicate that a breakpoint was inserted/removed at this line,
|
||||
// regardless of whether we actually succeeded to insert it. (For example a breakpoint on a comment, or an include statemanet).
|
||||
// We should indicate failure via a return value from this function, and not update the breakpoint GUI if we fail.
|
||||
return;
|
||||
|
|
|
@ -631,8 +631,7 @@ int main_impl(int argc, char** argv)
|
|||
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_state(*Debugger::the().session(), regs);
|
||||
debug_info_widget.continue_action().set_enabled(true);
|
||||
debug_info_widget.singlestep_action().set_enabled(true);
|
||||
debug_info_widget.set_debug_actions_enabled(true);
|
||||
reveal_action_tab(debug_info_widget);
|
||||
}));
|
||||
Core::EventLoop::wake();
|
||||
|
@ -642,8 +641,7 @@ int main_impl(int argc, char** argv)
|
|||
[&]() {
|
||||
dbg() << "Program continued";
|
||||
Core::EventLoop::main().post_event(*g_window, make<Core::DeferredInvocationEvent>([&](auto&) {
|
||||
debug_info_widget.continue_action().set_enabled(false);
|
||||
debug_info_widget.singlestep_action().set_enabled(false);
|
||||
debug_info_widget.set_debug_actions_enabled(false);
|
||||
if (current_editor_in_execution) {
|
||||
current_editor_in_execution->editor().clear_execution_position();
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue