Index: source/Plugins/Process/CMakeLists.txt =================================================================== --- source/Plugins/Process/CMakeLists.txt +++ source/Plugins/Process/CMakeLists.txt @@ -5,6 +5,7 @@ add_subdirectory(FreeBSD) add_subdirectory(POSIX) elseif (CMAKE_SYSTEM_NAME MATCHES "NetBSD") + add_subdirectory(NetBSD) add_subdirectory(POSIX) elseif (CMAKE_SYSTEM_NAME MATCHES "Windows") add_subdirectory(Windows/Common) Index: source/Plugins/Process/NetBSD/CMakeLists.txt =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/CMakeLists.txt @@ -0,0 +1,20 @@ +include_directories(.) +include_directories(../POSIX) +include_directories(../Utility) + +add_lldb_library(lldbPluginProcessNetBSD PLUGIN + NativeProcessNetBSD.cpp + NativeRegisterContextNetBSD.cpp + NativeThreadNetBSD.cpp + + LINK_LIBS + lldbCore + lldbHost + lldbSymbol + lldbTarget + lldbUtility + lldbPluginProcessPOSIX + lldbPluginProcessUtility + LINK_COMPONENTS + Support + ) Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.h =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.h @@ -0,0 +1,49 @@ +//===-- NativeProcessNetBSD.h --------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_NativeProcessNetBSD_H_ +#define liblldb_NativeProcessNetBSD_H_ + +// C++ Includes + +// Other libraries and framework includes + +#include "lldb/Core/ArchSpec.h" +#include "lldb/Host/FileSpec.h" +#include "lldb/Target/MemoryRegionInfo.h" + +#include "NativeThreadNetBSD.h" +#include "lldb/Host/common/NativeProcessProtocol.h" + +namespace lldb_private { +namespace process_netbsd { +/// @class NativeProcessNetBSD +/// @brief Manages communication with the inferior (debugee) process. +/// +/// Upon construction, this class prepares and launches an inferior process for +/// debugging. +/// +/// Changes in the inferior process state are broadcasted. +class NativeProcessNetBSD : public NativeProcessProtocol { + friend Error NativeProcessProtocol::Launch( + ProcessLaunchInfo &launch_info, NativeDelegate &native_delegate, + MainLoop &mainloop, NativeProcessProtocolSP &process_sp); + + friend Error NativeProcessProtocol::Attach( + lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, + MainLoop &mainloop, NativeProcessProtocolSP &process_sp); + +private: + NativeProcessNetBSD(); +}; + +} // namespace process_netbsd +} // namespace lldb_private + +#endif // #ifndef liblldb_NativeProcessNetBSD_H_ Index: source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeProcessNetBSD.cpp @@ -0,0 +1,51 @@ +//===-- NativeProcessNetBSD.cpp ------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "NativeProcessNetBSD.h" + +// C Includes + +// C++ Includes + +// Other libraries and framework includes + +#include "Plugins/Process/POSIX/ProcessPOSIXLog.h" + +// System includes - They have to be included after framework includes because +// they define some +// macros which collide with variable names in other modules + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_netbsd; +using namespace llvm; + +// ----------------------------------------------------------------------------- +// Public Static Methods +// ----------------------------------------------------------------------------- + +Error NativeProcessProtocol::Launch( + ProcessLaunchInfo &launch_info, + NativeProcessProtocol::NativeDelegate &native_delegate, MainLoop &mainloop, + NativeProcessProtocolSP &native_process_sp) { + return Error(); +} + +Error NativeProcessProtocol::Attach( + lldb::pid_t pid, NativeProcessProtocol::NativeDelegate &native_delegate, + MainLoop &mainloop, NativeProcessProtocolSP &native_process_sp) { + return Error(); +} + +// ----------------------------------------------------------------------------- +// Public Instance Methods +// ----------------------------------------------------------------------------- + +NativeProcessNetBSD::NativeProcessNetBSD() + : NativeProcessProtocol(LLDB_INVALID_PROCESS_ID) {} Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.h @@ -0,0 +1,41 @@ +//===-- NativeRegisterContextNetBSD.h ---------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef lldb_NativeRegisterContextNetBSD_h +#define lldb_NativeRegisterContextNetBSD_h + +#include "lldb/Host/common/NativeRegisterContextRegisterInfo.h" +#include "lldb/Host/common/NativeThreadProtocol.h" + +#include "Plugins/Process/NetBSD/NativeProcessNetBSD.h" + +namespace lldb_private { +namespace process_netbsd { + +class NativeRegisterContextNetBSD : public NativeRegisterContextRegisterInfo { +public: + NativeRegisterContextNetBSD(NativeThreadProtocol &native_thread, + uint32_t concrete_frame_idx, + RegisterInfoInterface *reg_info_interface_p); + + // This function is implemented in the NativeRegisterContextNetBSD_* + // subclasses to create a new instance of the host specific + // NativeRegisterContextNetBSD. The implementations can't collide as only one + // NativeRegisterContextNetBSD_* variant should be compiled into the final + // executable. + static NativeRegisterContextNetBSD * + CreateHostNativeRegisterContextNetBSD(const ArchSpec &target_arch, + NativeThreadProtocol &native_thread, + uint32_t concrete_frame_idx); +}; + +} // namespace process_netbsd +} // namespace lldb_private + +#endif // #ifndef lldb_NativeRegisterContextNetBSD_h Index: source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeRegisterContextNetBSD.cpp @@ -0,0 +1,19 @@ +//===-- NativeRegisterContextNetBSD.cpp -------------------------*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "NativeRegisterContextNetBSD.h" + +using namespace lldb_private; +using namespace lldb_private::process_netbsd; + +NativeRegisterContextNetBSD::NativeRegisterContextNetBSD( + NativeThreadProtocol &native_thread, uint32_t concrete_frame_idx, + RegisterInfoInterface *reg_info_interface_p) + : NativeRegisterContextRegisterInfo(native_thread, concrete_frame_idx, + reg_info_interface_p) {} Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.h =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.h @@ -0,0 +1,31 @@ +//===-- NativeThreadNetBSD.h ---------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef liblldb_NativeThreadNetBSD_H_ +#define liblldb_NativeThreadNetBSD_H_ + +#include "lldb/Host/common/NativeThreadProtocol.h" + +namespace lldb_private { +namespace process_netbsd { + +class NativeProcessNetBSD; + +class NativeThreadNetBSD : public NativeThreadProtocol { + friend class NativeProcessNetBSD; + +public: + NativeThreadNetBSD(NativeProcessNetBSD *process, lldb::tid_t tid); +}; + +typedef std::shared_ptr NativeThreadNetBSDSP; +} // namespace process_netbsd +} // namespace lldb_private + +#endif // #ifndef liblldb_NativeThreadNetBSD_H_ Index: source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp =================================================================== --- /dev/null +++ source/Plugins/Process/NetBSD/NativeThreadNetBSD.cpp @@ -0,0 +1,21 @@ +//===-- NativeThreadNetBSD.cpp -------------------------------- -*- C++ -*-===// +// +// The LLVM Compiler Infrastructure +// +// This file is distributed under the University of Illinois Open Source +// License. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#include "NativeThreadNetBSD.h" +#include "NativeRegisterContextNetBSD.h" + +#include "NativeProcessNetBSD.h" + +using namespace lldb; +using namespace lldb_private; +using namespace lldb_private::process_netbsd; + +NativeThreadNetBSD::NativeThreadNetBSD(NativeProcessNetBSD *process, + lldb::tid_t tid) + : NativeThreadProtocol(process, tid) {} Index: tools/lldb-server/CMakeLists.txt =================================================================== --- tools/lldb-server/CMakeLists.txt +++ tools/lldb-server/CMakeLists.txt @@ -17,6 +17,7 @@ if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" ) include_directories( ../../../../llvm/include + ../../source/Plugins/Process/NetBSD ../../source/Plugins/Process/POSIX ) endif ()