This revision was automatically updated to reflect the committed changes. Closed by commit rGb83b82f9f431: [lldb] Fix build on older Linux kernel versions (authored by kongyi). Herald added a project: LLDB. Herald added a subscriber: lldb-commits.
Repository: rG LLVM Github Monorepo CHANGES SINCE LAST ACTION https://reviews.llvm.org/D128707/new/ https://reviews.llvm.org/D128707 Files: lldb/source/Plugins/Process/Linux/Perf.cpp Index: lldb/source/Plugins/Process/Linux/Perf.cpp =================================================================== --- lldb/source/Plugins/Process/Linux/Perf.cpp +++ lldb/source/Plugins/Process/Linux/Perf.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" +#include <linux/version.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/syscall.h> @@ -26,6 +27,7 @@ Expected<LinuxPerfZeroTscConversion> lldb_private::process_linux::LoadPerfTscConversionParameters() { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0) lldb::pid_t pid = getpid(); perf_event_attr attr; memset(&attr, 0, sizeof(attr)); @@ -55,6 +57,10 @@ err_cap); return llvm::createStringError(llvm::inconvertibleErrorCode(), err_msg); } +#else + std::string err_msg = "PERF_COUNT_SW_DUMMY requires Linux 3.12"; + return llvm::createStringError(llvm::inconvertibleErrorCode(), err_msg); +#endif } void resource_handle::MmapDeleter::operator()(void *ptr) {
Index: lldb/source/Plugins/Process/Linux/Perf.cpp =================================================================== --- lldb/source/Plugins/Process/Linux/Perf.cpp +++ lldb/source/Plugins/Process/Linux/Perf.cpp @@ -15,6 +15,7 @@ #include "llvm/Support/MathExtras.h" #include "llvm/Support/MemoryBuffer.h" +#include <linux/version.h> #include <sys/ioctl.h> #include <sys/mman.h> #include <sys/syscall.h> @@ -26,6 +27,7 @@ Expected<LinuxPerfZeroTscConversion> lldb_private::process_linux::LoadPerfTscConversionParameters() { +#if LINUX_VERSION_CODE >= KERNEL_VERSION(3,12,0) lldb::pid_t pid = getpid(); perf_event_attr attr; memset(&attr, 0, sizeof(attr)); @@ -55,6 +57,10 @@ err_cap); return llvm::createStringError(llvm::inconvertibleErrorCode(), err_msg); } +#else + std::string err_msg = "PERF_COUNT_SW_DUMMY requires Linux 3.12"; + return llvm::createStringError(llvm::inconvertibleErrorCode(), err_msg); +#endif } void resource_handle::MmapDeleter::operator()(void *ptr) {
_______________________________________________ lldb-commits mailing list lldb-commits@lists.llvm.org https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits