xref: /llvm-project/lldb/source/Target/MemoryHistory.cpp (revision 808142876c10b52e7ee57cdc6dcf0acc5c97c1b7)
1*80814287SRaphael Isemann //===-- MemoryHistory.cpp -------------------------------------------------===//
2beed821fSKuba Brecka //
32946cd70SChandler Carruth // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
42946cd70SChandler Carruth // See https://llvm.org/LICENSE.txt for license information.
52946cd70SChandler Carruth // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6beed821fSKuba Brecka //
7beed821fSKuba Brecka //===----------------------------------------------------------------------===//
8beed821fSKuba Brecka 
9beed821fSKuba Brecka #include "lldb/Target/MemoryHistory.h"
10beed821fSKuba Brecka #include "lldb/Core/PluginManager.h"
11beed821fSKuba Brecka 
12beed821fSKuba Brecka using namespace lldb;
13beed821fSKuba Brecka using namespace lldb_private;
14beed821fSKuba Brecka 
FindPlugin(const ProcessSP process)15b9c1b51eSKate Stone lldb::MemoryHistorySP MemoryHistory::FindPlugin(const ProcessSP process) {
169394d772SEugene Zelenko   MemoryHistoryCreateInstance create_callback = nullptr;
17beed821fSKuba Brecka 
18b9c1b51eSKate Stone   for (uint32_t idx = 0;
19b9c1b51eSKate Stone        (create_callback = PluginManager::GetMemoryHistoryCreateCallbackAtIndex(
20b9c1b51eSKate Stone             idx)) != nullptr;
21b9c1b51eSKate Stone        ++idx) {
2248c0440dSJason Molenda     MemoryHistorySP memory_history_sp(create_callback(process));
239394d772SEugene Zelenko     if (memory_history_sp)
2448c0440dSJason Molenda       return memory_history_sp;
25beed821fSKuba Brecka   }
26beed821fSKuba Brecka 
27beed821fSKuba Brecka   return MemoryHistorySP();
28beed821fSKuba Brecka }
29