Browse Source

Added workaround for Debian's newer lldb-server paths

merge-requests/365/head
eidheim 9 years ago
parent
commit
276b686004
  1. 18
      src/config.cc
  2. 22
      src/debug_lldb.cc

18
src/config.cc

@ -107,16 +107,14 @@ void Config::retrieve_config() {
#ifdef __linux
if(terminal.clang_format_command=="clang-format" &&
!boost::filesystem::exists("/usr/bin/clang-format") && !boost::filesystem::exists("/usr/local/bin/clang-format")) {
if(boost::filesystem::exists("/usr/bin/clang-format-3.9"))
terminal.clang_format_command="/usr/bin/clang-format-3.9";
else if(boost::filesystem::exists("/usr/bin/clang-format-3.8"))
terminal.clang_format_command="/usr/bin/clang-format-3.8";
else if(boost::filesystem::exists("/usr/bin/clang-format-3.7"))
terminal.clang_format_command="/usr/bin/clang-format-3.7";
else if(boost::filesystem::exists("/usr/bin/clang-format-3.6"))
terminal.clang_format_command="/usr/bin/clang-format-3.6";
else if(boost::filesystem::exists("/usr/bin/clang-format-3.5"))
terminal.clang_format_command="/usr/bin/clang-format-3.5";
auto versions={"4.0", "3.9", "3.8", "3.7", "3.6", "3.5"};
for(auto &version: versions) {
auto corrected_command=std::string("/usr/bin/clang-format-")+version;
if(boost::filesystem::exists(corrected_command)) {
terminal.clang_format_command=corrected_command;
break;
}
}
}
#endif
}

22
src/debug_lldb.cc

@ -31,9 +31,25 @@ void log(const char *msg, void *) {
Debug::LLDB::LLDB(): state(lldb::StateType::eStateInvalid), buffer_size(131072) {
#ifdef __APPLE__
auto debugserver_path=boost::filesystem::path("/usr/local/opt/llvm/bin/debugserver");
if(boost::filesystem::exists(debugserver_path))
setenv("LLDB_DEBUGSERVER_PATH", debugserver_path.string().c_str(), 0);
if(!getenv("LLDB_DEBUGSERVER_PATH")) {
std::string debug_server_path("/usr/local/opt/llvm/bin/debugserver");
if(boost::filesystem::exists(debug_server_path))
setenv("LLDB_DEBUGSERVER_PATH", debug_server_path.c_str(), 0);
}
#elif __linux
if(!getenv("LLDB_DEBUGSERVER_PATH")) {
std::string debug_server_path("/usr/bin/lldb-server");
if(!boost::filesystem::exists(debug_server_path)) {
auto versions={"4.0", "3.9", "3.8", "3.7", "3.6", "3.5"};
for(auto &version: versions) {
auto corrected_debug_server_path=debug_server_path+'-'+version;
if(boost::filesystem::exists(corrected_debug_server_path)) {
setenv("LLDB_DEBUGSERVER_PATH", corrected_debug_server_path.c_str(), 0);
break;
}
}
}
}
#endif
}

Loading…
Cancel
Save