[NativeProcessLinux] Pass around threads by reference
Summary:
Most NPL private functions took (shared) pointers to threads as arguments. This meant that the
callee could not be sure if the pointer was valid and so most functions were peppered with
null-checks. Now, I move the check closer to the source, and pass around the threads as
references (which are then assumed to be valid).
Reviewers: tberghammer
Subscribers: lldb-commits
Differential Revision: http://reviews.llvm.org/D12237
llvm-svn: 245831
diff --git a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
index 7d95f22..7bac1dc 100644
--- a/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
+++ b/lldb/source/Plugins/Process/Linux/NativeProcessLinux.h
@@ -225,25 +225,25 @@
WaitForNewThread(::pid_t tid);
void
- MonitorSIGTRAP(const siginfo_t *info, lldb::pid_t pid);
+ MonitorSIGTRAP(const siginfo_t &info, NativeThreadLinux &thread);
void
- MonitorTrace(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
+ MonitorTrace(NativeThreadLinux &thread);
void
- MonitorBreakpoint(lldb::pid_t pid, const NativeThreadLinuxSP &thread_sp);
+ MonitorBreakpoint(NativeThreadLinux &thread);
void
MonitorWatchpoint(NativeThreadLinux &thread, uint32_t wp_index);
void
- MonitorSignal(const siginfo_t *info, lldb::pid_t pid, bool exited);
+ MonitorSignal(const siginfo_t &info, NativeThreadLinux &thread, bool exited);
bool
SupportHardwareSingleStepping() const;
Error
- SetupSoftwareSingleStepping(NativeThreadProtocolSP thread_sp);
+ SetupSoftwareSingleStepping(NativeThreadLinux &thread);
#if 0
static ::ProcessMessage::CrashReason
@@ -262,9 +262,6 @@
bool
HasThreadNoLock (lldb::tid_t thread_id);
- NativeThreadProtocolSP
- MaybeGetThreadNoLock (lldb::tid_t thread_id);
-
bool
StopTrackingThread (lldb::tid_t thread_id);
@@ -272,10 +269,10 @@
AddThread (lldb::tid_t thread_id);
Error
- GetSoftwareBreakpointPCOffset (NativeRegisterContextSP context_sp, uint32_t &actual_opcode_size);
+ GetSoftwareBreakpointPCOffset(uint32_t &actual_opcode_size);
Error
- FixupBreakpointPCAsNeeded(const NativeThreadLinuxSP &thread_sp);
+ FixupBreakpointPCAsNeeded(NativeThreadLinux &thread);
/// Writes a siginfo_t structure corresponding to the given thread ID to the
/// memory region pointed to by @p siginfo.
@@ -317,7 +314,7 @@
// Resume the given thread, optionally passing it the given signal. The type of resume
// operation (continue, single-step) depends on the state parameter.
Error
- ResumeThread(const NativeThreadLinuxSP &thread_sp, lldb::StateType state, int signo);
+ ResumeThread(NativeThreadLinux &thread, lldb::StateType state, int signo);
void
ThreadWasCreated(NativeThreadLinux &thread);