JDevlieghere created this revision. JDevlieghere added a reviewer: jasonmolenda. Herald added a project: All. JDevlieghere requested review of this revision.
The current debugserver CMake allows it to be built with or without libcompression. It conditionally links against libcompression if it's available and sets the corresponding `HAVE_LIBCOMPRESSION` define. The code itself however is using libcompression unconditionally. This patch adds the missing `HAVE_LIBCOMPRESSION` guards. The other alternative is to make libcompression a hard dependency. https://github.com/llvm/llvm-project/issues/112 https://reviews.llvm.org/D123616 Files: lldb/tools/debugserver/source/RNBRemote.cpp Index: lldb/tools/debugserver/source/RNBRemote.cpp =================================================================== --- lldb/tools/debugserver/source/RNBRemote.cpp +++ lldb/tools/debugserver/source/RNBRemote.cpp @@ -45,7 +45,9 @@ #include "RNBSocket.h" #include "StdStringExtractor.h" +#if defined(HAVE_LIBCOMPRESSION) #include <compression.h> +#endif #include <TargetConditionals.h> #include <algorithm> @@ -597,6 +599,7 @@ // If compression is not requested, the original packet contents are returned std::string RNBRemote::CompressString(const std::string &orig) { +#if defined(HAVE_LIBCOMPRESSION) std::string compressed; compression_types compression_type = GetCompressionType(); if (compression_type != compression_types::none) { @@ -709,6 +712,9 @@ } return compressed; +#else + return orig; +#endif } rnb_err_t RNBRemote::SendPacket(const std::string &s) {
Index: lldb/tools/debugserver/source/RNBRemote.cpp =================================================================== --- lldb/tools/debugserver/source/RNBRemote.cpp +++ lldb/tools/debugserver/source/RNBRemote.cpp @@ -45,7 +45,9 @@ #include "RNBSocket.h" #include "StdStringExtractor.h" +#if defined(HAVE_LIBCOMPRESSION) #include <compression.h> +#endif #include <TargetConditionals.h> #include <algorithm> @@ -597,6 +599,7 @@ // If compression is not requested, the original packet contents are returned std::string RNBRemote::CompressString(const std::string &orig) { +#if defined(HAVE_LIBCOMPRESSION) std::string compressed; compression_types compression_type = GetCompressionType(); if (compression_type != compression_types::none) { @@ -709,6 +712,9 @@ } return compressed; +#else + return orig; +#endif } rnb_err_t RNBRemote::SendPacket(const std::string &s) {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits