From 1e20e6cdd73b2584d84a4872ec825bdefc7ae69d Mon Sep 17 00:00:00 2001 From: eidheim Date: Sat, 9 Jan 2016 10:03:15 +0100 Subject: [PATCH] Now selects the frame when backtrace row is activated --- src/debug.cc | 12 ++++++++++++ src/debug.h | 2 ++ src/window.cc | 2 ++ 3 files changed, 16 insertions(+) diff --git a/src/debug.cc b/src/debug.cc index af354d5..68e3516 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -288,6 +288,9 @@ std::vector Debug::get_backtrace() { for(uint32_t c_f=0;c_f Debug::get_backtrace() { return backtrace; } +void Debug::select_frame(uint32_t index) { + event_mutex.lock(); + if(state==lldb::StateType::eStateStopped) { + auto thread=process->GetSelectedThread(); + thread.SetSelectedFrame(index); + } + event_mutex.unlock(); +} + void Debug::delete_debug() { kill(); if(debug_thread.joinable()) diff --git a/src/debug.h b/src/debug.h index e79b2fe..c8af1dc 100644 --- a/src/debug.h +++ b/src/debug.h @@ -13,6 +13,7 @@ class Debug { public: class Frame { public: + uint32_t index; std::string module_filename; std::string file_path; std::string function_name; @@ -40,6 +41,7 @@ public: void step_out(); std::pair run_command(const std::string &command); std::vector get_backtrace(); + void select_frame(uint32_t index); void delete_debug(); //can't use delete as function name diff --git a/src/window.cc b/src/window.cc index 7f675bd..9dbd011 100644 --- a/src/window.cc +++ b/src/window.cc @@ -939,6 +939,8 @@ void Window::set_menu_actions() { if(notebook.get_current_page()!=-1) { auto view=notebook.get_current_view(); + Debug::get().select_frame(frame.index); + view->get_buffer()->place_cursor(view->get_buffer()->get_iter_at_line_index(frame.line_nr-1, frame.line_index-1)); while(g_main_context_pending(NULL))