lldb::SBValue SBValue::CreateValueFromData (const char* name, SBData data, SBType type) { SBValue result; AddressType addr_of_children_priv = eAddressTypeLoad; if (m_opaque_sp) { ValueObjectSP valobj_sp; valobj_sp = ValueObjectConstResult::Create (m_opaque_sp->GetExecutionContextScope(), type.m_opaque_sp->GetASTContext() , type.m_opaque_sp->GetOpaqueQualType(), ConstString(name), *data.m_opaque_sp, LLDB_INVALID_ADDRESS); valobj_sp->SetAddressTypeOfChildren(addr_of_children_priv); result = SBValue(valobj_sp); } LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); if (log) { if (result.IsValid()) log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString()); else log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get()); } return result; }
void Xcode::RunExpression (SBFrame frame, const char* expression, bool po, bool verbose) { SBValue value (frame.EvaluateExpression (expression, eDynamicCanRunTarget)); FetchVariable (value,0,verbose); if (po) { auto descr = value.GetObjectDescription(); if (descr) printf("po = %s\n",descr); } }
SBError SBThread::ReturnFromFrame(SBFrame &frame, SBValue &return_value) { SBError sb_error; Log *log(lldb_private::GetLogIfAllCategoriesSet(LIBLLDB_LOG_API)); std::unique_lock<std::recursive_mutex> lock; ExecutionContext exe_ctx(m_opaque_sp.get(), lock); if (log) log->Printf("SBThread(%p)::ReturnFromFrame (frame=%d)", static_cast<void *>(exe_ctx.GetThreadPtr()), frame.GetFrameID()); if (exe_ctx.HasThreadScope()) { Thread *thread = exe_ctx.GetThreadPtr(); sb_error.SetError( thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP())); } return sb_error; }
SBError SBThread::ReturnFromFrame (SBFrame &frame, SBValue &return_value) { SBError sb_error; Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API)); Mutex::Locker api_locker; ExecutionContext exe_ctx (m_opaque_sp.get(), api_locker); if (log) log->Printf ("SBThread(%p)::ReturnFromFrame (frame=%d)", exe_ctx.GetThreadPtr(), frame.GetFrameID()); if (exe_ctx.HasThreadScope()) { Thread *thread = exe_ctx.GetThreadPtr(); sb_error.SetError (thread->ReturnFromFrame(frame.GetFrameSP(), return_value.GetSP())); } return sb_error; }
void Xcode::FetchVariable (SBValue value, uint32_t expand, bool verbose) { auto name = value.GetName(); auto num_value = value.GetValueAsUnsigned(0); auto summary = value.GetSummary(); auto in_scope = value.IsInScope(); auto has_children = value.MightHaveChildren(); auto type_1 = value.GetType(); auto type_2 = value.GetType(); auto type_name_1 = value.GetTypeName(); auto type_3 = value.GetType(); auto type_name_2 = value.GetTypeName(); if (verbose) printf("%s %s = 0x%llx (%llu) %s\n",value.GetTypeName(),value.GetName(),num_value, num_value,summary); if (expand > 0) { auto count = value.GetNumChildren(); for (int i = 0; i < count; i++) { SBValue child(value.GetChildAtIndex(i, lldb::eDynamicCanRunTarget, true)); FetchVariable (child,expand-1,verbose); } } }