[Lldb-commits] [lldb] r123495 - in /lldb/trunk/source/Plugins/Process/Linux: LinuxThread.cpp LinuxThread.h
Stephen Wilson
wilsons at start.ca
Fri Jan 14 16:07:36 PST 2011
Author: wilsons
Date: Fri Jan 14 18:07:36 2011
New Revision: 123495
URL: http://llvm.org/viewvc/llvm-project?rev=123495&view=rev
Log:
Have LinuxThread cache it's current StopInfo object.
Modified:
lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp
lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h
Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp?rev=123495&r1=123494&r2=123495&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp (original)
+++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.cpp Fri Jan 14 18:07:36 2011
@@ -26,6 +26,7 @@
LinuxThread::LinuxThread(Process &process, lldb::tid_t tid)
: Thread(process, tid),
m_frame_ap(0),
+ m_stop_info_id(0),
m_note(eNone)
{
}
@@ -40,6 +41,7 @@
void
LinuxThread::RefreshStateAfterStop()
{
+ RefreshPrivateStopReason();
}
const char *
@@ -101,24 +103,11 @@
lldb::StopInfoSP
LinuxThread::GetPrivateStopReason()
{
- lldb::StopInfoSP stop_info;
+ const uint32_t process_stop_id = GetProcess().GetStopID();
- switch (m_note)
- {
- default:
- break;
-
- case eBreak:
- stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(
- *this, m_breakpoint->GetID());
- break;
-
- case eTrace:
- stop_info = StopInfo::CreateStopReasonToTrace(*this);
- break;
- }
-
- return stop_info;
+ if (m_stop_info_id != process_stop_id || !m_stop_info || !m_stop_info->IsValid())
+ RefreshPrivateStopReason();
+ return m_stop_info;
}
Unwind *
@@ -196,3 +185,30 @@
{
m_note = eExit;
}
+
+void
+LinuxThread::RefreshPrivateStopReason()
+{
+ m_stop_info_id = GetProcess().GetStopID();
+
+ switch (m_note) {
+
+ default:
+ case eNone:
+ m_stop_info.reset();
+ break;
+
+ case eBreak:
+ m_stop_info = StopInfo::CreateStopReasonWithBreakpointSiteID(
+ *this, m_breakpoint->GetID());
+ break;
+
+ case eTrace:
+ m_stop_info = StopInfo::CreateStopReasonToTrace(*this);
+ break;
+
+ case eExit:
+ m_stop_info = StopInfo::CreateStopReasonWithSignal(*this, SIGCHLD);
+ break;
+ }
+}
Modified: lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h?rev=123495&r1=123494&r2=123495&view=diff
==============================================================================
--- lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h (original)
+++ lldb/trunk/source/Plugins/Process/Linux/LinuxThread.h Fri Jan 14 18:07:36 2011
@@ -72,6 +72,11 @@
std::auto_ptr<lldb_private::StackFrame> m_frame_ap;
lldb::BreakpointSiteSP m_breakpoint;
+ lldb::StopInfoSP m_stop_info;
+
+ // Cached process stop id. Used to ensure we do not recalculate stop
+ // information/state needlessly.
+ uint32_t m_stop_info_id;
enum Notification {
eNone,
@@ -87,6 +92,9 @@
lldb::StopInfoSP
GetPrivateStopReason();
+ void
+ RefreshPrivateStopReason();
+
lldb_private::Unwind *
GetUnwinder();
};
More information about the lldb-commits
mailing list