aboutsummaryrefslogtreecommitdiff
path: root/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2012-01-05 21:48:15 +0000
committerJohnny Chen <johnny.chen@apple.com>2012-01-05 21:48:15 +0000
commit9ed5b49c45ba377cffbc5d0d893b5437f50228af (patch)
tree386909c95bde01a8a2071c1b5f7d2c78b5187c5a /lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
parent9afd449e8ff4382d9479cfbc7acc38d74fbcfc76 (diff)
downloadllvm-9ed5b49c45ba377cffbc5d0d893b5437f50228af.zip
llvm-9ed5b49c45ba377cffbc5d0d893b5437f50228af.tar.gz
llvm-9ed5b49c45ba377cffbc5d0d893b5437f50228af.tar.bz2
Fix incomplete commit of http://llvm.org/viewvc/llvm-project?rev=147609&view=rev:
This patch combines common code from Linux and FreeBSD into a new POSIX platform. It also contains fixes for 64bit FreeBSD. The patch is based on changes by Mark Peek <mp@FreeBSD.org> and "K. Macy" <kmacy@freebsd.org> in their github repo located at https://github.com/fbsd/lldb. llvm-svn: 147613
Diffstat (limited to 'lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp')
-rw-r--r--lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp136
1 files changed, 136 insertions, 0 deletions
diff --git a/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
new file mode 100644
index 0000000..8a77ce5
--- /dev/null
+++ b/lldb/source/Plugins/Process/FreeBSD/ProcessFreeBSD.cpp
@@ -0,0 +1,136 @@
+//===-- ProcessFreeBSD.cpp ----------------------------------------*- C++ -*-===//
+//
+// The LLVM Compiler Infrastructure
+//
+// This file is distributed under the University of Illinois Open Source
+// License. See LICENSE.TXT for details.
+//
+//===----------------------------------------------------------------------===//
+
+// C Includes
+#include <errno.h>
+
+// C++ Includes
+// Other libraries and framework includes
+#include "lldb/Core/PluginManager.h"
+#include "lldb/Core/State.h"
+#include "lldb/Host/Host.h"
+#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Target/DynamicLoader.h"
+#include "lldb/Target/Target.h"
+
+#include "ProcessFreeBSD.h"
+#include "ProcessPOSIXLog.h"
+#include "Plugins/Process/Utility/InferiorCallPOSIX.h"
+#include "ProcessMonitor.h"
+#include "POSIXThread.h"
+
+using namespace lldb;
+using namespace lldb_private;
+
+//------------------------------------------------------------------------------
+// Static functions.
+
+Process*
+ProcessFreeBSD::CreateInstance(Target& target, Listener &listener)
+{
+ return new ProcessFreeBSD(target, listener);
+}
+
+void
+ProcessFreeBSD::Initialize()
+{
+ static bool g_initialized = false;
+
+ if (!g_initialized)
+ {
+ PluginManager::RegisterPlugin(GetPluginNameStatic(),
+ GetPluginDescriptionStatic(),
+ CreateInstance);
+ Log::Callbacks log_callbacks = {
+ ProcessPOSIXLog::DisableLog,
+ ProcessPOSIXLog::EnableLog,
+ ProcessPOSIXLog::ListLogCategories
+ };
+
+ Log::RegisterLogChannel (ProcessFreeBSD::GetPluginNameStatic(), log_callbacks);
+ ProcessPOSIXLog::RegisterPluginName(GetPluginNameStatic());
+ g_initialized = true;
+ }
+}
+
+const char *
+ProcessFreeBSD::GetPluginNameStatic()
+{
+ return "freebsd";
+}
+
+const char *
+ProcessFreeBSD::GetPluginDescriptionStatic()
+{
+ return "Process plugin for FreeBSD";
+}
+
+//------------------------------------------------------------------------------
+// ProcessInterface protocol.
+
+const char *
+ProcessFreeBSD::GetPluginName()
+{
+ return "process.freebsd";
+}
+
+const char *
+ProcessFreeBSD::GetShortPluginName()
+{
+ return "process.freebsd";
+}
+
+uint32_t
+ProcessFreeBSD::GetPluginVersion()
+{
+ return 1;
+}
+
+void
+ProcessFreeBSD::GetPluginCommandHelp(const char *command, Stream *strm)
+{
+}
+
+Error
+ProcessFreeBSD::ExecutePluginCommand(Args &command, Stream *strm)
+{
+ return Error(1, eErrorTypeGeneric);
+}
+
+Log *
+ProcessFreeBSD::EnablePluginLogging(Stream *strm, Args &command)
+{
+ return NULL;
+}
+
+//------------------------------------------------------------------------------
+// Constructors and destructors.
+
+ProcessFreeBSD::ProcessFreeBSD(Target& target, Listener &listener)
+ : ProcessPOSIX(target, listener)
+{
+ // FIXME: Putting this code in the ctor and saving the byte order in a
+ // member variable is a hack to avoid const qual issues in GetByteOrder.
+ ObjectFile *obj_file = GetTarget().GetExecutableModule()->GetObjectFile();
+ m_byte_order = obj_file->GetByteOrder();
+}
+
+void
+ProcessFreeBSD::Terminate()
+{
+}
+
+uint32_t
+ProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list)
+{
+ // XXX haxx
+ new_thread_list = old_thread_list;
+
+ return 0;
+}