xref: /src/contrib/llvm-project/lldb/source/Target/MemoryHistory.cpp (revision 5ffd83dbcc34f10e07f6d3e968ae6365869615f4)
1cfca06d7SDimitry Andric //===-- MemoryHistory.cpp -------------------------------------------------===//
2205afe67SEd Maste //
35f29bb8aSDimitry Andric // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions.
45f29bb8aSDimitry Andric // See https://llvm.org/LICENSE.txt for license information.
55f29bb8aSDimitry Andric // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception
6205afe67SEd Maste //
7205afe67SEd Maste //===----------------------------------------------------------------------===//
8205afe67SEd Maste 
9205afe67SEd Maste #include "lldb/Target/MemoryHistory.h"
10205afe67SEd Maste #include "lldb/Core/PluginManager.h"
11205afe67SEd Maste 
12205afe67SEd Maste using namespace lldb;
13205afe67SEd Maste using namespace lldb_private;
14205afe67SEd Maste 
FindPlugin(const ProcessSP process)1514f1b3e8SDimitry Andric lldb::MemoryHistorySP MemoryHistory::FindPlugin(const ProcessSP process) {
16f3fbd1c0SDimitry Andric   MemoryHistoryCreateInstance create_callback = nullptr;
17205afe67SEd Maste 
1814f1b3e8SDimitry Andric   for (uint32_t idx = 0;
1914f1b3e8SDimitry Andric        (create_callback = PluginManager::GetMemoryHistoryCreateCallbackAtIndex(
2014f1b3e8SDimitry Andric             idx)) != nullptr;
2114f1b3e8SDimitry Andric        ++idx) {
22205afe67SEd Maste     MemoryHistorySP memory_history_sp(create_callback(process));
23f3fbd1c0SDimitry Andric     if (memory_history_sp)
24205afe67SEd Maste       return memory_history_sp;
25205afe67SEd Maste   }
26205afe67SEd Maste 
27205afe67SEd Maste   return MemoryHistorySP();
28205afe67SEd Maste }
29