blob: 2c725d3b19910c0041dd4f6e10a911062a92c991 [file] [log] [blame]
Greg Clayton37f962e2011-08-22 02:49:39 +00001//===-- OperatingSystem.cpp --------------------------------------------*- C++ -*-===//
2//
3// The LLVM Compiler Infrastructure
4//
5// This file is distributed under the University of Illinois Open Source
6// License. See LICENSE.TXT for details.
7//
8//===----------------------------------------------------------------------===//
9
10
11#include "lldb/Target/OperatingSystem.h"
12// C Includes
13// C++ Includes
14// Other libraries and framework includes
15#include "lldb/Core/PluginManager.h"
16
17
18using namespace lldb;
19using namespace lldb_private;
20
21
22OperatingSystem*
23OperatingSystem::FindPlugin (Process *process, const char *plugin_name)
24{
25 OperatingSystemCreateInstance create_callback = NULL;
26 if (plugin_name)
27 {
28 create_callback = PluginManager::GetOperatingSystemCreateCallbackForPluginName (plugin_name);
29 if (create_callback)
30 {
31 std::auto_ptr<OperatingSystem> instance_ap(create_callback(process, true));
32 if (instance_ap.get())
33 return instance_ap.release();
34 }
35 }
36 else
37 {
38 for (uint32_t idx = 0; (create_callback = PluginManager::GetOperatingSystemCreateCallbackAtIndex(idx)) != NULL; ++idx)
39 {
40 std::auto_ptr<OperatingSystem> instance_ap(create_callback(process, false));
41 if (instance_ap.get())
42 return instance_ap.release();
43 }
44 }
45 return NULL;
46}
47
48
49OperatingSystem::OperatingSystem (Process *process) :
50 m_process (process)
51{
52}
53
54OperatingSystem::~OperatingSystem()
55{
56}