2010-06-09 00:52:24 +08:00
|
|
|
//===-- SBValue.cpp ---------------------------------------------*- C++ -*-===//
|
|
|
|
//
|
|
|
|
// The LLVM Compiler Infrastructure
|
|
|
|
//
|
|
|
|
// This file is distributed under the University of Illinois Open Source
|
|
|
|
// License. See LICENSE.TXT for details.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBValue.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
#include "lldb/Core/DataExtractor.h"
|
2010-10-26 11:11:13 +08:00
|
|
|
#include "lldb/Core/Log.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Module.h"
|
2011-08-04 06:57:10 +08:00
|
|
|
#include "lldb/Core/Scalar.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Core/Stream.h"
|
|
|
|
#include "lldb/Core/StreamFile.h"
|
|
|
|
#include "lldb/Core/Value.h"
|
|
|
|
#include "lldb/Core/ValueObject.h"
|
2011-07-30 03:53:35 +08:00
|
|
|
#include "lldb/Core/ValueObjectConstResult.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/Block.h"
|
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
|
|
|
#include "lldb/Symbol/Variable.h"
|
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
|
|
|
#include "lldb/Target/StackFrame.h"
|
2010-12-21 04:49:23 +08:00
|
|
|
#include "lldb/Target/Target.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/Thread.h"
|
|
|
|
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBProcess.h"
|
|
|
|
#include "lldb/API/SBTarget.h"
|
|
|
|
#include "lldb/API/SBThread.h"
|
|
|
|
#include "lldb/API/SBFrame.h"
|
|
|
|
#include "lldb/API/SBDebugger.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
|
|
|
SBValue::SBValue () :
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
SBValue::SBValue (const lldb::ValueObjectSP &value_sp) :
|
2010-06-23 09:19:29 +08:00
|
|
|
m_opaque_sp (value_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2010-11-06 07:17:00 +08:00
|
|
|
SBValue::SBValue(const SBValue &rhs) :
|
|
|
|
m_opaque_sp (rhs.m_opaque_sp)
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue &
|
2010-11-06 07:17:00 +08:00
|
|
|
SBValue::operator = (const SBValue &rhs)
|
|
|
|
{
|
|
|
|
if (this != &rhs)
|
|
|
|
m_opaque_sp = rhs.m_opaque_sp;
|
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValue::~SBValue()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::IsValid ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
// If this function ever changes to anything that does more than just
|
|
|
|
// check if the opaque shared pointer is non NULL, then we need to update
|
|
|
|
// all "if (m_opaque_sp)" code in this file.
|
|
|
|
return m_opaque_sp.get() != NULL;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-07 06:10:17 +08:00
|
|
|
SBError
|
|
|
|
SBValue::GetError()
|
|
|
|
{
|
|
|
|
SBError sb_error;
|
|
|
|
|
|
|
|
if (m_opaque_sp.get())
|
|
|
|
sb_error.SetError(m_opaque_sp->GetError());
|
|
|
|
|
|
|
|
return sb_error;
|
|
|
|
}
|
|
|
|
|
2011-07-08 04:46:23 +08:00
|
|
|
user_id_t
|
|
|
|
SBValue::GetID()
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetID();
|
|
|
|
return LLDB_INVALID_UID;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetName()
|
|
|
|
{
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *name = NULL;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
name = m_opaque_sp->GetName().GetCString();
|
2010-10-26 11:11:13 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (name)
|
|
|
|
log->Printf ("SBValue(%p)::GetName () => \"%s\"", m_opaque_sp.get(), name);
|
|
|
|
else
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetName () => NULL", m_opaque_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
2010-10-27 07:49:36 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
return name;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBValue::GetTypeName ()
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *name = NULL;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
name = m_opaque_sp->GetTypeName().GetCString();
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (name)
|
|
|
|
log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", m_opaque_sp.get(), name);
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetTypeName () => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
return name;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
|
|
|
SBValue::GetByteSize ()
|
|
|
|
{
|
|
|
|
size_t result = 0;
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-23 09:19:29 +08:00
|
|
|
result = m_opaque_sp->GetByteSize();
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
bool
|
|
|
|
SBValue::IsInScope ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
bool result = false;
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
result = m_opaque_sp->IsInScope ();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetValue ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2010-12-21 04:49:23 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
cstr = m_opaque_sp->GetValueAsCString ();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValue => \"%s\"", m_opaque_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValue => NULL", m_opaque_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
return cstr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2010-10-27 11:32:59 +08:00
|
|
|
ValueType
|
|
|
|
SBValue::GetValueType ()
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
ValueType result = eValueTypeInvalid;
|
2010-10-27 11:32:59 +08:00
|
|
|
if (m_opaque_sp)
|
2010-10-31 11:01:06 +08:00
|
|
|
result = m_opaque_sp->GetValueType();
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
switch (result)
|
|
|
|
{
|
|
|
|
case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", m_opaque_sp.get()); break;
|
|
|
|
case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", m_opaque_sp.get()); break;
|
|
|
|
default: log->Printf ("SBValue(%p)::GetValueType () => %i ???", m_opaque_sp.get(), result); break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return result;
|
2010-10-27 11:32:59 +08:00
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetObjectDescription ()
|
2010-09-11 07:12:17 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2011-03-31 08:19:25 +08:00
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
cstr = m_opaque_sp->GetObjectDescription ();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", m_opaque_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetObjectDescription => NULL", m_opaque_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return cstr;
|
2010-09-11 07:12:17 +08:00
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
SBType
|
|
|
|
SBValue::GetType()
|
|
|
|
{
|
|
|
|
SBType result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-08-04 06:57:10 +08:00
|
|
|
result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType()));
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.IsValid())
|
|
|
|
log->Printf ("SBValue(%p)::GetType => %p", m_opaque_sp.get(), &result);
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetType => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
bool
|
|
|
|
SBValue::GetValueDidChange ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
bool result = false;
|
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
result = m_opaque_sp->GetValueDidChange ();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValueDidChange => %i", m_opaque_sp.get(), result);
|
2010-10-31 11:01:06 +08:00
|
|
|
|
|
|
|
return result;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetSummary ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
cstr = m_opaque_sp->GetSummaryAsCString();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return cstr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetLocation ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
cstr = m_opaque_sp->GetLocationAsCString();
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2011-03-31 08:19:25 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return cstr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
bool
|
|
|
|
SBValue::SetValueFromCString (const char *value_str)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
bool success = false;
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
success = m_opaque_sp->SetValueFromCString (value_str);
|
|
|
|
}
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::SBValue
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
|
|
|
lldb::SBValue result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (type.IsValid())
|
|
|
|
{
|
2011-08-04 06:57:10 +08:00
|
|
|
result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true));
|
2011-07-30 03:53:35 +08:00
|
|
|
result.m_opaque_sp->SetName(ConstString(name));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.IsValid())
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildAtOffset => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetChildAtOffset => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::Cast (SBType type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
|
|
|
return CreateChildAtOffset(m_opaque_sp->GetName().GetCString(), 0, type);
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
|
|
|
SBValue::CreateValueFromExpression (const char *name, const char* expression)
|
|
|
|
{
|
|
|
|
lldb::SBValue result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
ValueObjectSP result_valobj_sp;
|
2011-09-10 07:04:00 +08:00
|
|
|
m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression (expression,
|
|
|
|
m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame(),
|
2011-09-22 08:41:11 +08:00
|
|
|
eExecutionPolicyOnlyWhenNeeded,
|
This patch modifies the expression parser to allow it
to execute expressions even in the absence of a process.
This allows expressions to run in situations where the
target cannot run -- e.g., to perform calculations based
on type information, or to inspect a binary's static
data.
This modification touches the following files:
lldb-private-enumerations.h
Introduce a new enum specifying the policy for
processing an expression. Some expressions should
always be JITted, for example if they are functions
that will be used over and over again. Some
expressions should always be interpreted, for
example if the target is unsafe to run. For most,
it is acceptable to JIT them, but interpretation
is preferable when possible.
Target.[h,cpp]
Have EvaluateExpression now accept the new enum.
ClangExpressionDeclMap.[cpp,h]
Add support for the IR interpreter and also make
the ClangExpressionDeclMap more robust in the
absence of a process.
ClangFunction.[cpp,h]
Add support for the new enum.
IRInterpreter.[cpp,h]
New implementation.
ClangUserExpression.[cpp,h]
Add support for the new enum, and for running
expressions in the absence of a process.
ClangExpression.h
Remove references to the old DWARF-based method
of evaluating expressions, because it has been
superseded for now.
ClangUtilityFunction.[cpp,h]
Add support for the new enum.
ClangExpressionParser.[cpp,h]
Add support for the new enum, remove references
to DWARF, and add support for checking whether
the expression could be evaluated statically.
IRForTarget.[h,cpp]
Add support for the new enum, and add utility
functions to support the interpreter.
IRToDWARF.cpp
Removed
CommandObjectExpression.cpp
Remove references to the obsolete -i option.
Process.cpp
Modify calls to ClangUserExpression::Evaluate
to pass the correct enum (for dlopen/dlclose)
SBValue.cpp
Add support for the new enum.
SBFrame.cpp
Add support for he new enum.
BreakpointOptions.cpp
Add support for the new enum.
llvm-svn: 139772
2011-09-15 10:13:07 +08:00
|
|
|
true, // unwind on error
|
|
|
|
true, // keep in memory
|
|
|
|
eNoDynamicValues,
|
2011-09-10 07:04:00 +08:00
|
|
|
result_valobj_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
result_valobj_sp->SetName(ConstString(name));
|
|
|
|
result = SBValue(result_valobj_sp);
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.IsValid())
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
|
|
|
lldb::SBValue result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
|
|
|
|
SBType real_type(type.GetPointerType());
|
|
|
|
|
|
|
|
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
|
|
|
|
|
2011-09-10 07:04:00 +08:00
|
|
|
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope(),
|
|
|
|
real_type.m_opaque_sp->GetASTContext(),
|
|
|
|
real_type.m_opaque_sp->GetOpaqueQualType(),
|
|
|
|
ConstString(name),
|
|
|
|
buffer,
|
|
|
|
lldb::endian::InlHostByteOrder(),
|
|
|
|
GetTarget().GetProcess().GetAddressByteSize()));
|
2011-07-30 03:53:35 +08:00
|
|
|
|
2011-08-05 01:07:02 +08:00
|
|
|
ValueObjectSP result_valobj_sp;
|
|
|
|
|
|
|
|
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
|
|
|
|
if (ptr_result_valobj_sp)
|
|
|
|
{
|
|
|
|
Error err;
|
|
|
|
result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
|
|
|
|
if (result_valobj_sp)
|
|
|
|
result_valobj_sp->SetName(ConstString(name));
|
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
result = SBValue(result_valobj_sp);
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.IsValid())
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildFromAddress => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
|
2011-08-10 06:38:07 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetChildFromAddress => NULL", m_opaque_sp.get());
|
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
lldb::SBValue
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
{
|
|
|
|
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())
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValue
|
|
|
|
SBValue::GetChildAtIndex (uint32_t idx)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
const bool can_create_synthetic = false;
|
|
|
|
lldb::DynamicValueType use_dynamic = eNoDynamicValues;
|
2011-06-30 05:19:39 +08:00
|
|
|
if (m_opaque_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
use_dynamic = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue();
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
return GetChildAtIndex (idx, use_dynamic, can_create_synthetic);
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool can_create_synthetic)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
lldb::ValueObjectSP child_sp;
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
const bool can_create = true;
|
|
|
|
child_sp = m_opaque_sp->GetChildAtIndex (idx, can_create);
|
|
|
|
if (can_create_synthetic && !child_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->IsPointerType())
|
|
|
|
{
|
|
|
|
child_sp = m_opaque_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
|
|
|
|
}
|
|
|
|
else if (m_opaque_sp->IsArrayType())
|
|
|
|
{
|
|
|
|
child_sp = m_opaque_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
if (child_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
if (use_dynamic != lldb::eNoDynamicValues)
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
Added the ability to get synthetic child values from SBValue objects that
represent pointers and arrays by adding an extra parameter to the
SBValue
SBValue::GetChildAtIndex (uint32_t idx,
DynamicValueType use_dynamic,
bool can_create_synthetic);
The new "can_create_synthetic" will allow you to create child values that
aren't actually a part of the original type. So if you code like:
int *foo_ptr = ...
And you have a SBValue that contains the value for "foo_ptr":
SBValue foo_value = ...
You can now get the "foo_ptr[12]" item by doing this:
v = foo_value.GetChiltAtIndex (12, lldb.eNoDynamicValues, True);
Normall the "foo_value" would only have one child value (an integer), but
we can create "synthetic" child values by treating the pointer as an array.
Likewise if you have code like:
int array[2];
array_value = ....
v = array_value.GetChiltAtIndex (0); // Success, v will be valid
v = array_value.GetChiltAtIndex (1); // Success, v will be valid
v = array_value.GetChiltAtIndex (2); // Fail, v won't be valid, "2" is not a valid zero based index in "array"
But if you use the ability to create synthetic children:
v = array_value.GetChiltAtIndex (0, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (1, lldb.eNoDynamicValues, True); // Success, v will be valid
v = array_value.GetChiltAtIndex (2, lldb.eNoDynamicValues, True); // Success, v will be valid
llvm-svn: 135292
2011-07-16 03:31:49 +08:00
|
|
|
lldb::ValueObjectSP dynamic_sp(child_sp->GetDynamicValue (use_dynamic));
|
2011-06-30 02:28:50 +08:00
|
|
|
if (dynamic_sp)
|
|
|
|
child_sp = dynamic_sp;
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValue sb_value (child_sp);
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get());
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return sb_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint32_t
|
|
|
|
SBValue::GetIndexOfChildWithName (const char *name)
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
uint32_t idx = UINT32_MAX;
|
|
|
|
if (m_opaque_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-05-21 07:51:26 +08:00
|
|
|
|
2011-06-30 02:28:50 +08:00
|
|
|
idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (idx == UINT32_MAX)
|
2011-09-21 05:44:10 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", m_opaque_sp.get(), name);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", m_opaque_sp.get(), name, idx);
|
|
|
|
}
|
|
|
|
return idx;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue
|
|
|
|
SBValue::GetChildMemberWithName (const char *name)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2011-06-30 05:19:39 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::DynamicValueType use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue();
|
2011-06-30 05:19:39 +08:00
|
|
|
return GetChildMemberWithName (name, use_dynamic_value);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
return GetChildMemberWithName (name, eNoDynamicValues);
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue
|
2011-05-04 11:43:18 +08:00
|
|
|
SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dynamic_value)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
lldb::ValueObjectSP child_sp;
|
|
|
|
const ConstString str_name (name);
|
|
|
|
|
2011-05-21 06:07:17 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-06-30 02:28:50 +08:00
|
|
|
child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
|
|
|
|
if (use_dynamic_value != lldb::eNoDynamicValues)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2011-06-30 02:28:50 +08:00
|
|
|
if (child_sp)
|
|
|
|
{
|
|
|
|
lldb::ValueObjectSP dynamic_sp = child_sp->GetDynamicValue (use_dynamic_value);
|
|
|
|
if (dynamic_sp)
|
|
|
|
child_sp = dynamic_sp;
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValue sb_value (child_sp);
|
2010-10-31 11:01:06 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get());
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return sb_value;
|
|
|
|
}
|
|
|
|
|
2011-07-15 10:26:42 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::GetValueForExpressionPath(const char* expr_path)
|
|
|
|
{
|
|
|
|
lldb::ValueObjectSP child_sp;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-07-15 10:26:42 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-07-15 10:26:42 +08:00
|
|
|
// using default values for all the fancy options, just do it if you can
|
|
|
|
child_sp = m_opaque_sp->GetValueForExpressionPath(expr_path);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
SBValue sb_value (child_sp);
|
|
|
|
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr_path, sb_value.get());
|
|
|
|
|
|
|
|
return sb_value;
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-08-04 09:41:02 +08:00
|
|
|
int64_t
|
|
|
|
SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
|
|
|
|
{
|
2011-08-13 07:34:31 +08:00
|
|
|
error.Clear();
|
2011-08-04 09:41:02 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
|
|
|
Scalar scalar;
|
|
|
|
if (m_opaque_sp->ResolveValue (scalar))
|
|
|
|
return scalar.GetRawBits64(fail_value);
|
|
|
|
else
|
|
|
|
error.SetErrorString("could not get value");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
error.SetErrorString("could not get target");
|
|
|
|
}
|
|
|
|
error.SetErrorString("invalid SBValue");
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
|
|
|
|
{
|
2011-08-13 07:34:31 +08:00
|
|
|
error.Clear();
|
2011-08-04 09:41:02 +08:00
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
|
|
|
Scalar scalar;
|
|
|
|
if (m_opaque_sp->ResolveValue (scalar))
|
|
|
|
return scalar.GetRawBits64(fail_value);
|
|
|
|
else
|
|
|
|
error.SetErrorString("could not get value");
|
|
|
|
}
|
|
|
|
else
|
|
|
|
error.SetErrorString("could not get target");
|
|
|
|
}
|
|
|
|
error.SetErrorString("invalid SBValue");
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
2011-08-04 06:57:10 +08:00
|
|
|
int64_t
|
|
|
|
SBValue::GetValueAsSigned(int64_t fail_value)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
|
|
|
Scalar scalar;
|
|
|
|
if (m_opaque_sp->ResolveValue (scalar))
|
|
|
|
return scalar.GetRawBits64(fail_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
SBValue::GetValueAsUnsigned(uint64_t fail_value)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
|
|
|
Scalar scalar;
|
|
|
|
if (m_opaque_sp->ResolveValue (scalar))
|
|
|
|
return scalar.GetRawBits64(fail_value);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
uint32_t
|
|
|
|
SBValue::GetNumChildren ()
|
|
|
|
{
|
|
|
|
uint32_t num_children = 0;
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-05-21 07:51:26 +08:00
|
|
|
|
2011-06-30 02:28:50 +08:00
|
|
|
num_children = m_opaque_sp->GetNumChildren();
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children);
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
return num_children;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
SBValue
|
|
|
|
SBValue::Dereference ()
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
SBValue sb_value;
|
|
|
|
if (m_opaque_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-05-21 07:51:26 +08:00
|
|
|
|
2011-06-30 02:28:50 +08:00
|
|
|
Error error;
|
|
|
|
sb_value = m_opaque_sp->Dereference (error);
|
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get());
|
|
|
|
|
|
|
|
return sb_value;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
2010-10-31 11:01:06 +08:00
|
|
|
SBValue::TypeIsPointerType ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
bool is_ptr_type = false;
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (m_opaque_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-05-21 07:51:26 +08:00
|
|
|
|
2011-06-30 02:28:50 +08:00
|
|
|
is_ptr_type = m_opaque_sp->IsPointerType();
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
|
2010-11-06 09:53:30 +08:00
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type);
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
return is_ptr_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
SBValue::GetOpaqueType()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
if (m_opaque_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
2011-06-30 02:28:50 +08:00
|
|
|
{
|
2011-07-30 03:53:35 +08:00
|
|
|
Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
|
2011-05-21 07:51:26 +08:00
|
|
|
|
2011-06-30 02:28:50 +08:00
|
|
|
return m_opaque_sp->GetClangType();
|
|
|
|
}
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2010-06-09 00:52:24 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::SBTarget
|
|
|
|
SBValue::GetTarget()
|
|
|
|
{
|
|
|
|
SBTarget result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
|
|
|
|
{
|
|
|
|
result = SBTarget(lldb::TargetSP(m_opaque_sp->GetUpdatePoint().GetTargetSP()));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.get() == NULL)
|
|
|
|
log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get());
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), result.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBProcess
|
|
|
|
SBValue::GetProcess()
|
|
|
|
{
|
|
|
|
SBProcess result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
result = SBProcess(lldb::ProcessSP(target->GetProcessSP()));
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.get() == NULL)
|
|
|
|
log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get());
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), result.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBThread
|
|
|
|
SBValue::GetThread()
|
|
|
|
{
|
|
|
|
SBThread result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
|
|
|
|
{
|
2011-09-10 07:04:00 +08:00
|
|
|
result = SBThread(m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateThread()->GetSP());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.get() == NULL)
|
|
|
|
log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), result.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBFrame
|
|
|
|
SBValue::GetFrame()
|
|
|
|
{
|
|
|
|
SBFrame result;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope())
|
|
|
|
{
|
2011-09-10 07:04:00 +08:00
|
|
|
result.SetFrame (m_opaque_sp->GetUpdatePoint().GetExecutionContextScope()->CalculateStackFrame()->GetSP());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (result.get() == NULL)
|
|
|
|
log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get());
|
|
|
|
else
|
|
|
|
log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), result.get());
|
|
|
|
}
|
|
|
|
return result;
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
// Mimic shared pointer...
|
|
|
|
lldb_private::ValueObject *
|
|
|
|
SBValue::get() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb_private::ValueObject *
|
|
|
|
SBValue::operator->() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp.get();
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ValueObjectSP &
|
|
|
|
SBValue::operator*()
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const lldb::ValueObjectSP &
|
|
|
|
SBValue::operator*() const
|
|
|
|
{
|
2010-06-23 09:19:29 +08:00
|
|
|
return m_opaque_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-09-20 13:20:02 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
bool
|
|
|
|
SBValue::GetExpressionPath (SBStream &description)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
A few of the issue I have been trying to track down and fix have been due to
the way LLDB lazily gets complete definitions for types within the debug info.
When we run across a class/struct/union definition in the DWARF, we will only
parse the full definition if we need to. This works fine for top level types
that are assigned directly to variables and arguments, but when we have a
variable with a class, lets say "A" for this example, that has a member:
"B *m_b". Initially we don't need to hunt down a definition for this class
unless we are ever asked to do something with it ("expr m_b->getDecl()" for
example). With my previous approach to lazy type completion, we would be able
to take a "A *a" and get a complete type for it, but we wouldn't be able to
then do an "a->m_b->getDecl()" unless we always expanded all types within a
class prior to handing out the type. Expanding everything is very costly and
it would be great if there were a better way.
A few months ago I worked with the llvm/clang folks to have the
ExternalASTSource class be able to complete classes if there weren't completed
yet:
class ExternalASTSource {
....
virtual void
CompleteType (clang::TagDecl *Tag);
virtual void
CompleteType (clang::ObjCInterfaceDecl *Class);
};
This was great, because we can now have the class that is producing the AST
(SymbolFileDWARF and SymbolFileDWARFDebugMap) sign up as external AST sources
and the object that creates the forward declaration types can now also
complete them anywhere within the clang type system.
This patch makes a few major changes:
- lldb_private::Module classes now own the AST context. Previously the TypeList
objects did.
- The DWARF parsers now sign up as an external AST sources so they can complete
types.
- All of the pure clang type system wrapper code we have in LLDB (ClangASTContext,
ClangASTType, and more) can now be iterating through children of any type,
and if a class/union/struct type (clang::RecordType or ObjC interface)
is found that is incomplete, we can ask the AST to get the definition.
- The SymbolFileDWARFDebugMap class now will create and use a single AST that
all child SymbolFileDWARF classes will share (much like what happens when
we have a complete linked DWARF for an executable).
We will need to modify some of the ClangUserExpression code to take more
advantage of this completion ability in the near future. Meanwhile we should
be better off now that we can be accessing any children of variables through
pointers and always be able to resolve the clang type if needed.
llvm-svn: 123613
2011-01-17 11:46:26 +08:00
|
|
|
m_opaque_sp->GetExpressionPath (description.ref(), false);
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
m_opaque_sp->GetExpressionPath (description.ref(), qualify_cxx_base_classes);
|
2010-10-31 11:01:06 +08:00
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
bool
|
|
|
|
SBValue::GetDescription (SBStream &description)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
2011-08-16 02:01:31 +08:00
|
|
|
/*uint32_t ptr_depth = 0;
|
2011-07-07 00:49:27 +08:00
|
|
|
uint32_t curr_depth = 0;
|
|
|
|
uint32_t max_depth = UINT32_MAX;
|
|
|
|
bool show_types = false;
|
|
|
|
bool show_location = false;
|
|
|
|
bool use_objc = false;
|
|
|
|
lldb::DynamicValueType use_dynamic = eNoDynamicValues;
|
|
|
|
bool scope_already_checked = false;
|
|
|
|
bool flat_output = false;
|
2011-07-22 08:16:08 +08:00
|
|
|
bool use_synthetic = true;
|
|
|
|
uint32_t no_summary_depth = 0;
|
2011-08-16 02:01:31 +08:00
|
|
|
bool ignore_cap = false;*/
|
2011-07-07 00:49:27 +08:00
|
|
|
ValueObject::DumpValueObject (description.ref(),
|
2011-08-16 02:01:31 +08:00
|
|
|
m_opaque_sp.get());
|
2010-09-20 13:20:02 +08:00
|
|
|
}
|
|
|
|
else
|
|
|
|
description.Printf ("No value");
|
|
|
|
|
|
|
|
return true;
|
|
|
|
}
|
2011-01-06 02:43:15 +08:00
|
|
|
|
|
|
|
lldb::Format
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::GetFormat ()
|
2011-01-06 02:43:15 +08:00
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
return m_opaque_sp->GetFormat();
|
|
|
|
return eFormatDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetFormat (lldb::Format format)
|
|
|
|
{
|
|
|
|
if (m_opaque_sp)
|
|
|
|
m_opaque_sp->SetFormat(format);
|
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::AddressOf()
|
|
|
|
{
|
|
|
|
SBValue sb_value;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
Mutex::Locker api_locker (target->GetAPIMutex());
|
2011-07-30 03:53:35 +08:00
|
|
|
Error error;
|
|
|
|
sb_value = m_opaque_sp->AddressOf (error);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetPointerToObject () => SBValue(%p)", m_opaque_sp.get(), sb_value.get());
|
|
|
|
|
|
|
|
return sb_value;
|
2011-08-10 06:38:07 +08:00
|
|
|
}
|
Redesign of the interaction between Python and frozen objects:
- introduced two new classes ValueObjectConstResultChild and ValueObjectConstResultImpl: the first one is a ValueObjectChild obtained from
a ValueObjectConstResult, the second is a common implementation backend for VOCR and VOCRCh of method calls meant to read through pointers stored
in frozen objects ; now such reads transparently move from host to target as required
- as a consequence of the above, removed code that made target-memory copies of expression results in several places throughout LLDB, and also
removed code that enabled to recognize an expression result VO as such
- introduced a new GetPointeeData() method in ValueObject that lets you read a given amount of objects of type T from a VO
representing a T* or T[], and doing dereferences transparently
in private layer it returns a DataExtractor ; in public layer it returns an instance of a newly created lldb::SBData
- as GetPointeeData() does the right thing for both frozen and non-frozen ValueObject's, reimplemented ReadPointedString() to use it
en lieu of doing the raw read itself
- introduced a new GetData() method in ValueObject that lets you get a copy of the data that backs the ValueObject (for pointers,
this returns the address without any previous dereferencing steps ; for arrays it actually reads the whole chunk of memory)
in public layer this returns an SBData, just like GetPointeeData()
- introduced a new CreateValueFromData() method in SBValue that lets you create a new SBValue from a chunk of data wrapped in an SBData
the limitation to remember for this kind of SBValue is that they have no address: extracting the address-of for these objects (with any
of GetAddress(), GetLoadAddress() and AddressOf()) will return invalid values
- added several tests to check that "p"-ing objects (STL classes, char* and char[]) will do the right thing
Solved a bug where global pointers to global variables were not dereferenced correctly for display
New target setting "max-string-summary-length" gives the maximum number of characters to show in a string when summarizing it, instead of the hardcoded 128
Solved a bug where the summary for char[] and char* would not be shown if the ValueObject's were dumped via the "p" command
Removed m_pointers_point_to_load_addrs from ValueObject. Introduced a new m_address_type_of_children, which each ValueObject can set to tell the address type
of any pointers and/or references it creates. In the current codebase, this is load address most of the time (the only notable exception being file
addresses that generate file address children UNLESS we have a live process)
Updated help text for summary-string
Fixed an issue in STL formatters where std::stlcontainer::iterator would match the container's synthetic children providers
Edited the syntax and help for some commands to have proper argument types
llvm-svn: 139160
2011-09-07 03:20:51 +08:00
|
|
|
|
|
|
|
lldb::addr_t
|
|
|
|
SBValue::GetLoadAddress()
|
|
|
|
{
|
|
|
|
lldb::addr_t value = LLDB_INVALID_ADDRESS;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
Mutex::Locker api_locker (target->GetAPIMutex());
|
|
|
|
const bool scalar_is_load_address = true;
|
|
|
|
AddressType addr_type;
|
|
|
|
value = m_opaque_sp->GetAddressOf(scalar_is_load_address, &addr_type);
|
|
|
|
if (addr_type == eAddressTypeFile)
|
|
|
|
{
|
|
|
|
Module* module = m_opaque_sp->GetModule();
|
|
|
|
if (!module)
|
|
|
|
value = LLDB_INVALID_ADDRESS;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Address addr;
|
|
|
|
module->ResolveFileAddress(value, addr);
|
|
|
|
value = addr.GetLoadAddress(m_opaque_sp->GetUpdatePoint().GetTargetSP().get());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else if (addr_type == eAddressTypeHost || addr_type == eAddressTypeInvalid)
|
|
|
|
value = LLDB_INVALID_ADDRESS;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetLoadAddress () => (%llu)", m_opaque_sp.get(), value);
|
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBAddress
|
|
|
|
SBValue::GetAddress()
|
|
|
|
{
|
|
|
|
Address addr;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
lldb::addr_t value = LLDB_INVALID_ADDRESS;
|
|
|
|
Mutex::Locker api_locker (target->GetAPIMutex());
|
|
|
|
const bool scalar_is_load_address = true;
|
|
|
|
AddressType addr_type;
|
|
|
|
value = m_opaque_sp->GetAddressOf(scalar_is_load_address, &addr_type);
|
|
|
|
if (addr_type == eAddressTypeFile)
|
|
|
|
{
|
|
|
|
Module* module = m_opaque_sp->GetModule();
|
|
|
|
if (module)
|
|
|
|
module->ResolveFileAddress(value, addr);
|
|
|
|
}
|
|
|
|
else if (addr_type == eAddressTypeLoad)
|
|
|
|
{
|
|
|
|
// no need to check the return value on this.. if it can actually do the resolve
|
|
|
|
// addr will be in the form (section,offset), otherwise it will simply be returned
|
|
|
|
// as (NULL, value)
|
|
|
|
addr.SetLoadAddress(value, target);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", m_opaque_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset());
|
|
|
|
return SBAddress(new Address(addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBData
|
|
|
|
SBValue::GetPointeeData (uint32_t item_idx,
|
|
|
|
uint32_t item_count)
|
|
|
|
{
|
|
|
|
lldb::SBData sb_data;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
DataExtractorSP data_sp(new DataExtractor());
|
|
|
|
Mutex::Locker api_locker (target->GetAPIMutex());
|
|
|
|
m_opaque_sp->GetPointeeData(*data_sp, item_idx, item_count);
|
|
|
|
if (data_sp->GetByteSize() > 0)
|
|
|
|
*sb_data = data_sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
|
|
|
|
m_opaque_sp.get(),
|
|
|
|
item_idx,
|
|
|
|
item_count,
|
|
|
|
sb_data.get());
|
|
|
|
|
|
|
|
return sb_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBData
|
|
|
|
SBValue::GetData ()
|
|
|
|
{
|
|
|
|
lldb::SBData sb_data;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
{
|
|
|
|
Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
|
|
|
|
if (target)
|
|
|
|
{
|
|
|
|
DataExtractorSP data_sp(new DataExtractor());
|
|
|
|
Mutex::Locker api_locker (target->GetAPIMutex());
|
|
|
|
m_opaque_sp->GetData(*data_sp);
|
|
|
|
if (data_sp->GetByteSize() > 0)
|
|
|
|
*sb_data = data_sp;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
|
|
|
|
m_opaque_sp.get(),
|
|
|
|
sb_data.get());
|
|
|
|
|
|
|
|
return sb_data;
|
|
|
|
}
|