summaryrefslogtreecommitdiff
path: root/DevTools
diff options
context:
space:
mode:
authorItamar <itamar8910@gmail.com>2020-08-21 11:51:32 +0300
committerAndreas Kling <kling@serenityos.org>2020-08-22 09:48:59 +0200
commitcb432ffe8c28a5a27daf2cf24ea2733a636e0a24 (patch)
tree99d9cab1f256bfc422dbe03c1694219a0dc41341 /DevTools
parentebab512c035cd559a2712988219deec952125831 (diff)
downloadserenity-cb432ffe8c28a5a27daf2cf24ea2733a636e0a24.zip
HackStudio: Add icons for "step in" and "step out"
Diffstat (limited to 'DevTools')
-rw-r--r--DevTools/HackStudio/Debugger/DebugInfoWidget.cpp27
-rw-r--r--DevTools/HackStudio/Debugger/DebugInfoWidget.h6
-rw-r--r--DevTools/HackStudio/Debugger/Debugger.cpp2
-rw-r--r--DevTools/HackStudio/main.cpp6
4 files changed, 21 insertions, 20 deletions
diff --git a/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp b/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
index db2f0ebc81..ee1a2cdfc9 100644
--- a/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
+++ b/DevTools/HackStudio/Debugger/DebugInfoWidget.cpp
@@ -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;
-}
-
}
diff --git a/DevTools/HackStudio/Debugger/DebugInfoWidget.h b/DevTools/HackStudio/Debugger/DebugInfoWidget.h
index 5e1bcd6918..727c89f912 100644
--- a/DevTools/HackStudio/Debugger/DebugInfoWidget.h
+++ b/DevTools/HackStudio/Debugger/DebugInfoWidget.h
@@ -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;
};
}
diff --git a/DevTools/HackStudio/Debugger/Debugger.cpp b/DevTools/HackStudio/Debugger/Debugger.cpp
index 2d2de35d25..6e65a794d7 100644
--- a/DevTools/HackStudio/Debugger/Debugger.cpp
+++ b/DevTools/HackStudio/Debugger/Debugger.cpp
@@ -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;
diff --git a/DevTools/HackStudio/main.cpp b/DevTools/HackStudio/main.cpp
index 2e36e748c9..989e57558e 100644
--- a/DevTools/HackStudio/main.cpp
+++ b/DevTools/HackStudio/main.cpp
@@ -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();
}