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

2022-06-28 Thread Yi Kong via Phabricator via lldb-commits
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 
 #include 
 #include 
 #include 
@@ -26,6 +27,7 @@
 
 Expected
 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 
 #include 
 #include 
 #include 
@@ -26,6 +27,7 @@
 
 Expected
 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


[Lldb-commits] [PATCH] D128832: [lldb-server] Skip shared regions for memory allocation

2022-06-30 Thread Yi Kong via Phabricator via lldb-commits
This revision was automatically updated to reflect the committed changes.
Closed by commit rGc0702ac07b8e: [PATCH] [lldb-server] Skip shared regions for 
memory allocation (authored by emrekultursay, committed by kongyi).

Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D128832/new/

https://reviews.llvm.org/D128832

Files:
  lldb/include/lldb/Target/MemoryRegionInfo.h
  lldb/source/Plugins/Process/Linux/NativeProcessLinux.cpp
  lldb/source/Plugins/Process/Utility/LinuxProcMaps.cpp
  lldb/unittests/Process/Utility/LinuxProcMapsTest.cpp
  lldb/unittests/Process/Utility/MemoryTagManagerAArch64MTETest.cpp
  lldb/unittests/Process/minidump/MinidumpParserTest.cpp

Index: lldb/unittests/Process/minidump/MinidumpParserTest.cpp
===
--- lldb/unittests/Process/minidump/MinidumpParserTest.cpp
+++ lldb/unittests/Process/minidump/MinidumpParserTest.cpp
@@ -378,15 +378,15 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x0, 0x1}, no, no, no, no, ConstString(),
+  MemoryRegionInfo({0x0, 0x1}, no, no, no, unknown, no, ConstString(),
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x1, 0x21000}, yes, yes, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x4, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x7ffe, 0x1000}, yes, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, yes,
+  MemoryRegionInfo({0x7ffe1000, 0xf000}, no, no, no, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   true));
 }
@@ -412,9 +412,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -428,9 +428,9 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x1000, 0x10}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, yes,
+  MemoryRegionInfo({0x2000, 0x20}, yes, unknown, unknown, unknown, yes,
ConstString(), unknown, 0, unknown, unknown)),
   false));
 }
@@ -460,17 +460,17 @@
   parser->BuildMemoryRegions(),
   testing::Pair(
   testing::ElementsAre(
-  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, yes,
+  MemoryRegionInfo({0x400d9000, 0x2000}, yes, no, yes, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400db000, 0x1000}, yes, no, no, no, yes,
app_process, unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, yes,
+  MemoryRegionInfo({0x400dc000, 0x1000}, yes, yes, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, yes,
+  MemoryRegionInfo({0x400ec000, 0x1000}, yes, no, no, no, yes,
ConstString(), unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, yes, linker,
+  MemoryRegionInfo({0x400ee000, 0x1000}, yes, yes, no, no, yes, linker,
unknown, 0, unknown, unknown),
-  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, yes, liblog,
+  MemoryRegionInfo({0x400fc000, 0x1000}, yes, yes, yes, no, yes, liblog,
unknown, 0, unknown, unknown)),
   true));
 }
@@ -491,7 +491,7 @@
   EXPECT