summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins
diff options
context:
space:
mode:
authorYury Delendik <ydelendik@mozilla.com>2019-03-05 14:23:53 +0000
committerYury Delendik <ydelendik@mozilla.com>2019-03-05 14:23:53 +0000
commitbc6b225d42928c1bf7cf8a6801304b1af8747d48 (patch)
tree2f587464f8bc5bf9f6a503f9561b8b693bff534f /lldb/source/Plugins
parent401997db928eb5aff56b8daaf4cd676e102b05d7 (diff)
downloadbcm5719-llvm-bc6b225d42928c1bf7cf8a6801304b1af8747d48.tar.gz
bcm5719-llvm-bc6b225d42928c1bf7cf8a6801304b1af8747d48.zip
Adds property to force enabling of GDB JIT loader for MacOS
Summary: Based on https://gist.github.com/thlorenz/30bf0a3f67b1d97b2945#patching-and-rebuilding The functionality was disabled at https://github.com/llvm/llvm-project/commit/521c2278abb16f0148cef1bd061cadb01ef43192 Reviewers: jingham Subscribers: lldb-commits Tags: #lldb Differential Revision: https://reviews.llvm.org/D57689 llvm-svn: 355402
Diffstat (limited to 'lldb/source/Plugins')
-rw-r--r--lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp49
1 files changed, 37 insertions, 12 deletions
diff --git a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
index 857ef4632a0..85e54b02a73 100644
--- a/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
+++ b/lldb/source/Plugins/JITLoader/GDB/JITLoaderGDB.cpp
@@ -59,11 +59,27 @@ template <typename ptr_t> struct jit_descriptor {
namespace {
+enum EnableJITLoaderGDB {
+ eEnableJITLoaderGDBDefault,
+ eEnableJITLoaderGDBOn,
+ eEnableJITLoaderGDBOff,
+};
+
+static constexpr OptionEnumValueElement g_enable_jit_loader_gdb_enumerators[] = {
+ {eEnableJITLoaderGDBDefault, "default", "Enable JIT compilation interface "
+ "for all platforms except macOS"},
+ {eEnableJITLoaderGDBOn, "on", "Enable JIT compilation interface"},
+ {eEnableJITLoaderGDBOff, "off", "Disable JIT compilation interface"}
+ };
+
static constexpr PropertyDefinition g_properties[] = {
- {"enable-jit-breakpoint", OptionValue::eTypeBoolean, true, true, nullptr,
- {}, "Enable breakpoint on __jit_debug_register_code."}};
+ {"enable", OptionValue::eTypeEnum, true,
+ eEnableJITLoaderGDBDefault, nullptr,
+ OptionEnumValues(g_enable_jit_loader_gdb_enumerators),
+ "Enable GDB's JIT compilation interface (default: enabled on "
+ "all platforms except macOS)"}};
-enum { ePropertyEnableJITBreakpoint };
+enum { ePropertyEnable, ePropertyEnableJITBreakpoint };
class PluginProperties : public Properties {
public:
@@ -76,10 +92,10 @@ public:
m_collection_sp->Initialize(g_properties);
}
- bool GetEnableJITBreakpoint() const {
- return m_collection_sp->GetPropertyAtIndexAsBoolean(
- nullptr, ePropertyEnableJITBreakpoint,
- g_properties[ePropertyEnableJITBreakpoint].default_uint_value != 0);
+ EnableJITLoaderGDB GetEnable() const {
+ return (EnableJITLoaderGDB)m_collection_sp->GetPropertyAtIndexAsEnumeration(
+ nullptr, ePropertyEnable,
+ g_properties[ePropertyEnable].default_uint_value);
}
};
@@ -165,9 +181,6 @@ void JITLoaderGDB::ModulesDidLoad(ModuleList &module_list) {
// Setup the JIT Breakpoint
//------------------------------------------------------------------
void JITLoaderGDB::SetJITBreakpoint(lldb_private::ModuleList &module_list) {
- if (!GetGlobalPluginProperties()->GetEnableJITBreakpoint())
- return;
-
if (DidSetJITBreakpoint())
return;
@@ -402,8 +415,20 @@ lldb_private::ConstString JITLoaderGDB::GetPluginNameStatic() {
JITLoaderSP JITLoaderGDB::CreateInstance(Process *process, bool force) {
JITLoaderSP jit_loader_sp;
- ArchSpec arch(process->GetTarget().GetArchitecture());
- if (arch.GetTriple().getVendor() != llvm::Triple::Apple)
+ bool enable;
+ switch (GetGlobalPluginProperties()->GetEnable()) {
+ case EnableJITLoaderGDB::eEnableJITLoaderGDBOn:
+ enable = true;
+ break;
+ case EnableJITLoaderGDB::eEnableJITLoaderGDBOff:
+ enable = false;
+ break;
+ case EnableJITLoaderGDB::eEnableJITLoaderGDBDefault:
+ ArchSpec arch(process->GetTarget().GetArchitecture());
+ enable = arch.GetTriple().getVendor() != llvm::Triple::Apple;
+ break;
+ }
+ if (enable)
jit_loader_sp = std::make_shared<JITLoaderGDB>(process);
return jit_loader_sp;
}
OpenPOWER on IntegriCloud