14bb0738eSEd Maste //===-- MemoryHistory.cpp ---------------------------------------*- C++ -*-===//
27aa51b79SEd Maste //
37aa51b79SEd Maste //                     The LLVM Compiler Infrastructure
47aa51b79SEd Maste //
57aa51b79SEd Maste // This file is distributed under the University of Illinois Open Source
67aa51b79SEd Maste // License. See LICENSE.TXT for details.
77aa51b79SEd Maste //
87aa51b79SEd Maste //===----------------------------------------------------------------------===//
97aa51b79SEd Maste 
107aa51b79SEd Maste #include "lldb/Target/MemoryHistory.h"
117aa51b79SEd Maste #include "lldb/Core/PluginManager.h"
127aa51b79SEd Maste 
137aa51b79SEd Maste using namespace lldb;
147aa51b79SEd Maste using namespace lldb_private;
157aa51b79SEd Maste 
FindPlugin(const ProcessSP process)16435933ddSDimitry Andric lldb::MemoryHistorySP MemoryHistory::FindPlugin(const ProcessSP process) {
174bb0738eSEd Maste   MemoryHistoryCreateInstance create_callback = nullptr;
187aa51b79SEd Maste 
19435933ddSDimitry Andric   for (uint32_t idx = 0;
20435933ddSDimitry Andric        (create_callback = PluginManager::GetMemoryHistoryCreateCallbackAtIndex(
21435933ddSDimitry Andric             idx)) != nullptr;
22435933ddSDimitry Andric        ++idx) {
237aa51b79SEd Maste     MemoryHistorySP memory_history_sp(create_callback(process));
244bb0738eSEd Maste     if (memory_history_sp)
257aa51b79SEd Maste       return memory_history_sp;
267aa51b79SEd Maste   }
277aa51b79SEd Maste 
287aa51b79SEd Maste   return MemoryHistorySP();
297aa51b79SEd Maste }
30