[Lldb-commits] [PATCH] D57689: Adds property to force enabling of GDB JIT loader for MacOS

Yury Delendik via Phabricator via lldb-commits lldb-commits at lists.llvm.org
Mon Feb 4 07:48:36 PST 2019


yurydelendik created this revision.
Herald added a project: LLDB.
Herald added a subscriber: lldb-commits.

Based on https://gist.github.com/thlorenz/30bf0a3f67b1d97b2945#patching-and-rebuilding

The functionality was disabled at https://github.com/llvm/llvm-project/commit/521c2278abb16f0148cef1bd061cadb01ef43192


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D57689

Files:
  lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp


Index: lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
===================================================================
--- lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -59,9 +59,12 @@
 
 static constexpr PropertyDefinition g_properties[] = {
     {"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
-     {}, "Enable breakpoint on __jit_debug_register_code."}};
+     {}, "Enable breakpoint on __jit_debug_register_code."},
+    {"enable-loader-for-darwin", OptionValue::eTypeBoolean, true, false, nullptr,
+     {}, "Enable process loader monitor for macOS - disabled there for "
+     "performance reasons."}};
 
-enum { ePropertyEnableJITBreakpoint };
+enum { ePropertyEnableJITBreakpoint, ePropertyEnableLoaderForDarwin };
 
 class PluginProperties : public Properties {
 public:
@@ -79,6 +82,12 @@
         nullptr, ePropertyEnableJITBreakpoint,
         g_properties[ePropertyEnableJITBreakpoint].default_uint_value != 0);
   }
+
+  bool GetEnableLoaderForDwarwin() const {
+    return m_collection_sp->GetPropertyAtIndexAsBoolean(
+        nullptr, ePropertyEnableLoaderForDarwin,
+        g_properties[ePropertyEnableLoaderForDarwin].default_uint_value != 0);
+  }
 };
 
 typedef std::shared_ptr<PluginProperties> JITLoaderGDBPropertiesSP;
@@ -401,7 +410,8 @@
 JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
   JITLoaderSP jit_loader_sp;
   ArchSpec arch(process->GetTarget().GetArchitecture());
-  if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
+  if (arch.GetTriple().getVendor() != llvm::Triple::Apple ||
+      GetGlobalPluginProperties()->GetEnableLoaderForDwarwin())
     jit_loader_sp.reset(new JITLoaderGDB(process));
   return jit_loader_sp;
 }


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D57689.185051.patch
Type: text/x-patch
Size: 1791 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/lldb-commits/attachments/20190204/b24d05ee/attachment-0001.bin>


More information about the lldb-commits mailing list