1254721Semaste//===-- ProcessFreeBSD.cpp ----------------------------------------*- C++ -*-===// 2254721Semaste// 3254721Semaste// The LLVM Compiler Infrastructure 4254721Semaste// 5254721Semaste// This file is distributed under the University of Illinois Open Source 6254721Semaste// License. See LICENSE.TXT for details. 7254721Semaste// 8254721Semaste//===----------------------------------------------------------------------===// 9254721Semaste 10254721Semaste// C Includes 11254721Semaste#include <errno.h> 12254721Semaste 13254721Semaste// C++ Includes 14254721Semaste// Other libraries and framework includes 15254721Semaste#include "lldb/Core/PluginManager.h" 16254721Semaste#include "lldb/Core/State.h" 17254721Semaste#include "lldb/Host/Host.h" 18254721Semaste#include "lldb/Symbol/ObjectFile.h" 19254721Semaste#include "lldb/Target/DynamicLoader.h" 20254721Semaste#include "lldb/Target/Target.h" 21254721Semaste 22254721Semaste#include "ProcessFreeBSD.h" 23254721Semaste#include "ProcessPOSIXLog.h" 24254721Semaste#include "Plugins/Process/Utility/InferiorCallPOSIX.h" 25254721Semaste#include "ProcessMonitor.h" 26254721Semaste#include "POSIXThread.h" 27254721Semaste 28254721Semasteusing namespace lldb; 29254721Semasteusing namespace lldb_private; 30254721Semaste 31254721Semaste//------------------------------------------------------------------------------ 32254721Semaste// Static functions. 33254721Semaste 34254721Semastelldb::ProcessSP 35254721SemasteProcessFreeBSD::CreateInstance(Target& target, 36254721Semaste Listener &listener, 37254721Semaste const FileSpec *crash_file_path) 38254721Semaste{ 39254721Semaste lldb::ProcessSP process_sp; 40254721Semaste if (crash_file_path == NULL) 41254721Semaste process_sp.reset(new ProcessFreeBSD (target, listener)); 42254721Semaste return process_sp; 43254721Semaste} 44254721Semaste 45254721Semastevoid 46254721SemasteProcessFreeBSD::Initialize() 47254721Semaste{ 48254721Semaste static bool g_initialized = false; 49254721Semaste 50254721Semaste if (!g_initialized) 51254721Semaste { 52254721Semaste PluginManager::RegisterPlugin(GetPluginNameStatic(), 53254721Semaste GetPluginDescriptionStatic(), 54254721Semaste CreateInstance); 55254721Semaste Log::Callbacks log_callbacks = { 56254721Semaste ProcessPOSIXLog::DisableLog, 57254721Semaste ProcessPOSIXLog::EnableLog, 58254721Semaste ProcessPOSIXLog::ListLogCategories 59254721Semaste }; 60254721Semaste 61254721Semaste Log::RegisterLogChannel (ProcessFreeBSD::GetPluginNameStatic(), log_callbacks); 62254721Semaste ProcessPOSIXLog::RegisterPluginName(GetPluginNameStatic()); 63254721Semaste g_initialized = true; 64254721Semaste } 65254721Semaste} 66254721Semaste 67254721Semastelldb_private::ConstString 68254721SemasteProcessFreeBSD::GetPluginNameStatic() 69254721Semaste{ 70254721Semaste static ConstString g_name("freebsd"); 71254721Semaste return g_name; 72254721Semaste} 73254721Semaste 74254721Semasteconst char * 75254721SemasteProcessFreeBSD::GetPluginDescriptionStatic() 76254721Semaste{ 77254721Semaste return "Process plugin for FreeBSD"; 78254721Semaste} 79254721Semaste 80254721Semaste//------------------------------------------------------------------------------ 81254721Semaste// ProcessInterface protocol. 82254721Semaste 83254721Semastelldb_private::ConstString 84254721SemasteProcessFreeBSD::GetPluginName() 85254721Semaste{ 86254721Semaste return GetPluginNameStatic(); 87254721Semaste} 88254721Semaste 89254721Semasteuint32_t 90254721SemasteProcessFreeBSD::GetPluginVersion() 91254721Semaste{ 92254721Semaste return 1; 93254721Semaste} 94254721Semaste 95254721Semastevoid 96254721SemasteProcessFreeBSD::GetPluginCommandHelp(const char *command, Stream *strm) 97254721Semaste{ 98254721Semaste} 99254721Semaste 100254721SemasteError 101254721SemasteProcessFreeBSD::ExecutePluginCommand(Args &command, Stream *strm) 102254721Semaste{ 103254721Semaste return Error(1, eErrorTypeGeneric); 104254721Semaste} 105254721Semaste 106254721SemasteLog * 107254721SemasteProcessFreeBSD::EnablePluginLogging(Stream *strm, Args &command) 108254721Semaste{ 109254721Semaste return NULL; 110254721Semaste} 111254721Semaste 112254721Semaste//------------------------------------------------------------------------------ 113254721Semaste// Constructors and destructors. 114254721Semaste 115254721SemasteProcessFreeBSD::ProcessFreeBSD(Target& target, Listener &listener) 116254721Semaste : ProcessPOSIX(target, listener) 117254721Semaste{ 118254721Semaste} 119254721Semaste 120254721Semastevoid 121254721SemasteProcessFreeBSD::Terminate() 122254721Semaste{ 123254721Semaste} 124254721Semaste 125254721Semastebool 126254721SemasteProcessFreeBSD::UpdateThreadList(ThreadList &old_thread_list, ThreadList &new_thread_list) 127254721Semaste{ 128254721Semaste // XXX haxx 129254721Semaste new_thread_list = old_thread_list; 130254721Semaste 131254721Semaste return false; 132254721Semaste} 133