diff --git a/src/debug.cc b/src/debug.cc index e1744e2..7756e78 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -172,20 +172,45 @@ void Debug::delete_debug() { debug_thread.join(); } -std::string Debug::get_value(const std::string &variable) { +std::string Debug::get_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr) { std::string variable_value; event_mutex.lock(); if(state==lldb::StateType::eStateStopped) { auto frame=process->GetSelectedThread().GetSelectedFrame(); + auto values=frame.GetVariables(true, true, true, true); + //First try to find variable based on name, file and line number for(uint32_t value_index=0;value_indexinsert_with_tag(tooltip_buffer->get_insert()->get_iter(), "\n\n"+brief_comment, "def:note"); - auto debug_value=Debug::get().get_value(token.get_spelling()); + auto location=token.get_cursor().get_referenced().get_source_location(); + auto debug_value=Debug::get().get_value(token.get_spelling(), location.get_path(), location.get_offset().line); if(!debug_value.empty()) { debug_value.pop_back(); size_t pos=debug_value.find(" = ");