19#include "llvm/Support/Errno.h" 
   23#include <sys/ptrace.h> 
   29#include <sys/sysctl.h> 
   76                                            const siginfo_t *info) {
 
   78  LLDB_LOG(log, 
"tid = {0} in called with signal {1}", 
GetID(), signo);
 
 
  119  std::ostringstream ostr;
 
 
  183  struct ptrace_lwpstatus info = {};
 
  184  info.pl_lwpid = 
m_tid;
 
  186      PT_LWPSTATUS, 
static_cast<int>(
m_process.GetID()), &info, 
sizeof(info));
 
  192  std::vector<struct kinfo_lwp> infos;
 
  195  int mib[5] = {CTL_KERN, KERN_LWP, 
static_cast<int>(
m_process.GetID()),
 
  196                sizeof(
struct kinfo_lwp), 0};
 
  199  if (::sysctl(mib, 5, 
nullptr, &size, 
nullptr, 0) == -1 || size == 0) {
 
  200    LLDB_LOG(log, 
"sysctl() for LWP info size failed: {0}",
 
  201             llvm::sys::StrError());
 
  205  mib[4] = size / 
sizeof(size_t);
 
  206  infos.resize(size / 
sizeof(
struct kinfo_lwp));
 
  208  if (sysctl(mib, 5, infos.data(), &size, NULL, 0) == -1 || size == 0) {
 
  209    LLDB_LOG(log, 
"sysctl() for LWP info failed: {0}", llvm::sys::StrError());
 
  213  size_t nlwps = size / 
sizeof(
struct kinfo_lwp);
 
  214  for (
size_t i = 0; i < nlwps; i++) {
 
  216      return infos[i].l_name;
 
 
  228                                       std::string &description) {
 
  250    LLDB_LOG(log, 
"tid = {0} in state {1} cannot answer stop reason", 
GetID(),
 
  254  llvm_unreachable(
"unhandled StateType!");
 
 
  263                                         uint32_t watch_flags, 
bool hardware) {
 
 
  282  uint32_t wp_index = wp->second;
 
 
  310  uint32_t bp_index = bp->second;
 
 
static llvm::raw_ostream & error(Stream &strm)
std::string GetCrashReasonString(const siginfo_t &info)
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index)
virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index)
virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags)
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
NativeProcessProtocol & m_process
NativeThreadProtocol(NativeProcessProtocol &process, lldb::tid_t tid)
lldb::tid_t GetID() const
static Status FromErrorString(const char *str)
bool Success() const
Test for success condition.
static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr=nullptr, int data=0, int *result=nullptr)
virtual llvm::Error CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD &source)=0
void SetStoppedByFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
void SetStoppedBySignal(uint32_t signo, const siginfo_t *info=nullptr)
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
void SetStoppedWithNoReason()
std::string m_stop_description
lldb::StateType GetState() override
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
std::unique_ptr< NativeRegisterContextNetBSD > m_reg_context_up
std::string GetName() override
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
friend class NativeProcessNetBSD
NativeRegisterContextNetBSD & GetRegisterContext() override
WatchpointIndexMap m_watchpoint_index_map
void SetStoppedByVFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
void SetStoppedByVForkDone()
NativeThreadNetBSD(NativeProcessNetBSD &process, lldb::tid_t tid)
Status RemoveWatchpoint(lldb::addr_t addr) override
void SetStoppedByBreakpoint()
llvm::Error CopyWatchpointsFrom(NativeThreadNetBSD &source)
ThreadStopInfo m_stop_info
void SetStoppedByWatchpoint(uint32_t wp_index)
WatchpointIndexMap m_hw_break_index_map
#define LLDB_INVALID_INDEX32
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
StateType
Process and Thread States.
@ eStateUnloaded
Process is object is valid, but not currently loaded.
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
@ eStateDetached
Process has been detached and can't be examined.
@ eStateStopped
Process or thread is stopped and can be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
@ eStateRunning
Process or thread is running and can't be examined.
@ eStateLaunching
Process is in the process of launching.
@ eStateAttaching
Process is currently trying to attach.
@ eStateExited
Process has exited and can't be examined.
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eStateCrashed
Process or thread has crashed and can be examined.
@ eStopReasonExec
Program was re-exec'ed.