From 7f9c9f2264235f94b5496281cadcc4a9775dbd8f Mon Sep 17 00:00:00 2001 From: Alex Langford Date: Fri, 21 Jun 2019 19:43:07 +0000 Subject: [Target] Decouple ObjCLanguageRuntime from LanguageRuntime Summary: ObjCLanguageRuntime was being pulled into LanguageRuntime because of Breakpoint Preconditions. If we move BreakpointPrecondition out of Breakpoint, we can extend the LanguageRuntime plugin interface so that LanguageRuntimes can give us a BreakpointPrecondition for exceptions. Differential Revision: https://reviews.llvm.org/D63181 llvm-svn: 364098 --- lldb/source/Core/PluginManager.cpp | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) (limited to 'lldb/source/Core/PluginManager.cpp') diff --git a/lldb/source/Core/PluginManager.cpp b/lldb/source/Core/PluginManager.cpp index cf940dd7034..24cadcd85bf 100644 --- a/lldb/source/Core/PluginManager.cpp +++ b/lldb/source/Core/PluginManager.cpp @@ -828,6 +828,7 @@ struct LanguageRuntimeInstance { std::string description; LanguageRuntimeCreateInstance create_callback; LanguageRuntimeGetCommandObject command_callback; + LanguageRuntimeGetExceptionPrecondition precondition_callback; }; typedef std::vector LanguageRuntimeInstances; @@ -845,7 +846,8 @@ static LanguageRuntimeInstances &GetLanguageRuntimeInstances() { bool PluginManager::RegisterPlugin( ConstString name, const char *description, LanguageRuntimeCreateInstance create_callback, - LanguageRuntimeGetCommandObject command_callback) { + LanguageRuntimeGetCommandObject command_callback, + LanguageRuntimeGetExceptionPrecondition precondition_callback) { if (create_callback) { LanguageRuntimeInstance instance; assert((bool)name); @@ -854,6 +856,7 @@ bool PluginManager::RegisterPlugin( instance.description = description; instance.create_callback = create_callback; instance.command_callback = command_callback; + instance.precondition_callback = precondition_callback; std::lock_guard guard(GetLanguageRuntimeMutex()); GetLanguageRuntimeInstances().push_back(instance); } @@ -895,6 +898,15 @@ PluginManager::GetLanguageRuntimeGetCommandObjectAtIndex(uint32_t idx) { return nullptr; } +LanguageRuntimeGetExceptionPrecondition +PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(uint32_t idx) { + std::lock_guard guard(GetLanguageRuntimeMutex()); + LanguageRuntimeInstances &instances = GetLanguageRuntimeInstances(); + if (idx < instances.size()) + return instances[idx].precondition_callback; + return nullptr; +} + LanguageRuntimeCreateInstance PluginManager::GetLanguageRuntimeCreateCallbackForPluginName( ConstString name) { -- cgit v1.2.3