Convert ValueObject to explicitly maintain the Execution Context in which they were created, and then use that when they update themselves. That means all the ValueObject evaluate me type functions that used to require a Frame object now do not. I didn't remove the SBValue API's that take this now useless frame, but I added ones that don't require the frame, and marked the SBFrame taking ones as deprecated.
git-svn-id: https://llvm.org/svn/llvm-project/llvdb/trunk@128593 91177308-0d34-0410-b5e6-96231b3b80d8
diff --git a/source/API/SBFrame.cpp b/source/API/SBFrame.cpp
index 1ba1e7a..e51c2ec 100644
--- a/source/API/SBFrame.cpp
+++ b/source/API/SBFrame.cpp
@@ -369,7 +369,7 @@
SBValue sb_value;
if (var_sp)
- *sb_value = ValueObjectSP (new ValueObjectVariable (var_sp));
+ *sb_value = ValueObjectSP (new ValueObjectVariable (m_opaque_sp.get(), var_sp));
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
@@ -416,7 +416,7 @@
variable_sp->GetScope() == value_type &&
variable_sp->GetName() == const_name)
{
- *sb_value = ValueObjectSP (new ValueObjectVariable (variable_sp));
+ *sb_value = ValueObjectSP (new ValueObjectVariable (m_opaque_sp.get(), variable_sp));
break;
}
}
@@ -437,7 +437,7 @@
((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
(reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
{
- *sb_value = ValueObjectSP (new ValueObjectRegister (NULL, reg_ctx, reg_idx));
+ *sb_value = ValueObjectSP (new ValueObjectRegister (m_opaque_sp.get(), reg_ctx, reg_idx));
}
}
}
@@ -457,7 +457,7 @@
((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
(reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
{
- *sb_value = ValueObjectSP (new ValueObjectRegisterSet (NULL, reg_ctx, set_idx));
+ *sb_value = ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx));
}
}
}
@@ -651,7 +651,7 @@
const uint32_t num_sets = reg_ctx->GetRegisterSetCount();
for (uint32_t set_idx = 0; set_idx < num_sets; ++set_idx)
{
- value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (NULL, reg_ctx, set_idx)));
+ value_list.Append(ValueObjectSP (new ValueObjectRegisterSet (m_opaque_sp.get(), reg_ctx, set_idx)));
}
}
}
diff --git a/source/API/SBValue.cpp b/source/API/SBValue.cpp
index 547e943..a607841 100644
--- a/source/API/SBValue.cpp
+++ b/source/API/SBValue.cpp
@@ -138,16 +138,19 @@
bool
SBValue::IsInScope (const SBFrame &sb_frame)
{
+ return IsInScope();
+}
+
+bool
+SBValue::IsInScope ()
+{
bool result = false;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- result = m_opaque_sp->IsInScope (frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ result = m_opaque_sp->IsInScope ();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
@@ -160,23 +163,26 @@
const char *
SBValue::GetValue (const SBFrame &sb_frame)
{
+ return GetValue();
+}
+
+const char *
+SBValue::GetValue ()
+{
const char *cstr = NULL;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- cstr = m_opaque_sp->GetValueAsCString (frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ cstr = m_opaque_sp->GetValueAsCString ();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetValue (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), sb_frame.get(), cstr);
+ log->Printf ("SBValue(%p)::GetValue => \"%s\"", m_opaque_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetValue (SBFrame(%p)) => NULL", m_opaque_sp.get(), sb_frame.get());
+ log->Printf ("SBValue(%p)::GetValue => NULL", m_opaque_sp.get());
}
return cstr;
@@ -210,23 +216,26 @@
const char *
SBValue::GetObjectDescription (const SBFrame &sb_frame)
{
+ return GetObjectDescription ();
+}
+
+const char *
+SBValue::GetObjectDescription ()
+{
const char *cstr = NULL;
- if ( m_opaque_sp)
+ if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- cstr = m_opaque_sp->GetObjectDescription (frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ cstr = m_opaque_sp->GetObjectDescription ();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetObjectDescription (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), sb_frame.get(), cstr);
+ log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", m_opaque_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetObjectDescription (SBFrame(%p)) => NULL", m_opaque_sp.get(), sb_frame.get());
+ log->Printf ("SBValue(%p)::GetObjectDescription => NULL", m_opaque_sp.get());
}
return cstr;
}
@@ -234,19 +243,22 @@
bool
SBValue::GetValueDidChange (const SBFrame &sb_frame)
{
+ return GetValueDidChange ();
+}
+
+bool
+SBValue::GetValueDidChange ()
+{
bool result = false;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- result = m_opaque_sp->GetValueDidChange (frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ result = m_opaque_sp->GetValueDidChange ();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetValueDidChange (SBFrame(%p)) => %i", m_opaque_sp.get(), sb_frame.get(), result);
+ log->Printf ("SBValue(%p)::GetValueDidChange => %i", m_opaque_sp.get(), result);
return result;
}
@@ -254,23 +266,26 @@
const char *
SBValue::GetSummary (const SBFrame &sb_frame)
{
+ return GetSummary ();
+}
+
+const char *
+SBValue::GetSummary ()
+{
const char *cstr = NULL;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- cstr = m_opaque_sp->GetSummaryAsCString(frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ cstr = m_opaque_sp->GetSummaryAsCString();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), sb_frame.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => NULL", m_opaque_sp.get(), sb_frame.get());
+ log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
}
return cstr;
}
@@ -278,23 +293,26 @@
const char *
SBValue::GetLocation (const SBFrame &sb_frame)
{
+ return GetLocation ();
+}
+
+const char *
+SBValue::GetLocation ()
+{
const char *cstr = NULL;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- cstr = m_opaque_sp->GetLocationAsCString(frame);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ cstr = m_opaque_sp->GetLocationAsCString();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => \"%s\"", m_opaque_sp.get(), sb_frame.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary (SBFrame(%p)) => NULL", m_opaque_sp.get(), sb_frame.get());
+ log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
}
return cstr;
}
@@ -302,15 +320,18 @@
bool
SBValue::SetValueFromCString (const SBFrame &sb_frame, const char *value_str)
{
+ return SetValueFromCString (value_str);
+}
+
+bool
+SBValue::SetValueFromCString (const char *value_str)
+{
bool success = false;
if (m_opaque_sp)
{
- StackFrame *frame = sb_frame.get();
- if (frame)
- {
- Mutex::Locker api_locker (frame->GetThread().GetProcess().GetTarget().GetAPIMutex());
- success = m_opaque_sp->SetValueFromCString (frame, value_str);
- }
+ if (m_opaque_sp->GetUpdatePoint().GetTarget())
+ Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTarget()->GetAPIMutex());
+ success = m_opaque_sp->SetValueFromCString (value_str);
}
return success;
}