From d2427b727b652e19a8808892451a65bf1292c10f Mon Sep 17 00:00:00 2001 From: Ole Christian Eidheim Date: Sun, 10 Jan 2016 23:01:19 +0100 Subject: [PATCH] Debug::get_return_value cleanup, and now works on older lldb versions --- src/debug.cc | 5 +++-- src/debug.h | 2 +- src/source_clang.cc | 2 +- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/debug.cc b/src/debug.cc index 6e83e68..29703c0 100644 --- a/src/debug.cc +++ b/src/debug.cc @@ -375,7 +375,7 @@ std::string Debug::get_value(const std::string &variable, const boost::filesyste return variable_value; } -std::string Debug::get_return_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr, unsigned int line_index) { +std::string Debug::get_return_value(const boost::filesystem::path &file_path, unsigned int line_nr, unsigned int line_index) { std::string return_value; event_mutex.lock(); if(state==lldb::StateType::eStateStopped) { @@ -386,7 +386,8 @@ std::string Debug::get_return_value(const std::string &variable, const boost::fi if(line_entry.IsValid()) { lldb::SBStream stream; line_entry.GetFileSpec().GetDescription(stream); - if(boost::filesystem::path(stream.GetData())==file_path && line_entry.GetLine()==line_nr && line_entry.GetColumn()==line_index) { + if(boost::filesystem::path(stream.GetData())==file_path && line_entry.GetLine()==line_nr && + (line_entry.GetColumn()==0 || line_entry.GetColumn()==line_index)) { lldb::SBStream stream; thread_return_value.GetDescription(stream); return_value=stream.GetData(); diff --git a/src/debug.h b/src/debug.h index 45b9a0e..6f4a2c2 100644 --- a/src/debug.h +++ b/src/debug.h @@ -46,7 +46,7 @@ public: void delete_debug(); //can't use delete as function name std::string get_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr); - std::string get_return_value(const std::string &variable, const boost::filesystem::path &file_path, unsigned int line_nr, unsigned int line_index); + std::string get_return_value(const boost::filesystem::path &file_path, unsigned int line_nr, unsigned int line_index); bool is_invalid(); bool is_stopped(); diff --git a/src/source_clang.cc b/src/source_clang.cc index 142d563..a36a318 100644 --- a/src/source_clang.cc +++ b/src/source_clang.cc @@ -424,7 +424,7 @@ void Source::ClangViewParse::show_type_tooltips(const Gdk::Rectangle &rectangle) if(debug_value.empty()) { value_type="Return value"; auto location=token.get_cursor().get_source_location(); - debug_value=Debug::get().get_return_value(token.get_spelling(), location.get_path(), location.get_offset().line, location.get_offset().index); + debug_value=Debug::get().get_return_value(location.get_path(), location.get_offset().line, location.get_offset().index); } if(!debug_value.empty()) { size_t pos=debug_value.find(" = ");