Browse Source

Now selects the frame when backtrace row is activated

merge-requests/365/head
eidheim 10 years ago
parent
commit
1e20e6cdd7
  1. 12
      src/debug.cc
  2. 2
      src/debug.h
  3. 2
      src/window.cc

12
src/debug.cc

@ -288,6 +288,9 @@ std::vector<Debug::Frame> Debug::get_backtrace() {
for(uint32_t c_f=0;c_f<thread.GetNumFrames();c_f++) { for(uint32_t c_f=0;c_f<thread.GetNumFrames();c_f++) {
Frame backtrace_frame; Frame backtrace_frame;
auto frame=thread.GetFrameAtIndex(c_f); auto frame=thread.GetFrameAtIndex(c_f);
backtrace_frame.index=c_f;
auto function_name=frame.GetFunctionName(); auto function_name=frame.GetFunctionName();
if(function_name!=NULL) if(function_name!=NULL)
backtrace_frame.function_name=function_name; backtrace_frame.function_name=function_name;
@ -315,6 +318,15 @@ std::vector<Debug::Frame> Debug::get_backtrace() {
return 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() { void Debug::delete_debug() {
kill(); kill();
if(debug_thread.joinable()) if(debug_thread.joinable())

2
src/debug.h

@ -13,6 +13,7 @@ class Debug {
public: public:
class Frame { class Frame {
public: public:
uint32_t index;
std::string module_filename; std::string module_filename;
std::string file_path; std::string file_path;
std::string function_name; std::string function_name;
@ -40,6 +41,7 @@ public:
void step_out(); void step_out();
std::pair<std::string, std::string> run_command(const std::string &command); std::pair<std::string, std::string> run_command(const std::string &command);
std::vector<Frame> get_backtrace(); std::vector<Frame> get_backtrace();
void select_frame(uint32_t index);
void delete_debug(); //can't use delete as function name void delete_debug(); //can't use delete as function name

2
src/window.cc

@ -939,6 +939,8 @@ void Window::set_menu_actions() {
if(notebook.get_current_page()!=-1) { if(notebook.get_current_page()!=-1) {
auto view=notebook.get_current_view(); 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)); 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)) while(g_main_context_pending(NULL))

Loading…
Cancel
Save