Go to the documentation of this file.
19 #include "llvm/Support/Errno.h"
22 #include <sys/types.h>
23 #include <sys/ptrace.h>
29 #include <sys/types.h>
30 #include <sys/sysctl.h>
40 m_stop_info(), m_reg_context_up(
42 ), m_stop_description() {}
77 const siginfo_t *info) {
79 LLDB_LOG(log,
"tid = {0} in called with signal {1}",
GetID(), signo);
121 std::ostringstream ostr;
187 struct ptrace_lwpstatus info = {};
188 info.pl_lwpid =
m_tid;
190 PT_LWPSTATUS,
static_cast<int>(
m_process.
GetID()), &info,
sizeof(info));
196 std::vector<struct kinfo_lwp> infos;
197 int mib[5] = {CTL_KERN, KERN_LWP,
static_cast<int>(
m_process.
GetID()),
198 sizeof(
struct kinfo_lwp), 0};
201 if (::sysctl(mib, 5,
nullptr, &size,
nullptr, 0) == -1 || size == 0) {
202 LLDB_LOG(log,
"sysctl() for LWP info size failed: {0}",
203 llvm::sys::StrError());
207 mib[4] = size /
sizeof(size_t);
208 infos.resize(size /
sizeof(
struct kinfo_lwp));
210 if (sysctl(mib, 5, infos.data(), &size, NULL, 0) == -1 || size == 0) {
211 LLDB_LOG(log,
"sysctl() for LWP info failed: {0}", llvm::sys::StrError());
215 size_t nlwps = size /
sizeof(
struct kinfo_lwp);
216 for (
size_t i = 0; i < nlwps; i++) {
218 return infos[i].l_name;
252 LLDB_LOG(log,
"tid = {0} in state {1} cannot answer stop reason",
GetID(),
256 llvm_unreachable(
"unhandled StateType!");
265 uint32_t watch_flags,
bool hardware) {
268 return Status(
"not implemented");
275 return Status(
"Setting hardware watchpoint failed.");
288 return Status(
"Clearing hardware watchpoint failed.");
301 return Status(
"Setting hardware breakpoint failed.");
318 return Status(
"Clearing hardware breakpoint failed.");
void SetStoppedByVFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
Status RemoveHardwareBreakpoint(lldb::addr_t addr) override
virtual uint32_t SetHardwareBreakpoint(lldb::addr_t addr, size_t size)
@ eStateAttaching
Process is currently trying to attach.
bool GetStopReason(ThreadStopInfo &stop_info, std::string &description) override
const char * StateAsCString(lldb::StateType state)
Converts a StateType to a C string.
union lldb_private::ThreadStopInfo::@13 details
void SetStoppedByWatchpoint(uint32_t wp_index)
virtual llvm::Error CopyHardwareWatchpointsFrom(NativeRegisterContextNetBSD &source)=0
Status RemoveWatchpoint(lldb::addr_t addr) override
WatchpointIndexMap m_hw_break_index_map
void SetStoppedByFork(lldb::pid_t child_pid, lldb::tid_t child_tid)
@ eStateExited
Process has exited and can't be examined.
NativeRegisterContextNetBSD & GetRegisterContext() override
struct lldb_private::ThreadStopInfo::@13::@15 fork
@ eStateStopped
Process or thread is stopped and can be examined.
static llvm::raw_ostream & error(Stream &strm)
bool Success() const
Test for success condition.
@ eStateCrashed
Process or thread has crashed and can be examined.
virtual lldb::addr_t GetWatchpointHitAddress(uint32_t wp_index)
llvm::Error CopyWatchpointsFrom(NativeThreadNetBSD &source)
@ eStateConnected
Process is connected to remote debug services, but not launched or attached to anything yet.
Status SetWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags, bool hardware) override
void SetStoppedByVForkDone()
@ eStateLaunching
Process is in the process of launching.
Status SetHardwareBreakpoint(lldb::addr_t addr, size_t size) override
lldb::pid_t GetID() const
std::string m_stop_description
@ eStateDetached
Process has been detached and can't be examined.
string(SUBSTRING ${p} 10 -1 pStripped) if($
@ eStateUnloaded
Process is object is valid, but not currently loaded.
std::unique_ptr< NativeRegisterContextNetBSD > m_reg_context_up
WatchpointIndexMap m_watchpoint_index_map
@ eStateStepping
Process or thread is in the process of stepping and can not be examined.
@ eStateSuspended
Process or thread is in a suspended state as far as the debugger is concerned while other processes o...
std::string GetCrashReasonString(CrashReason reason, const siginfo_t &info)
@ eStopReasonExec
Program was re-exec'ed.
void SetStoppedWithNoReason()
void SetStoppedBySignal(uint32_t signo, const siginfo_t *info=nullptr)
lldb::tid_t GetID() const
lldb::StateType GetState() override
ThreadStopInfo m_stop_info
#define LLDB_LOG(log,...)
The LLDB_LOG* macros defined below are the way to emit log messages.
static Status PtraceWrapper(int req, lldb::pid_t pid, void *addr=nullptr, int data=0, int *result=nullptr)
A class that represents a running process on the host machine.
NativeProcessProtocol & m_process
void SetStoppedByBreakpoint()
#define LLDB_INVALID_INDEX32
StateType
Process and Thread States.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
virtual uint32_t SetHardwareWatchpoint(lldb::addr_t addr, size_t size, uint32_t watch_flags)
@ eStateRunning
Process or thread is running and can't be examined.
virtual lldb::addr_t GetWatchpointAddress(uint32_t wp_index)
std::string GetName() override
CrashReason GetCrashReason(const siginfo_t &info)