blob: fd5102682ee360588231dd0165366ac3a0c58fbb [file] [log] [blame]
Johnny Chen2341d352012-01-05 21:48:15 +00001//===-- 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
Greg Clayton2b737df2012-02-27 18:40:48 +000034lldb::ProcessSP
35ProcessFreeBSD::CreateInstance(Target& target,
36 Listener &listener,
37 const FileSpec *crash_file_path)
Johnny Chen2341d352012-01-05 21:48:15 +000038{
Greg Clayton2b737df2012-02-27 18:40:48 +000039 lldb::ProcessSP process_sp;
40 if (crash_file_path == NULL)
41 process_sp.reset(new ProcessFreeBSD (target, listener));
42 return process_sp;
Johnny Chen2341d352012-01-05 21:48:15 +000043}
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
67const char *
68ProcessFreeBSD::GetPluginNameStatic()
69{
70 return "freebsd";
71}
72
73const char *
74ProcessFreeBSD::GetPluginDescriptionStatic()
75{
76 return "Process plugin for FreeBSD";
77}
78
79//------------------------------------------------------------------------------
80// ProcessInterface protocol.
81
82const char *
83ProcessFreeBSD::GetPluginName()
84{
85 return "process.freebsd";
86}
87
88const char *
89ProcessFreeBSD::GetShortPluginName()
90{
91 return "process.freebsd";
92}
93
94uint32_t
95ProcessFreeBSD::GetPluginVersion()
96{
97 return 1;
98}
99
100void
101ProcessFreeBSD::GetPluginCommandHelp(const char *command, Stream *strm)
102{
103}
104
105Error
106ProcessFreeBSD::ExecutePluginCommand(Args &command, Stream *strm)
107{
108 return Error(1, eErrorTypeGeneric);
109}
110
111Log *
112ProcessFreeBSD::EnablePluginLogging(Stream *strm, Args &command)
113{
114 return NULL;
115}
116
117//------------------------------------------------------------------------------
118// Constructors and destructors.
119
120ProcessFreeBSD::ProcessFreeBSD(Target& target, Listener &listener)
121 : ProcessPOSIX(target, listener)
122{
123 // FIXME: Putting this code in the ctor and saving the byte order in a
124 // member variable is a hack to avoid const qual issues in GetByteOrder.
125 ObjectFile *obj_file = GetTarget().GetExecutableModule()->GetObjectFile();
126 m_byte_order = obj_file->GetByteOrder();
127}
128
129void
130ProcessFreeBSD::Terminate()
131{
132}
133
Greg Claytonc8dd5702012-04-12 19:04:34 +0000134bool
Johnny Chen2341d352012-01-05 21:48:15 +0000135ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
136{
137 // XXX haxx
138 new_thread_list = old_thread_list;
139
Greg Claytonc8dd5702012-04-12 19:04:34 +0000140 return false;
Johnny Chen2341d352012-01-05 21:48:15 +0000141}