Browse Source

Selecting variable in debug show variables now moves cursor to frame if no declaration was found

merge-requests/365/head
eidheim 10 years ago
parent
commit
70a1e106b1
  1. 15
      src/debug_lldb.cc
  2. 1
      src/debug_lldb.h
  3. 7
      src/project.cc

15
src/debug_lldb.cc

@ -358,6 +358,7 @@ std::vector<Debug::LLDB::Variable> Debug::LLDB::get_variables() {
auto declaration=value.GetDeclaration();
if(declaration.IsValid()) {
variable.declaration_found=true;
variable.line_nr=declaration.GetLine();
variable.line_index=declaration.GetColumn();
if(variable.line_index==0)
@ -367,6 +368,20 @@ std::vector<Debug::LLDB::Variable> Debug::LLDB::get_variables() {
variable.file_path=filesystem::get_canonical_path(file_spec.GetDirectory());
variable.file_path/=file_spec.GetFilename();
}
else {
variable.declaration_found=false;
auto line_entry=frame.GetLineEntry();
if(line_entry.IsValid()) {
variable.line_nr=line_entry.GetLine();
variable.line_index=line_entry.GetColumn();
if(variable.line_index==0)
variable.line_index=1;
auto file_spec=line_entry.GetFileSpec();
variable.file_path=filesystem::get_canonical_path(file_spec.GetDirectory());
variable.file_path/=file_spec.GetFilename();
}
}
variables.emplace_back(variable);
}
}

1
src/debug_lldb.h

@ -27,6 +27,7 @@ namespace Debug {
uint32_t frame_index;
std::string name;
std::string value;
bool declaration_found;
boost::filesystem::path file_path;
int line_nr;
int line_index;

7
src/project.cc

@ -476,17 +476,16 @@ void Project::Clang::debug_show_variables() {
view->selection_dialog->on_select=[this, rows](const std::string& selected, bool hide_window) {
auto variable=rows->at(selected);
Debug::LLDB::get().select_frame(variable.frame_index, variable.thread_index_id);
if(!variable.file_path.empty()) {
Notebook::get().open(variable.file_path);
if(auto view=Notebook::get().get_current_view()) {
Debug::LLDB::get().select_frame(variable.frame_index, variable.thread_index_id);
view->place_cursor_at_line_index(variable.line_nr-1, variable.line_index-1);
view->scroll_to_cursor_delayed(view, true, true);
}
}
else
Info::get().print("Debugger did not report declaration for the variable: "+variable.name);
if(!variable.declaration_found)
Info::get().print("Debugger did not find declaration for the variable: "+variable.name);
};
view->selection_dialog->on_hide=[this]() {

Loading…
Cancel
Save