summaryrefslogtreecommitdiff
path: root/source/Target/LanguageRuntime.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'source/Target/LanguageRuntime.cpp')
-rw-r--r--source/Target/LanguageRuntime.cpp59
1 files changed, 29 insertions, 30 deletions
diff --git a/source/Target/LanguageRuntime.cpp b/source/Target/LanguageRuntime.cpp
index ea6914fb076d1..dd44158106132 100644
--- a/source/Target/LanguageRuntime.cpp
+++ b/source/Target/LanguageRuntime.cpp
@@ -1,23 +1,23 @@
//===-- LanguageRuntime.cpp -------------------------------------*- C++ -*-===//
//
-// The LLVM Compiler Infrastructure
-//
-// This file is distributed under the University of Illinois Open Source
-// License. See LICENSE.TXT for details.
+// Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
+// See https://llvm.org/LICENSE.txt for license information.
+// SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
//
//===----------------------------------------------------------------------===//
#include "lldb/Target/LanguageRuntime.h"
-#include "Plugins/Language/ObjC/ObjCLanguage.h"
#include "lldb/Core/PluginManager.h"
#include "lldb/Core/SearchFilter.h"
#include "lldb/Interpreter/CommandInterpreter.h"
-#include "lldb/Target/ObjCLanguageRuntime.h"
+#include "lldb/Target/Language.h"
#include "lldb/Target/Target.h"
using namespace lldb;
using namespace lldb_private;
+char LanguageRuntime::ID = 0;
+
ExceptionSearchFilter::ExceptionSearchFilter(const lldb::TargetSP &target_sp,
lldb::LanguageType language,
bool update_module_list)
@@ -202,7 +202,7 @@ protected:
LanguageRuntime *LanguageRuntime::FindPlugin(Process *process,
lldb::LanguageType language) {
- std::unique_ptr<LanguageRuntime> language_runtime_ap;
+ std::unique_ptr<LanguageRuntime> language_runtime_up;
LanguageRuntimeCreateInstance create_callback;
for (uint32_t idx = 0;
@@ -210,10 +210,10 @@ LanguageRuntime *LanguageRuntime::FindPlugin(Process *process,
PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) !=
nullptr;
++idx) {
- language_runtime_ap.reset(create_callback(process, language));
+ language_runtime_up.reset(create_callback(process, language));
- if (language_runtime_ap)
- return language_runtime_ap.release();
+ if (language_runtime_up)
+ return language_runtime_up.release();
}
return nullptr;
@@ -223,19 +223,24 @@ LanguageRuntime::LanguageRuntime(Process *process) : m_process(process) {}
LanguageRuntime::~LanguageRuntime() = default;
-Breakpoint::BreakpointPreconditionSP
-LanguageRuntime::CreateExceptionPrecondition(lldb::LanguageType language,
- bool catch_bp, bool throw_bp) {
- switch (language) {
- case eLanguageTypeObjC:
- if (throw_bp)
- return Breakpoint::BreakpointPreconditionSP(
- new ObjCLanguageRuntime::ObjCExceptionPrecondition());
- break;
- default:
- break;
+BreakpointPreconditionSP
+LanguageRuntime::GetExceptionPrecondition(LanguageType language,
+ bool throw_bp) {
+ LanguageRuntimeCreateInstance create_callback;
+ for (uint32_t idx = 0;
+ (create_callback =
+ PluginManager::GetLanguageRuntimeCreateCallbackAtIndex(idx)) !=
+ nullptr;
+ idx++) {
+ if (auto precondition_callback =
+ PluginManager::GetLanguageRuntimeGetExceptionPreconditionAtIndex(
+ idx)) {
+ if (BreakpointPreconditionSP precond =
+ precondition_callback(language, throw_bp))
+ return precond;
+ }
}
- return Breakpoint::BreakpointPreconditionSP();
+ return BreakpointPreconditionSP();
}
BreakpointSP LanguageRuntime::CreateExceptionBreakpoint(
@@ -251,10 +256,8 @@ BreakpointSP LanguageRuntime::CreateExceptionBreakpoint(
target.CreateBreakpoint(filter_sp, resolver_sp, is_internal, hardware,
resolve_indirect_functions));
if (exc_breakpt_sp) {
- Breakpoint::BreakpointPreconditionSP precondition_sp =
- CreateExceptionPrecondition(language, catch_bp, throw_bp);
- if (precondition_sp)
- exc_breakpt_sp->SetPrecondition(precondition_sp);
+ if (auto precond = GetExceptionPrecondition(language, throw_bp))
+ exc_breakpt_sp->SetPrecondition(precond);
if (is_internal)
exc_breakpt_sp->SetBreakpointKind("exception");
@@ -291,7 +294,3 @@ void LanguageRuntime::InitializeCommands(CommandObject *parent) {
}
}
}
-
-lldb::SearchFilterSP LanguageRuntime::CreateExceptionSearchFilter() {
- return m_process->GetTarget().GetSearchFilterForModule(nullptr);
-}