Add stub for PluginProcessNetBSD

Summary:
This is the base for introduction of further features to support Process Tracing on NetBSD, in local and remote setup.

This code is also a starting point to synchronize the development with other BSDs. Currently NetBSD is ahead and other systems can catch up.

Sponsored by <The NetBSD Foundation>

Reviewers: emaste, joerg, kettenis, labath

Reviewed By: labath

Subscribers: mgorny, #lldb

Tags: #lldb

Differential Revision: https://reviews.llvm.org/D31138

llvm-svn: 298408
This commit is contained in:
Kamil Rytarowski 2017-03-21 17:30:47 +00:00
parent c93408a6ab
commit 1a3d19dd25
9 changed files with 234 additions and 0 deletions

View File

@ -5,6 +5,7 @@ elseif (CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
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)

View File

@ -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
)

View File

@ -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) {}

View File

@ -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_

View File

@ -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) {}

View File

@ -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

View File

@ -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) {}

View File

@ -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<NativeThreadNetBSD> NativeThreadNetBSDSP;
} // namespace process_netbsd
} // namespace lldb_private
#endif // #ifndef liblldb_NativeThreadNetBSD_H_

View File

@ -17,6 +17,7 @@ endif ()
if ( CMAKE_SYSTEM_NAME MATCHES "NetBSD" )
include_directories(
../../../../llvm/include
../../source/Plugins/Process/NetBSD
../../source/Plugins/Process/POSIX
)
endif ()