diff options
| author | Jim Ingham <jingham@apple.com> | 2011-03-31 00:19:25 +0000 |
|---|---|---|
| committer | Jim Ingham <jingham@apple.com> | 2011-03-31 00:19:25 +0000 |
| commit | 6035b67d2c27cc1af134293acb06ce7463f88671 (patch) | |
| tree | b560151fdc63ab7c4f23a1526516daa7745f838c /lldb/source/API | |
| parent | 3a195b7e7818e2828fba055e9397a07e71804bc6 (diff) | |
| download | bcm5719-llvm-6035b67d2c27cc1af134293acb06ce7463f88671.tar.gz bcm5719-llvm-6035b67d2c27cc1af134293acb06ce7463f88671.zip | |
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.
llvm-svn: 128593
Diffstat (limited to 'lldb/source/API')
| -rw-r--r-- | lldb/source/API/SBFrame.cpp | 10 | ||||
| -rw-r--r-- | lldb/source/API/SBValue.cpp | 125 |
2 files changed, 78 insertions, 57 deletions
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp index 1ba1e7a11b1..e51c2ecfcfb 100644 --- a/lldb/source/API/SBFrame.cpp +++ b/lldb/source/API/SBFrame.cpp @@ -369,7 +369,7 @@ SBFrame::FindVariable (const char *name) 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 @@ SBFrame::FindValue (const char *name, ValueType value_type) 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 @@ SBFrame::FindValue (const char *name, ValueType value_type) ((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 @@ SBFrame::FindValue (const char *name, ValueType value_type) ((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 @@ SBFrame::GetRegisters () 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/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp index 547e94326e4..a607841a527 100644 --- a/lldb/source/API/SBValue.cpp +++ b/lldb/source/API/SBValue.cpp @@ -138,16 +138,19 @@ SBValue::GetByteSize () 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 @@ SBValue::IsInScope (const SBFrame &sb_frame) 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 @@ SBValue::GetValueType () 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 @@ SBValue::GetObjectDescription (const SBFrame &sb_frame) 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 @@ SBValue::GetValueDidChange (const SBFrame &sb_frame) 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 @@ SBValue::GetSummary (const SBFrame &sb_frame) 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 @@ SBValue::GetLocation (const SBFrame &sb_frame) 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; } |

