Don't cache the public stop reason, since it can change as plan completion gets processed. That means GetStopReason needs to return a shared pointer, not a pointer to the thread's cached version. Also allow the thread plans to get and set the thread private stop reason - that is usually more appropriate for the logic the thread plans need to do.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@116892 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBThread.cpp b/source/API/SBThread.cpp
index 006efc7..ee6b687 100644
--- a/source/API/SBThread.cpp
+++ b/source/API/SBThread.cpp
@@ -81,9 +81,9 @@
{
if (m_opaque_sp)
{
- lldb_private::StopInfo *stop_info = m_opaque_sp->GetStopInfo ();
- if (stop_info)
- return stop_info->GetStopReason();
+ StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
+ if (stop_info_sp)
+ return stop_info_sp->GetStopReason();
}
return eStopReasonInvalid;
}
@@ -93,10 +93,10 @@
{
if (m_opaque_sp)
{
- lldb_private::StopInfo *stop_info = m_opaque_sp->GetStopInfo ();
- if (stop_info)
+ StopInfoSP stop_info_sp = m_opaque_sp->GetStopInfo ();
+ if (stop_info_sp)
{
- const char *stop_desc = stop_info->GetDescription();
+ const char *stop_desc = stop_info_sp->GetDescription();
if (stop_desc)
{
if (dst)
@@ -110,7 +110,7 @@
else
{
size_t stop_desc_len = 0;
- switch (stop_info->GetStopReason())
+ switch (stop_info_sp->GetStopReason())
{
case eStopReasonTrace:
case eStopReasonPlanComplete:
@@ -139,7 +139,7 @@
case eStopReasonSignal:
{
- stop_desc = m_opaque_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (stop_info->GetValue());
+ stop_desc = m_opaque_sp->GetProcess().GetUnixSignals ().GetSignalAsCString (stop_info_sp->GetValue());
if (stop_desc == NULL || stop_desc[0] == '\0')
{
static char signal_desc[] = "signal";