ProcessFreeBSD.cpp revision 254721
1//===-- ProcessFreeBSD.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// C Includes
11#include <errno.h>
12
13// C++ Includes
14// Other libraries and framework includes
15#include "lldb/Core/PluginManager.h"
16#include "lldb/Core/State.h"
17#include "lldb/Host/Host.h"
18#include "lldb/Symbol/ObjectFile.h"
19#include "lldb/Target/DynamicLoader.h"
20#include "lldb/Target/Target.h"
21
22#include "ProcessFreeBSD.h"
23#include "ProcessPOSIXLog.h"
24#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
25#include "ProcessMonitor.h"
26#include "POSIXThread.h"
27
28using namespace lldb;
29using namespace lldb_private;
30
31//------------------------------------------------------------------------------
32// Static functions.
33
34lldb::ProcessSP
35ProcessFreeBSD::CreateInstance(Target& target,
36                               Listener &listener,
37                               const FileSpec *crash_file_path)
38{
39    lldb::ProcessSP process_sp;
40    if (crash_file_path == NULL)
41        process_sp.reset(new ProcessFreeBSD (target, listener));
42    return process_sp;
43}
44
45void
46ProcessFreeBSD::Initialize()
47{
48    static bool g_initialized = false;
49
50    if (!g_initialized)
51    {
52        PluginManager::RegisterPlugin(GetPluginNameStatic(),
53                                      GetPluginDescriptionStatic(),
54                                      CreateInstance);
55        Log::Callbacks log_callbacks = {
56            ProcessPOSIXLog::DisableLog,
57            ProcessPOSIXLog::EnableLog,
58            ProcessPOSIXLog::ListLogCategories
59        };
60
61        Log::RegisterLogChannel (ProcessFreeBSD::GetPluginNameStatic(), log_callbacks);
62        ProcessPOSIXLog::RegisterPluginName(GetPluginNameStatic());
63        g_initialized = true;
64    }
65}
66
67lldb_private::ConstString
68ProcessFreeBSD::GetPluginNameStatic()
69{
70    static ConstString g_name("freebsd");
71    return g_name;
72}
73
74const char *
75ProcessFreeBSD::GetPluginDescriptionStatic()
76{
77    return "Process plugin for FreeBSD";
78}
79
80//------------------------------------------------------------------------------
81// ProcessInterface protocol.
82
83lldb_private::ConstString
84ProcessFreeBSD::GetPluginName()
85{
86    return GetPluginNameStatic();
87}
88
89uint32_t
90ProcessFreeBSD::GetPluginVersion()
91{
92    return 1;
93}
94
95void
96ProcessFreeBSD::GetPluginCommandHelp(const char *command, Stream *strm)
97{
98}
99
100Error
101ProcessFreeBSD::ExecutePluginCommand(Args &command, Stream *strm)
102{
103    return Error(1, eErrorTypeGeneric);
104}
105
106Log *
107ProcessFreeBSD::EnablePluginLogging(Stream *strm, Args &command)
108{
109    return NULL;
110}
111
112//------------------------------------------------------------------------------
113// Constructors and destructors.
114
115ProcessFreeBSD::ProcessFreeBSD(Target& target, Listener &listener)
116    : ProcessPOSIX(target, listener)
117{
118}
119
120void
121ProcessFreeBSD::Terminate()
122{
123}
124
125bool
126ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
127{
128    // XXX haxx
129    new_thread_list = old_thread_list;
130
131    return false;
132}
133