[Lldb-commits] [PATCH] D128707: [lldb] Fix build on older Linux kernel versions

Yi Kong via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Tue Jun 28 05:24:14 PDT 2022


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) {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D128707.440572.patch
Type: text/x-patch
Size: 1035 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20220628/ce2d9fe4/attachment.bin>


More information about the lldb-commits mailing list