diff --git a/src/debug.cc b/src/debug.cc index 88217f4..ec6b9b8 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -217,6 +217,30 @@ void Debug::kill() { event_mutex.unlock(); } +void Debug::step_over() { + event_mutex.lock(); + if(state==lldb::StateType::eStateStopped) { + process->GetSelectedThread().StepOver(); + } + event_mutex.unlock(); +} + +void Debug::step_into() { + event_mutex.lock(); + if(state==lldb::StateType::eStateStopped) { + process->GetSelectedThread().StepInto(); + } + event_mutex.unlock(); +} + +void Debug::step_out() { + event_mutex.lock(); + if(state==lldb::StateType::eStateStopped) { + process->GetSelectedThread().StepOut(); + } + event_mutex.unlock(); +} + std::pair Debug::run_command(const std::string &command) { std::pair command_return; event_mutex.lock(); diff --git a/src/debug.h b/src/debug.h index 0174167..44d8e1a 100644 --- a/src/debug.h +++ b/src/debug.h @@ -26,6 +26,9 @@ public: void continue_debug(); //can't use continue as function name void stop(); void kill(); + void step_over(); + void step_into(); + void step_out(); std::pair run_command(const std::string &command); void delete_debug(); //can't use delete as function name diff --git a/src/window.cc b/src/window.cc index 9a56018..582decc 100644 --- a/src/window.cc +++ b/src/window.cc @@ -872,25 +872,16 @@ void Window::set_menu_actions() { } }); menu.add_action("debug_step_over", [this]() { - if(debugging) { - auto command_return=Debug::get().run_command("thread step-over"); - Terminal::get().async_print(command_return.first); - Terminal::get().async_print(command_return.second, true); - } + if(debugging) + Debug::get().step_over(); }); menu.add_action("debug_step_into", [this]() { - if(debugging) { - auto command_return=Debug::get().run_command("thread step-in"); - Terminal::get().async_print(command_return.first); - Terminal::get().async_print(command_return.second, true); - } + if(debugging) + Debug::get().step_into(); }); menu.add_action("debug_step_out", [this]() { - if(debugging) { - auto command_return=Debug::get().run_command("thread step-out"); - Terminal::get().async_print(command_return.first); - Terminal::get().async_print(command_return.second, true); - } + if(debugging) + Debug::get().step_out(); }); menu.add_action("debug_run_command", [this]() { entry_box.clear();