summaryrefslogtreecommitdiffstats
path: root/lldb/source/Plugins/Process/MacOSX-Kernel
diff options
context:
space:
mode:
authorGreg Clayton <gclayton@apple.com>2013-05-09 01:55:29 +0000
committerGreg Clayton <gclayton@apple.com>2013-05-09 01:55:29 +0000
commit6e0ff1a3cb5a1719c12ce156c4297d724c20b955 (patch)
tree2ea43845a7393dc9bb2df095f72b25a3393ca914 /lldb/source/Plugins/Process/MacOSX-Kernel
parent083fcdb41448362b803c47fe85dfeb830d25220c (diff)
downloadbcm5719-llvm-6e0ff1a3cb5a1719c12ce156c4297d724c20b955.tar.gz
bcm5719-llvm-6e0ff1a3cb5a1719c12ce156c4297d724c20b955.zip
Changed the formerly pure virtual function:
namespace lldb_private { class Thread { virtual lldb::StopInfoSP GetPrivateStopReason() = 0; }; } To not be virtual. The lldb_private::Thread now handles the correct caching and will call a new pure virtual function: namespace lldb_private { class Thread { virtual bool CalculateStopInfo() = 0; } } This function must be overridden by thead lldb_private::Thread subclass and the only thing it needs to do is to set the Thread::StopInfo() with the current stop reason and return true, or return false if there is no stop reason. The lldb_private::Thread class will take care of calling this function only when it is required. This allows lldb_private::Thread subclasses to be a bit simpler and not all need to duplicate the cache and invalidation settings. Also renamed: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopReason(); To: lldb::StopInfoSP lldb_private::Thread::GetPrivateStopInfo(); Also cleaned up a case where the ThreadPlanStepOverBreakpoint might not re-set its breakpoint if the thread disappears (which was happening due to a bug when using the OperatingSystem plug-ins with memory threads and real threads). llvm-svn: 181501
Diffstat (limited to 'lldb/source/Plugins/Process/MacOSX-Kernel')
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp42
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp23
-rw-r--r--lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h9
3 files changed, 35 insertions, 39 deletions
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
index afa18dacc7d..c78aa42da20 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ProcessKDP.cpp
@@ -385,11 +385,16 @@ ProcessKDP::DoResume ()
if (kernel_thread_sp)
{
const StateType thread_resume_state = kernel_thread_sp->GetTemporaryResumeState();
+
+ if (log)
+ log->Printf ("ProcessKDP::DoResume() thread_resume_state = %s", StateAsCString(thread_resume_state));
switch (thread_resume_state)
{
case eStateSuspended:
// Nothing to do here when a thread will stay suspended
// we just leave the CPU mask bit set to zero for the thread
+ if (log)
+ log->Printf ("ProcessKDP::DoResume() = suspended???");
break;
case eStateStepping:
@@ -398,6 +403,8 @@ ProcessKDP::DoResume ()
if (reg_ctx_sp)
{
+ if (log)
+ log->Printf ("ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep (true);");
reg_ctx_sp->HardwareSingleStep (true);
resume = true;
}
@@ -412,15 +419,17 @@ ProcessKDP::DoResume ()
{
lldb::RegisterContextSP reg_ctx_sp (kernel_thread_sp->GetRegisterContext());
- if (reg_ctx_sp)
- {
- reg_ctx_sp->HardwareSingleStep (false);
- resume = true;
- }
- else
- {
- error.SetErrorStringWithFormat("KDP thread 0x%llx has no register context", kernel_thread_sp->GetID());
- }
+ if (reg_ctx_sp)
+ {
+ if (log)
+ log->Printf ("ProcessKDP::DoResume () reg_ctx_sp->HardwareSingleStep (false);");
+ reg_ctx_sp->HardwareSingleStep (false);
+ resume = true;
+ }
+ else
+ {
+ error.SetErrorStringWithFormat("KDP thread 0x%llx has no register context", kernel_thread_sp->GetID());
+ }
}
break;
@@ -540,22 +549,15 @@ ProcessKDP::DoDetach(bool keep_stopped)
// If we are going to keep the target stopped, then don't send the disconnect message.
if (!keep_stopped && m_comm.IsConnected())
{
-
- bool disconnect_success = m_comm.SendRequestDisconnect();
- if (!disconnect_success)
- {
- if (log)
- log->PutCString ("ProcessKDP::DoDetach(): send disconnect request failed");
- }
-
- ConnectionStatus comm_disconnect_result = m_comm.Disconnect ();
+ const bool success = m_comm.SendRequestDisconnect();
if (log)
{
- if (comm_disconnect_result == eConnectionStatusSuccess)
- log->PutCString ("ProcessKDP::DoDetach() conncection channel shutdown successfully");
+ if (success)
+ log->PutCString ("ProcessKDP::DoDetach() detach packet sent successfully");
else
log->PutCString ("ProcessKDP::DoDetach() connection channel shutdown failed");
}
+ m_comm.Disconnect ();
}
}
StopAsyncThread ();
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
index 6f0116e7f44..94567c87eda 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.cpp
@@ -148,26 +148,23 @@ ThreadKDP::CreateRegisterContextForFrame (StackFrame *frame)
return reg_ctx_sp;
}
-lldb::StopInfoSP
-ThreadKDP::GetPrivateStopReason ()
+bool
+ThreadKDP::CalculateStopInfo ()
{
ProcessSP process_sp (GetProcess());
if (process_sp)
{
- const uint32_t process_stop_id = process_sp->GetStopID();
- if (m_thread_stop_reason_stop_id != process_stop_id ||
- (m_actual_stop_info_sp && !m_actual_stop_info_sp->IsValid()))
+ if (m_cached_stop_info_sp)
{
- if (IsStillAtLastBreakpointHit())
- return m_actual_stop_info_sp;
-
- if (m_cached_stop_info_sp)
- SetStopInfo (m_cached_stop_info_sp);
- else
- SetStopInfo(StopInfo::CreateStopReasonWithSignal (*this, SIGSTOP));
+ SetStopInfo (m_cached_stop_info_sp);
+ }
+ else
+ {
+ SetStopInfo(StopInfo::CreateStopReasonWithSignal (*this, SIGSTOP));
}
+ return true;
}
- return m_actual_stop_info_sp;
+ return false;
}
void
diff --git a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
index 5a980f504fc..7dc373f0355 100644
--- a/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
+++ b/lldb/source/Plugins/Process/MacOSX-Kernel/ThreadKDP.h
@@ -89,13 +89,10 @@ protected:
lldb::addr_t m_thread_dispatch_qaddr;
lldb::StopInfoSP m_cached_stop_info_sp;
//------------------------------------------------------------------
- // Member variables.
+ // Protected member functions.
//------------------------------------------------------------------
-
- virtual lldb::StopInfoSP
- GetPrivateStopReason ();
-
-
+ virtual bool
+ CalculateStopInfo ();
};
#endif // liblldb_ThreadKDP_h_
OpenPOWER on IntegriCloud