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.
|
|
|
|
//
|
|
|
|
//===----------------------------------------------------------------------===//
|
|
|
|
|
2012-12-05 08:20:57 +08:00
|
|
|
#include "lldb/lldb-python.h"
|
|
|
|
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBValue.h"
|
2012-02-17 11:18:30 +08:00
|
|
|
|
2012-10-11 06:54:17 +08:00
|
|
|
#include "lldb/API/SBDeclaration.h"
|
2010-09-20 13:20:02 +08:00
|
|
|
#include "lldb/API/SBStream.h"
|
2012-02-17 11:18:30 +08:00
|
|
|
#include "lldb/API/SBTypeFilter.h"
|
|
|
|
#include "lldb/API/SBTypeFormat.h"
|
|
|
|
#include "lldb/API/SBTypeSummary.h"
|
|
|
|
#include "lldb/API/SBTypeSynthetic.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
2011-10-14 08:42:25 +08:00
|
|
|
#include "lldb/Breakpoint/Watchpoint.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"
|
<rdar://problem/11757916>
Make breakpoint setting by file and line much more efficient by only looking for inlined breakpoint locations if we are setting a breakpoint in anything but a source implementation file. Implementing this complex for a many reasons. Turns out that parsing compile units lazily had some issues with respect to how we need to do things with DWARF in .o files. So the fixes in the checkin for this makes these changes:
- Add a new setting called "target.inline-breakpoint-strategy" which can be set to "never", "always", or "headers". "never" will never try and set any inlined breakpoints (fastest). "always" always looks for inlined breakpoint locations (slowest, but most accurate). "headers", which is the default setting, will only look for inlined breakpoint locations if the breakpoint is set in what are consudered to be header files, which is realy defined as "not in an implementation source file".
- modify the breakpoint setting by file and line to check the current "target.inline-breakpoint-strategy" setting and act accordingly
- Modify compile units to be able to get their language and other info lazily. This allows us to create compile units from the debug map and not have to fill all of the details in, and then lazily discover this information as we go on debuggging. This is needed to avoid parsing all .o files when setting breakpoints in implementation only files (no inlines). Otherwise we would need to parse the .o file, the object file (mach-o in our case) and the symbol file (DWARF in the object file) just to see what the compile unit was.
- modify the "SymbolFileDWARFDebugMap" to subclass lldb_private::Module so that the virtual "GetObjectFile()" and "GetSymbolVendor()" functions can be intercepted when the .o file contenst are later lazilly needed. Prior to this fix, when we first instantiated the "SymbolFileDWARFDebugMap" class, we would also make modules, object files and symbol files for every .o file in the debug map because we needed to fix up the sections in the .o files with information that is in the executable debug map. Now we lazily do this in the DebugMapModule::GetObjectFile()
Cleaned up header includes a bit as well.
llvm-svn: 162860
2012-08-30 05:13:06 +08:00
|
|
|
#include "lldb/Core/Section.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"
|
2013-01-29 07:47:25 +08:00
|
|
|
#include "lldb/DataFormatters/DataVisualization.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/Block.h"
|
2012-10-11 06:54:17 +08:00
|
|
|
#include "lldb/Symbol/Declaration.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/ObjectFile.h"
|
2012-02-04 10:27:34 +08:00
|
|
|
#include "lldb/Symbol/Type.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Symbol/Variable.h"
|
2011-10-14 08:42:25 +08:00
|
|
|
#include "lldb/Symbol/VariableList.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
#include "lldb/Target/ExecutionContext.h"
|
|
|
|
#include "lldb/Target/Process.h"
|
2013-11-02 10:23:02 +08:00
|
|
|
#include "lldb/Target/Frame.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"
|
|
|
|
|
2012-10-17 05:41:58 +08:00
|
|
|
#include "lldb/API/SBDebugger.h"
|
|
|
|
#include "lldb/API/SBExpressionOptions.h"
|
|
|
|
#include "lldb/API/SBFrame.h"
|
2010-06-09 15:44:37 +08:00
|
|
|
#include "lldb/API/SBProcess.h"
|
|
|
|
#include "lldb/API/SBTarget.h"
|
|
|
|
#include "lldb/API/SBThread.h"
|
2010-06-09 00:52:24 +08:00
|
|
|
|
|
|
|
using namespace lldb;
|
|
|
|
using namespace lldb_private;
|
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
class ValueImpl
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ValueImpl ()
|
2012-10-23 02:18:36 +08:00
|
|
|
{
|
2013-04-23 06:57:56 +08:00
|
|
|
}
|
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueImpl (lldb::ValueObjectSP in_valobj_sp,
|
2013-04-23 06:57:56 +08:00
|
|
|
lldb::DynamicValueType use_dynamic,
|
2013-05-15 10:16:21 +08:00
|
|
|
bool use_synthetic,
|
|
|
|
const char *name = NULL) :
|
2013-08-27 07:57:52 +08:00
|
|
|
m_valobj_sp(in_valobj_sp),
|
|
|
|
m_use_dynamic(use_dynamic),
|
|
|
|
m_use_synthetic(use_synthetic),
|
|
|
|
m_name (name)
|
2013-04-23 06:57:56 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (!m_name.IsEmpty() && m_valobj_sp)
|
|
|
|
m_valobj_sp->SetName(m_name);
|
2013-04-23 06:57:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
ValueImpl (const ValueImpl& rhs) :
|
2013-08-27 07:57:52 +08:00
|
|
|
m_valobj_sp(rhs.m_valobj_sp),
|
|
|
|
m_use_dynamic(rhs.m_use_dynamic),
|
|
|
|
m_use_synthetic(rhs.m_use_synthetic),
|
|
|
|
m_name (rhs.m_name)
|
2013-04-23 06:57:56 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueImpl &
|
|
|
|
operator = (const ValueImpl &rhs)
|
|
|
|
{
|
|
|
|
if (this != &rhs)
|
2012-10-23 02:18:36 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
m_valobj_sp = rhs.m_valobj_sp;
|
2013-04-23 06:57:56 +08:00
|
|
|
m_use_dynamic = rhs.m_use_dynamic;
|
|
|
|
m_use_synthetic = rhs.m_use_synthetic;
|
2013-05-15 10:16:21 +08:00
|
|
|
m_name = rhs.m_name;
|
2012-10-23 02:18:36 +08:00
|
|
|
}
|
2013-04-23 06:57:56 +08:00
|
|
|
return *this;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
IsValid ()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
return m_valobj_sp.get() != NULL;
|
2013-04-23 06:57:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ValueObjectSP
|
|
|
|
GetRootSP ()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
return m_valobj_sp;
|
2013-04-23 06:57:56 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ValueObjectSP
|
2013-05-15 10:16:21 +08:00
|
|
|
GetSP (Process::StopLocker &stop_locker, Mutex::Locker &api_locker, Error &error)
|
2013-04-23 06:57:56 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (!m_valobj_sp)
|
|
|
|
{
|
|
|
|
error.SetErrorString("invalid value object");
|
|
|
|
return m_valobj_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ValueObjectSP value_sp = m_valobj_sp;
|
2012-10-23 02:18:36 +08:00
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
Target *target = value_sp->GetTargetSP().get();
|
|
|
|
if (target)
|
2013-05-15 10:16:21 +08:00
|
|
|
api_locker.Lock(target->GetAPIMutex());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ProcessSP process_sp(value_sp->GetProcessSP());
|
|
|
|
if (process_sp && !stop_locker.TryLock (&process_sp->GetRunLock()))
|
|
|
|
{
|
|
|
|
// We don't allow people to play around with ValueObject if the process is running.
|
|
|
|
// If you want to look at values, pause the process, then look.
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetSP() => error: process is running", value_sp.get());
|
|
|
|
error.SetErrorString ("process must be stopped.");
|
|
|
|
return ValueObjectSP();
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
if (value_sp->GetDynamicValue(m_use_dynamic))
|
|
|
|
value_sp = value_sp->GetDynamicValue(m_use_dynamic);
|
|
|
|
if (value_sp->GetSyntheticValue(m_use_synthetic))
|
|
|
|
value_sp = value_sp->GetSyntheticValue(m_use_synthetic);
|
2013-05-15 10:16:21 +08:00
|
|
|
if (!value_sp)
|
|
|
|
error.SetErrorString("invalid value object");
|
|
|
|
if (!m_name.IsEmpty())
|
|
|
|
value_sp->SetName(m_name);
|
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
return value_sp;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetUseDynamic (lldb::DynamicValueType use_dynamic)
|
|
|
|
{
|
|
|
|
m_use_dynamic = use_dynamic;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SetUseSynthetic (bool use_synthetic)
|
|
|
|
{
|
|
|
|
m_use_synthetic = use_synthetic;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::DynamicValueType
|
|
|
|
GetUseDynamic ()
|
|
|
|
{
|
|
|
|
return m_use_dynamic;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
GetUseSynthetic ()
|
|
|
|
{
|
|
|
|
return m_use_synthetic;
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
// All the derived values that we would make from the m_valobj_sp will share
|
|
|
|
// the ExecutionContext with m_valobj_sp, so we don't need to do the calculations
|
|
|
|
// in GetSP to return the Target, Process, Thread or Frame. It is convenient to
|
|
|
|
// provide simple accessors for these, which I do here.
|
|
|
|
TargetSP
|
|
|
|
GetTargetSP ()
|
|
|
|
{
|
|
|
|
if (m_valobj_sp)
|
|
|
|
return m_valobj_sp->GetTargetSP();
|
|
|
|
else
|
|
|
|
return TargetSP();
|
|
|
|
}
|
|
|
|
|
|
|
|
ProcessSP
|
|
|
|
GetProcessSP ()
|
|
|
|
{
|
|
|
|
if (m_valobj_sp)
|
|
|
|
return m_valobj_sp->GetProcessSP();
|
|
|
|
else
|
|
|
|
return ProcessSP();
|
|
|
|
}
|
|
|
|
|
|
|
|
ThreadSP
|
|
|
|
GetThreadSP ()
|
|
|
|
{
|
|
|
|
if (m_valobj_sp)
|
|
|
|
return m_valobj_sp->GetThreadSP();
|
|
|
|
else
|
|
|
|
return ThreadSP();
|
|
|
|
}
|
2013-04-23 06:57:56 +08:00
|
|
|
|
2013-11-02 10:23:02 +08:00
|
|
|
FrameSP
|
2013-05-15 10:16:21 +08:00
|
|
|
GetFrameSP ()
|
|
|
|
{
|
|
|
|
if (m_valobj_sp)
|
|
|
|
return m_valobj_sp->GetFrameSP();
|
|
|
|
else
|
2013-11-02 10:23:02 +08:00
|
|
|
return FrameSP();
|
2013-05-15 10:16:21 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
private:
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::ValueObjectSP m_valobj_sp;
|
2013-04-23 06:57:56 +08:00
|
|
|
lldb::DynamicValueType m_use_dynamic;
|
|
|
|
bool m_use_synthetic;
|
2013-05-15 10:16:21 +08:00
|
|
|
ConstString m_name;
|
|
|
|
};
|
|
|
|
|
|
|
|
class ValueLocker
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
ValueLocker ()
|
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
ValueObjectSP
|
|
|
|
GetLockedSP(ValueImpl &in_value)
|
|
|
|
{
|
|
|
|
return in_value.GetSP(m_stop_locker, m_api_locker, m_lock_error);
|
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
Error &
|
|
|
|
GetError()
|
|
|
|
{
|
|
|
|
return m_lock_error;
|
|
|
|
}
|
|
|
|
|
|
|
|
private:
|
|
|
|
Process::StopLocker m_stop_locker;
|
|
|
|
Mutex::Locker m_api_locker;
|
|
|
|
Error m_lock_error;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-04-23 06:57:56 +08:00
|
|
|
};
|
2012-10-23 02:18:36 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
SBValue::SBValue () :
|
2013-08-27 07:57:52 +08:00
|
|
|
m_opaque_sp ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
SBValue::SBValue (const lldb::ValueObjectSP &value_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SetSP(value_sp);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
SBValue::SBValue(const SBValue &rhs)
|
2010-11-06 07:17:00 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SetSP(rhs.m_opaque_sp);
|
2010-11-06 07:17:00 +08:00
|
|
|
}
|
|
|
|
|
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)
|
2012-03-27 10:35:13 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SetSP(rhs.m_opaque_sp);
|
2012-03-27 10:35:13 +08:00
|
|
|
}
|
2010-11-06 07:17:00 +08:00
|
|
|
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.
|
2012-10-23 02:18:36 +08:00
|
|
|
return m_opaque_sp.get() != NULL && m_opaque_sp->GetRootSP().get() != NULL;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2011-12-20 04:39:44 +08:00
|
|
|
void
|
|
|
|
SBValue::Clear()
|
|
|
|
{
|
|
|
|
m_opaque_sp.reset();
|
|
|
|
}
|
|
|
|
|
2010-10-07 06:10:17 +08:00
|
|
|
SBError
|
|
|
|
SBValue::GetError()
|
|
|
|
{
|
|
|
|
SBError sb_error;
|
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
sb_error.SetError(value_sp->GetError());
|
2012-01-30 15:41:31 +08:00
|
|
|
else
|
2013-05-15 10:16:21 +08:00
|
|
|
sb_error.SetErrorStringWithFormat ("error: %s", locker.GetError().AsCString());
|
2010-10-07 06:10:17 +08:00
|
|
|
|
|
|
|
return sb_error;
|
|
|
|
}
|
|
|
|
|
2011-07-08 04:46:23 +08:00
|
|
|
user_id_t
|
|
|
|
SBValue::GetID()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
return value_sp->GetID();
|
2011-07-08 04:46:23 +08:00
|
|
|
return LLDB_INVALID_UID;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetName()
|
|
|
|
{
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *name = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
name = value_sp->GetName().GetCString();
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (name)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetName () => \"%s\"", value_sp.get(), name);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
return name;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
const char *
|
|
|
|
SBValue::GetTypeName ()
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *name = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2012-08-21 09:46:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
name = value_sp->GetQualifiedTypeName().GetCString();
|
2012-08-21 09:46:35 +08:00
|
|
|
}
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (name)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", value_sp.get(), name);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
return name;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
size_t
|
|
|
|
SBValue::GetByteSize ()
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-06-09 00:52:24 +08:00
|
|
|
size_t result = 0;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2012-08-21 09:46:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
result = value_sp->GetByteSize();
|
2012-08-21 09:46:35 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-11-30 05:49:15 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetByteSize () => %" PRIu64, value_sp.get(), (uint64_t)result);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
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;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
result = value_sp->IsInScope ();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
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
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
cstr = value_sp->GetValueAsCString ();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValue() => \"%s\"", value_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValue() => NULL", value_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
2013-08-27 07:57:52 +08:00
|
|
|
|
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;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
result = value_sp->GetValueType();
|
2013-05-15 10:16:21 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
switch (result)
|
|
|
|
{
|
2013-08-27 07:57:52 +08:00
|
|
|
case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", value_sp.get()); break;
|
|
|
|
case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", value_sp.get()); break;
|
|
|
|
case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", value_sp.get()); break;
|
|
|
|
case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", value_sp.get()); break;
|
|
|
|
case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", value_sp.get()); break;
|
|
|
|
case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", value_sp.get()); break;
|
|
|
|
case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", value_sp.get()); break;
|
|
|
|
case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", value_sp.get()); break;
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
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
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
cstr = value_sp->GetObjectDescription ();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetObjectDescription() => \"%s\"", value_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetObjectDescription() => NULL", value_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()
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2012-02-04 10:27:34 +08:00
|
|
|
SBType sb_type;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
TypeImplSP type_sp;
|
|
|
|
if (value_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-10-29 08:28:35 +08:00
|
|
|
type_sp.reset (new TypeImpl(value_sp->GetTypeImpl()));
|
2013-05-15 10:16:21 +08:00
|
|
|
sb_type.SetSP(type_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
if (log)
|
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
if (type_sp)
|
|
|
|
log->Printf ("SBValue(%p)::GetType => SBType(%p)", value_sp.get(), type_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetType => NULL", value_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
return sb_type;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
2011-03-31 08:19:25 +08:00
|
|
|
bool
|
|
|
|
SBValue::GetValueDidChange ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
bool result = false;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
result = value_sp->GetValueDidChange ();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValueDidChange() => %i", value_sp.get(), result);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
return result;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-02-21 13:33:55 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2011-03-31 08:19:25 +08:00
|
|
|
const char *
|
|
|
|
SBValue::GetSummary ()
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
cstr = value_sp->GetSummaryAsCString();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary() => \"%s\"", value_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetSummary() => NULL", value_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return cstr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2012-02-21 13:33:55 +08:00
|
|
|
#endif // LLDB_DISABLE_PYTHON
|
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
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
const char *cstr = NULL;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
cstr = value_sp->GetLocationAsCString();
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (cstr)
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetLocation() => \"%s\"", value_sp.get(), cstr);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-04-06 10:17:47 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetLocation() => NULL", value_sp.get());
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return cstr;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-05-09 05:25:06 +08:00
|
|
|
// Deprecated - use the one that takes an lldb::SBError
|
2011-03-31 08:19:25 +08:00
|
|
|
bool
|
|
|
|
SBValue::SetValueFromCString (const char *value_str)
|
2012-05-09 05:25:06 +08:00
|
|
|
{
|
|
|
|
lldb::SBError dummy;
|
|
|
|
return SetValueFromCString(value_str,dummy);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBValue::SetValueFromCString (const char *value_str, lldb::SBError& error)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
|
|
|
bool success = false;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-12-21 04:49:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
success = value_sp->SetValueFromCString (value_str,error.ref());
|
2010-12-21 04:49:23 +08:00
|
|
|
}
|
2013-05-15 10:16:21 +08:00
|
|
|
else
|
|
|
|
error.SetErrorStringWithFormat ("Could not get value: %s", locker.GetError().AsCString());
|
|
|
|
|
2012-04-06 10:17:47 +08:00
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::SetValueFromCString(\"%s\") => %i", value_sp.get(), value_str, success);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return success;
|
|
|
|
}
|
|
|
|
|
2012-02-17 11:18:30 +08:00
|
|
|
lldb::SBTypeFormat
|
|
|
|
SBValue::GetTypeFormat ()
|
|
|
|
{
|
|
|
|
lldb::SBTypeFormat format;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-17 11:18:30 +08:00
|
|
|
if (value_sp)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (value_sp->UpdateValueIfNeeded(true))
|
2012-02-17 11:18:30 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::TypeFormatImplSP format_sp = value_sp->GetValueFormat();
|
|
|
|
if (format_sp)
|
|
|
|
format.SetSP(format_sp);
|
2012-02-17 11:18:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return format;
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:33:55 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2012-02-17 11:18:30 +08:00
|
|
|
lldb::SBTypeSummary
|
|
|
|
SBValue::GetTypeSummary ()
|
|
|
|
{
|
|
|
|
lldb::SBTypeSummary summary;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-17 11:18:30 +08:00
|
|
|
if (value_sp)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (value_sp->UpdateValueIfNeeded(true))
|
2012-04-06 10:17:47 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::TypeSummaryImplSP summary_sp = value_sp->GetSummaryFormat();
|
|
|
|
if (summary_sp)
|
|
|
|
summary.SetSP(summary_sp);
|
2012-02-17 11:18:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
return summary;
|
|
|
|
}
|
2012-02-21 13:33:55 +08:00
|
|
|
#endif // LLDB_DISABLE_PYTHON
|
2012-02-17 11:18:30 +08:00
|
|
|
|
|
|
|
lldb::SBTypeFilter
|
|
|
|
SBValue::GetTypeFilter ()
|
|
|
|
{
|
|
|
|
lldb::SBTypeFilter filter;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-17 11:18:30 +08:00
|
|
|
if (value_sp)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (value_sp->UpdateValueIfNeeded(true))
|
2012-04-06 10:17:47 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::SyntheticChildrenSP synthetic_sp = value_sp->GetSyntheticChildren();
|
|
|
|
|
|
|
|
if (synthetic_sp && !synthetic_sp->IsScripted())
|
2012-02-17 11:18:30 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
TypeFilterImplSP filter_sp = std::static_pointer_cast<TypeFilterImpl>(synthetic_sp);
|
|
|
|
filter.SetSP(filter_sp);
|
2012-02-17 11:18:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return filter;
|
|
|
|
}
|
|
|
|
|
2012-02-21 13:33:55 +08:00
|
|
|
#ifndef LLDB_DISABLE_PYTHON
|
2012-02-17 11:18:30 +08:00
|
|
|
lldb::SBTypeSynthetic
|
|
|
|
SBValue::GetTypeSynthetic ()
|
|
|
|
{
|
|
|
|
lldb::SBTypeSynthetic synthetic;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-17 11:18:30 +08:00
|
|
|
if (value_sp)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (value_sp->UpdateValueIfNeeded(true))
|
2012-02-17 11:18:30 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::SyntheticChildrenSP children_sp = value_sp->GetSyntheticChildren();
|
|
|
|
|
|
|
|
if (children_sp && children_sp->IsScripted())
|
2012-02-17 11:18:30 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ScriptedSyntheticChildrenSP synth_sp = std::static_pointer_cast<ScriptedSyntheticChildren>(children_sp);
|
|
|
|
synthetic.SetSP(synth_sp);
|
2012-02-17 11:18:30 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return synthetic;
|
|
|
|
}
|
2012-02-21 13:33:55 +08:00
|
|
|
#endif
|
2012-02-17 11:18:30 +08:00
|
|
|
|
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
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::SBValue sb_value;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::ValueObjectSP new_value_sp;
|
|
|
|
if (value_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
TypeImplSP type_sp (type.GetSP());
|
|
|
|
if (type.IsValid())
|
2012-04-14 02:30:20 +08:00
|
|
|
{
|
2013-10-29 08:28:35 +08:00
|
|
|
sb_value.SetSP(value_sp->GetSyntheticChildAtOffset(offset, type_sp->GetClangASTType(false), true),GetPreferDynamicValue(),GetPreferSyntheticValue(), name);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
if (new_value_sp)
|
2012-10-17 05:41:58 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateChildAtOffset => \"%s\"",
|
|
|
|
value_sp.get(),
|
|
|
|
new_value_sp->GetName().AsCString());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2012-10-17 05:41:58 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateChildAtOffset => NULL",
|
|
|
|
value_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
return sb_value;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
2011-09-10 07:04:00 +08:00
|
|
|
SBValue::Cast (SBType type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2012-01-31 12:25:15 +08:00
|
|
|
lldb::SBValue sb_value;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
TypeImplSP type_sp (type.GetSP());
|
|
|
|
if (value_sp && type_sp)
|
2013-10-29 08:28:35 +08:00
|
|
|
sb_value.SetSP(value_sp->Cast(type_sp->GetClangASTType(false)),GetPreferDynamicValue(),GetPreferSyntheticValue());
|
2012-01-31 12:25:15 +08:00
|
|
|
return sb_value;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
|
|
|
SBValue::CreateValueFromExpression (const char *name, const char* expression)
|
2012-10-17 05:41:58 +08:00
|
|
|
{
|
|
|
|
SBExpressionOptions options;
|
2012-10-17 06:58:25 +08:00
|
|
|
options.ref().SetKeepInMemory(true);
|
2012-10-17 05:41:58 +08:00
|
|
|
return CreateValueFromExpression (name, expression, options);
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
|
|
|
SBValue::CreateValueFromExpression (const char *name, const char *expression, SBExpressionOptions &options)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::SBValue sb_value;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::ValueObjectSP new_value_sp;
|
|
|
|
if (value_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2012-02-17 15:49:44 +08:00
|
|
|
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
|
2013-05-15 10:16:21 +08:00
|
|
|
Target* target = exe_ctx.GetTargetPtr();
|
|
|
|
if (target)
|
2012-04-06 10:17:47 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
options.ref().SetKeepInMemory(true);
|
|
|
|
target->EvaluateExpression (expression,
|
|
|
|
exe_ctx.GetFramePtr(),
|
|
|
|
new_value_sp,
|
|
|
|
options.ref());
|
|
|
|
if (new_value_sp)
|
2012-02-17 15:49:44 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
new_value_sp->SetName(ConstString(name));
|
|
|
|
sb_value.SetSP(new_value_sp);
|
2012-02-17 15:49:44 +08:00
|
|
|
}
|
2011-12-20 09:52:44 +08:00
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
if (log)
|
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
if (new_value_sp)
|
2012-06-05 04:13:23 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => SBValue (%p)",
|
2012-04-06 10:17:47 +08:00
|
|
|
value_sp.get(),
|
|
|
|
name,
|
|
|
|
expression,
|
|
|
|
new_value_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2012-06-05 04:13:23 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromExpression(name=\"%s\", expression=\"%s\") => NULL",
|
2012-04-06 10:17:47 +08:00
|
|
|
value_sp.get(),
|
|
|
|
name,
|
|
|
|
expression);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
return sb_value;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
2012-02-04 10:27:34 +08:00
|
|
|
SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType sb_type)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::SBValue sb_value;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::ValueObjectSP new_value_sp;
|
|
|
|
lldb::TypeImplSP type_impl_sp (sb_type.GetSP());
|
|
|
|
if (value_sp && type_impl_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-10-29 08:28:35 +08:00
|
|
|
ClangASTType pointer_ast_type(type_impl_sp->GetClangASTType(false).GetPointerType ());
|
2013-10-09 05:49:02 +08:00
|
|
|
if (pointer_ast_type)
|
2012-02-04 10:27:34 +08:00
|
|
|
{
|
|
|
|
lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2012-02-17 15:49:44 +08:00
|
|
|
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
|
|
|
|
ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
|
2013-10-09 05:49:02 +08:00
|
|
|
pointer_ast_type,
|
2012-02-04 10:27:34 +08:00
|
|
|
ConstString(name),
|
|
|
|
buffer,
|
2013-10-09 05:49:02 +08:00
|
|
|
exe_ctx.GetByteOrder(),
|
2012-02-17 15:49:44 +08:00
|
|
|
exe_ctx.GetAddressByteSize()));
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
if (ptr_result_valobj_sp)
|
|
|
|
{
|
|
|
|
ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
|
|
|
|
Error err;
|
|
|
|
new_value_sp = ptr_result_valobj_sp->Dereference(err);
|
|
|
|
if (new_value_sp)
|
|
|
|
new_value_sp->SetName(ConstString(name));
|
|
|
|
}
|
|
|
|
sb_value.SetSP(new_value_sp);
|
2011-08-05 01:07:02 +08:00
|
|
|
}
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
if (new_value_sp)
|
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
|
2011-08-10 06:38:07 +08:00
|
|
|
else
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get());
|
2011-08-10 06:38:07 +08:00
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
return sb_value;
|
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
|
|
|
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
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::SBValue sb_value;
|
|
|
|
lldb::ValueObjectSP new_value_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2012-02-17 15:49:44 +08:00
|
|
|
ExecutionContext exe_ctx (value_sp->GetExecutionContextRef());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2012-02-17 15:49:44 +08:00
|
|
|
new_value_sp = ValueObjectConstResult::Create (exe_ctx.GetBestExecutionContextScope(),
|
2013-10-29 08:28:35 +08:00
|
|
|
type.m_opaque_sp->GetClangASTType(false),
|
2012-02-04 10:27:34 +08:00
|
|
|
ConstString(name),
|
|
|
|
*data.m_opaque_sp,
|
|
|
|
LLDB_INVALID_ADDRESS);
|
|
|
|
new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
|
|
|
|
sb_value.SetSP(new_value_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
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
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
|
|
|
if (log)
|
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
if (new_value_sp)
|
2012-06-05 04:13:23 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromData => \"%s\"", value_sp.get(), new_value_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
|
2012-06-05 04:13:23 +08:00
|
|
|
log->Printf ("SBValue(%p)::CreateValueFromData => NULL", value_sp.get());
|
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
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
return sb_value;
|
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
|
|
|
}
|
|
|
|
|
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;
|
2013-05-15 10:16:21 +08:00
|
|
|
TargetSP target_sp;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
target_sp = m_opaque_sp->GetTargetSP();
|
|
|
|
|
|
|
|
if (target_sp)
|
|
|
|
use_dynamic = target_sp->GetPreferDynamicValue();
|
2013-08-27 07:57:52 +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
|
|
|
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;
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
const bool can_create = true;
|
|
|
|
child_sp = value_sp->GetChildAtIndex (idx, can_create);
|
|
|
|
if (can_create_synthetic && !child_sp)
|
2012-04-06 10:17:47 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
if (value_sp->IsPointerType())
|
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
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
|
|
|
|
}
|
|
|
|
else if (value_sp->IsArrayType())
|
|
|
|
{
|
|
|
|
child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue sb_value;
|
|
|
|
sb_value.SetSP (child_sp, use_dynamic, GetPreferSyntheticValue());
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
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;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-05-21 07:51:26 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
idx = value_sp->GetIndexOfChildWithName (ConstString(name));
|
2011-05-21 07:51:26 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
|
|
|
{
|
|
|
|
if (idx == UINT32_MAX)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", value_sp.get(), name);
|
2010-10-31 11:01:06 +08:00
|
|
|
else
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", value_sp.get(), name, idx);
|
2010-10-31 11:01:06 +08:00
|
|
|
}
|
|
|
|
return idx;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
SBValue
|
|
|
|
SBValue::GetChildMemberWithName (const char *name)
|
2011-04-16 08:01:13 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
|
|
|
|
TargetSP target_sp;
|
|
|
|
if (m_opaque_sp)
|
|
|
|
target_sp = m_opaque_sp->GetTargetSP();
|
|
|
|
|
|
|
|
if (target_sp)
|
|
|
|
use_dynamic_value = target_sp->GetPreferDynamicValue();
|
|
|
|
return GetChildMemberWithName (name, use_dynamic_value);
|
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);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
child_sp = value_sp->GetChildMemberWithName (str_name, true);
|
2011-04-16 08:01:13 +08:00
|
|
|
}
|
|
|
|
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue sb_value;
|
|
|
|
sb_value.SetSP(child_sp, use_dynamic_value, GetPreferSyntheticValue());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return sb_value;
|
|
|
|
}
|
|
|
|
|
2011-12-09 03:44:08 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
|
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue value_sb;
|
|
|
|
if (IsValid())
|
2011-12-09 03:44:08 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),use_dynamic,m_opaque_sp->GetUseSynthetic()));
|
|
|
|
value_sb.SetSP(proxy_sp);
|
2011-12-09 03:44:08 +08:00
|
|
|
}
|
2012-10-23 02:18:36 +08:00
|
|
|
return value_sb;
|
2011-12-09 03:44:08 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBValue
|
|
|
|
SBValue::GetStaticValue ()
|
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue value_sb;
|
|
|
|
if (IsValid())
|
2011-12-09 03:44:08 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),eNoDynamicValues,m_opaque_sp->GetUseSynthetic()));
|
|
|
|
value_sb.SetSP(proxy_sp);
|
2011-12-09 03:44:08 +08:00
|
|
|
}
|
2012-10-23 02:18:36 +08:00
|
|
|
return value_sb;
|
2011-12-09 03:44:08 +08:00
|
|
|
}
|
|
|
|
|
2012-03-27 10:35:13 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::GetNonSyntheticValue ()
|
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue value_sb;
|
|
|
|
if (IsValid())
|
|
|
|
{
|
|
|
|
ValueImplSP proxy_sp(new ValueImpl(m_opaque_sp->GetRootSP(),m_opaque_sp->GetUseDynamic(),false));
|
|
|
|
value_sb.SetSP(proxy_sp);
|
|
|
|
}
|
|
|
|
return value_sb;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::DynamicValueType
|
|
|
|
SBValue::GetPreferDynamicValue ()
|
|
|
|
{
|
|
|
|
if (!IsValid())
|
|
|
|
return eNoDynamicValues;
|
|
|
|
return m_opaque_sp->GetUseDynamic();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetPreferDynamicValue (lldb::DynamicValueType use_dynamic)
|
|
|
|
{
|
|
|
|
if (IsValid())
|
|
|
|
return m_opaque_sp->SetUseDynamic (use_dynamic);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBValue::GetPreferSyntheticValue ()
|
|
|
|
{
|
|
|
|
if (!IsValid())
|
|
|
|
return false;
|
|
|
|
return m_opaque_sp->GetUseSynthetic();
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetPreferSyntheticValue (bool use_synthetic)
|
|
|
|
{
|
|
|
|
if (IsValid())
|
|
|
|
return m_opaque_sp->SetUseSynthetic (use_synthetic);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBValue::IsDynamic()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-03-27 10:35:13 +08:00
|
|
|
if (value_sp)
|
2013-05-15 10:16:21 +08:00
|
|
|
return value_sp->IsDynamic();
|
2012-10-23 02:18:36 +08:00
|
|
|
return false;
|
2012-03-27 10:35:13 +08:00
|
|
|
}
|
|
|
|
|
2011-12-09 03:44:08 +08:00
|
|
|
bool
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue::IsSynthetic ()
|
2011-12-09 03:44:08 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2013-05-15 10:16:21 +08:00
|
|
|
return value_sp->IsSynthetic();
|
2011-12-09 03:44:08 +08:00
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
2011-07-15 10:26:42 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::GetValueForExpressionPath(const char* expr_path)
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-15 10:26:42 +08:00
|
|
|
lldb::ValueObjectSP child_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-07-15 10:26:42 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
// using default values for all the fancy options, just do it if you can
|
|
|
|
child_sp = value_sp->GetValueForExpressionPath(expr_path);
|
2011-07-15 10:26:42 +08:00
|
|
|
}
|
|
|
|
|
2012-10-23 02:18:36 +08:00
|
|
|
SBValue sb_value;
|
|
|
|
sb_value.SetSP(child_sp,GetPreferDynamicValue(),GetPreferSyntheticValue());
|
2011-07-15 10:26:42 +08:00
|
|
|
|
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get());
|
2011-07-15 10:26:42 +08:00
|
|
|
|
|
|
|
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();
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-08-04 09:41:02 +08:00
|
|
|
{
|
2013-11-01 02:57:50 +08:00
|
|
|
bool success = true;
|
|
|
|
uint64_t ret_val = fail_value;
|
|
|
|
ret_val = value_sp->GetValueAsSigned(fail_value, &success);
|
|
|
|
if (!success)
|
|
|
|
error.SetErrorString("could not resolve value");
|
|
|
|
return ret_val;
|
2011-08-04 09:41:02 +08:00
|
|
|
}
|
2013-05-15 10:16:21 +08:00
|
|
|
else
|
|
|
|
error.SetErrorStringWithFormat ("could not get SBValue: %s", locker.GetError().AsCString());
|
|
|
|
|
2011-08-04 09:41:02 +08:00
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
|
|
|
|
{
|
2011-08-13 07:34:31 +08:00
|
|
|
error.Clear();
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-08-04 09:41:02 +08:00
|
|
|
{
|
2013-11-01 02:57:50 +08:00
|
|
|
bool success = true;
|
|
|
|
uint64_t ret_val = fail_value;
|
|
|
|
ret_val = value_sp->GetValueAsUnsigned(fail_value, &success);
|
|
|
|
if (!success)
|
2013-05-15 10:16:21 +08:00
|
|
|
error.SetErrorString("could not resolve value");
|
2013-11-01 02:57:50 +08:00
|
|
|
return ret_val;
|
2011-08-04 09:41:02 +08:00
|
|
|
}
|
2013-05-15 10:16:21 +08:00
|
|
|
else
|
|
|
|
error.SetErrorStringWithFormat ("could not get SBValue: %s", locker.GetError().AsCString());
|
|
|
|
|
2011-08-04 09:41:02 +08:00
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
2011-08-04 06:57:10 +08:00
|
|
|
int64_t
|
|
|
|
SBValue::GetValueAsSigned(int64_t fail_value)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-08-04 06:57:10 +08:00
|
|
|
{
|
2013-11-01 02:57:50 +08:00
|
|
|
return value_sp->GetValueAsSigned(fail_value);
|
2011-08-04 06:57:10 +08:00
|
|
|
}
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
|
|
|
uint64_t
|
|
|
|
SBValue::GetValueAsUnsigned(uint64_t fail_value)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-08-04 06:57:10 +08:00
|
|
|
{
|
2013-11-01 02:57:50 +08:00
|
|
|
return value_sp->GetValueAsUnsigned(fail_value);
|
2011-08-04 06:57:10 +08:00
|
|
|
}
|
|
|
|
return fail_value;
|
|
|
|
}
|
|
|
|
|
2012-10-23 09:50:10 +08:00
|
|
|
bool
|
|
|
|
SBValue::MightHaveChildren ()
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2012-10-23 09:50:10 +08:00
|
|
|
bool has_children = false;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-10-23 09:50:10 +08:00
|
|
|
if (value_sp)
|
|
|
|
has_children = value_sp->MightHaveChildren();
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2012-10-23 09:50:10 +08:00
|
|
|
if (log)
|
2013-02-28 10:26:12 +08:00
|
|
|
log->Printf ("SBValue(%p)::MightHaveChildren() => %i", value_sp.get(), has_children);
|
2012-10-23 09:50:10 +08:00
|
|
|
return has_children;
|
|
|
|
}
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
uint32_t
|
|
|
|
SBValue::GetNumChildren ()
|
|
|
|
{
|
|
|
|
uint32_t num_children = 0;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2013-05-15 10:16:21 +08:00
|
|
|
num_children = value_sp->GetNumChildren();
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
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;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2013-08-27 07:57:52 +08:00
|
|
|
Error error;
|
|
|
|
sb_value = value_sp->Dereference (error);
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get());
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
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;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2013-05-15 10:16:21 +08:00
|
|
|
is_ptr_type = value_sp->IsPointerType();
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2010-10-31 11:01:06 +08:00
|
|
|
if (log)
|
2012-02-04 10:27:34 +08:00
|
|
|
log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
|
|
|
|
2010-06-09 00:52:24 +08:00
|
|
|
return is_ptr_type;
|
|
|
|
}
|
|
|
|
|
|
|
|
void *
|
|
|
|
SBValue::GetOpaqueType()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2013-07-12 06:46:58 +08:00
|
|
|
return value_sp->GetClangType().GetOpaqueQualType();
|
2010-06-09 00:52:24 +08:00
|
|
|
return NULL;
|
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::SBTarget
|
|
|
|
SBValue::GetTarget()
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
SBTarget sb_target;
|
|
|
|
TargetSP target_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
if (m_opaque_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
target_sp = m_opaque_sp->GetTargetSP();
|
2012-01-30 15:41:31 +08:00
|
|
|
sb_target.SetSP (target_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
if (target_sp.get() == NULL)
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), target_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-01-30 15:41:31 +08:00
|
|
|
return sb_target;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBProcess
|
|
|
|
SBValue::GetProcess()
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
SBProcess sb_process;
|
|
|
|
ProcessSP process_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
if (m_opaque_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
process_sp = m_opaque_sp->GetProcessSP();
|
|
|
|
sb_process.SetSP (process_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
if (process_sp.get() == NULL)
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), process_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-01-30 15:41:31 +08:00
|
|
|
return sb_process;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBThread
|
|
|
|
SBValue::GetThread()
|
|
|
|
{
|
2012-01-30 10:53:15 +08:00
|
|
|
SBThread sb_thread;
|
|
|
|
ThreadSP thread_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
if (m_opaque_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
thread_sp = m_opaque_sp->GetThreadSP();
|
2012-02-17 15:49:44 +08:00
|
|
|
sb_thread.SetThread(thread_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-01-30 10:53:15 +08:00
|
|
|
if (thread_sp.get() == NULL)
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-01-30 10:53:15 +08:00
|
|
|
return sb_thread;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBFrame
|
|
|
|
SBValue::GetFrame()
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
SBFrame sb_frame;
|
2013-11-02 10:23:02 +08:00
|
|
|
FrameSP frame_sp;
|
2013-05-15 10:16:21 +08:00
|
|
|
if (m_opaque_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
frame_sp = m_opaque_sp->GetFrameSP();
|
2012-02-17 15:49:44 +08:00
|
|
|
sb_frame.SetFrameSP (frame_sp);
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
|
|
|
{
|
2012-01-30 15:41:31 +08:00
|
|
|
if (frame_sp.get() == NULL)
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
else
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), frame_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2012-01-30 15:41:31 +08:00
|
|
|
return sb_frame;
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
lldb::ValueObjectSP
|
2013-05-15 10:16:21 +08:00
|
|
|
SBValue::GetSP (ValueLocker &locker) const
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
if (!m_opaque_sp || !m_opaque_sp->IsValid())
|
|
|
|
return ValueObjectSP();
|
2013-05-15 10:16:21 +08:00
|
|
|
return locker.GetLockedSP(*m_opaque_sp.get());
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::ValueObjectSP
|
|
|
|
SBValue::GetSP () const
|
|
|
|
{
|
|
|
|
ValueLocker locker;
|
|
|
|
return GetSP(locker);
|
2012-10-23 02:18:36 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetSP (ValueImplSP impl_sp)
|
|
|
|
{
|
|
|
|
m_opaque_sp = impl_sp;
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
void
|
|
|
|
SBValue::SetSP (const lldb::ValueObjectSP &sp)
|
2010-06-09 00:52:24 +08:00
|
|
|
{
|
2012-10-23 02:18:36 +08:00
|
|
|
if (sp)
|
|
|
|
{
|
|
|
|
lldb::TargetSP target_sp(sp->GetTargetSP());
|
|
|
|
if (target_sp)
|
|
|
|
{
|
|
|
|
lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
|
|
|
|
bool use_synthetic = target_sp->TargetProperties::GetEnableSyntheticValue();
|
|
|
|
m_opaque_sp = ValueImplSP(new ValueImpl(sp, use_dynamic, use_synthetic));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_opaque_sp = ValueImplSP(new ValueImpl(sp,eNoDynamicValues,true));
|
|
|
|
}
|
|
|
|
else
|
|
|
|
m_opaque_sp = ValueImplSP(new ValueImpl(sp,eNoDynamicValues,false));
|
2010-06-09 00:52:24 +08:00
|
|
|
}
|
2010-09-20 13:20:02 +08:00
|
|
|
|
2012-10-23 02:18:36 +08:00
|
|
|
void
|
|
|
|
SBValue::SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic)
|
|
|
|
{
|
|
|
|
if (sp)
|
|
|
|
{
|
|
|
|
lldb::TargetSP target_sp(sp->GetTargetSP());
|
|
|
|
if (target_sp)
|
|
|
|
{
|
|
|
|
bool use_synthetic = target_sp->TargetProperties::GetEnableSyntheticValue();
|
|
|
|
SetSP (sp, use_dynamic, use_synthetic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetSP (sp, use_dynamic, true);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetSP (sp, use_dynamic, false);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetSP (const lldb::ValueObjectSP &sp, bool use_synthetic)
|
|
|
|
{
|
|
|
|
if (sp)
|
|
|
|
{
|
|
|
|
lldb::TargetSP target_sp(sp->GetTargetSP());
|
|
|
|
if (target_sp)
|
|
|
|
{
|
|
|
|
lldb::DynamicValueType use_dynamic = target_sp->GetPreferDynamicValue();
|
|
|
|
SetSP (sp, use_dynamic, use_synthetic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetSP (sp, eNoDynamicValues, use_synthetic);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
SetSP (sp, eNoDynamicValues, use_synthetic);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic)
|
|
|
|
{
|
|
|
|
m_opaque_sp = ValueImplSP(new ValueImpl(sp,use_dynamic,use_synthetic));
|
|
|
|
}
|
2012-02-04 10:27:34 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
void
|
|
|
|
SBValue::SetSP (const lldb::ValueObjectSP &sp, lldb::DynamicValueType use_dynamic, bool use_synthetic, const char *name)
|
|
|
|
{
|
|
|
|
m_opaque_sp = ValueImplSP(new ValueImpl(sp,use_dynamic,use_synthetic, name));
|
|
|
|
}
|
|
|
|
|
2010-10-31 11:01:06 +08:00
|
|
|
bool
|
|
|
|
SBValue::GetExpressionPath (SBStream &description)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2010-10-31 11:01:06 +08:00
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
value_sp->GetExpressionPath (description.ref(), false);
|
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
|
|
|
return true;
|
|
|
|
}
|
|
|
|
return false;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool
|
|
|
|
SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
value_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)
|
|
|
|
{
|
2011-11-13 14:57:31 +08:00
|
|
|
Stream &strm = description.ref();
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
<rdar://problem/14393032>
DumpValueObject() 2.0
This checkin restores pre-Xcode5 functionality to the "po" (expr -O) command:
- expr now has a new --description-verbosity (-v) argument, which takes either compact or full as a value (-v is the same as -vfull)
When the full mode is on, "po" will show the extended output with type name, persistent variable name and value, as in
(lldb) expr -O -v -- foo
(id) $0 = 0x000000010010baf0 {
1 = 2;
2 = 3;
}
When -v is omitted, or -vcompact is passed, the Xcode5-style output will be shown, as in
(lldb) expr -O -- foo
{
1 = 2;
2 = 3;
}
- for a non-ObjectiveC object, LLDB will still try to retrieve a summary and/or value to display
(lldb) po 5
5
-v also works in this mode
(lldb) expr -O -vfull -- 5
(int) $4 = 5
On top of that, this is a major refactoring of the ValueObject printing code. The functionality is now factored into a ValueObjectPrinter class for easier maintenance in the future
DumpValueObject() was turned into an instance method ValueObject::Dump() which simply calls through to the printer code, Dump_Impl has been removed
Test case to follow
llvm-svn: 191694
2013-10-01 03:11:51 +08:00
|
|
|
value_sp->Dump(strm);
|
2010-09-20 13:20:02 +08:00
|
|
|
else
|
2011-11-13 14:57:31 +08:00
|
|
|
strm.PutCString ("No value");
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2010-09-20 13:20:02 +08:00
|
|
|
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
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
return value_sp->GetFormat();
|
2011-01-06 02:43:15 +08:00
|
|
|
return eFormatDefault;
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
|
|
|
SBValue::SetFormat (lldb::Format format)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
|
|
|
value_sp->SetFormat(format);
|
2011-01-06 02:43:15 +08:00
|
|
|
}
|
|
|
|
|
2011-07-30 03:53:35 +08:00
|
|
|
lldb::SBValue
|
|
|
|
SBValue::AddressOf()
|
|
|
|
{
|
|
|
|
SBValue sb_value;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_sp)
|
2011-07-30 03:53:35 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
Error error;
|
|
|
|
sb_value.SetSP(value_sp->AddressOf (error),GetPreferDynamicValue(), GetPreferSyntheticValue());
|
2011-07-30 03:53:35 +08:00
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2011-07-30 03:53:35 +08:00
|
|
|
if (log)
|
2012-06-05 04:13:23 +08:00
|
|
|
log->Printf ("SBValue(%p)::AddressOf () => SBValue(%p)", value_sp.get(), value_sp.get());
|
2011-07-30 03:53:35 +08:00
|
|
|
|
|
|
|
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;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2012-02-17 15:49:44 +08:00
|
|
|
TargetSP target_sp (value_sp->GetTargetSP());
|
|
|
|
if (target_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
|
|
|
{
|
|
|
|
const bool scalar_is_load_address = true;
|
|
|
|
AddressType addr_type;
|
2012-02-04 10:27:34 +08:00
|
|
|
value = value_sp->GetAddressOf(scalar_is_load_address, &addr_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
|
|
|
if (addr_type == eAddressTypeFile)
|
|
|
|
{
|
2012-02-24 09:59:29 +08:00
|
|
|
ModuleSP module_sp (value_sp->GetModule());
|
|
|
|
if (!module_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
|
|
|
value = LLDB_INVALID_ADDRESS;
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Address addr;
|
2012-02-24 09:59:29 +08:00
|
|
|
module_sp->ResolveFileAddress(value, addr);
|
2012-02-17 15:49:44 +08:00
|
|
|
value = addr.GetLoadAddress(target_sp.get());
|
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 if (addr_type == eAddressTypeHost || addr_type == eAddressTypeInvalid)
|
|
|
|
value = LLDB_INVALID_ADDRESS;
|
|
|
|
}
|
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
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
|
|
|
if (log)
|
2012-11-30 05:49:15 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetLoadAddress () => (%" PRIu64 ")", value_sp.get(), value);
|
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
|
|
|
|
|
|
|
return value;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBAddress
|
|
|
|
SBValue::GetAddress()
|
|
|
|
{
|
|
|
|
Address addr;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2012-02-17 15:49:44 +08:00
|
|
|
TargetSP target_sp (value_sp->GetTargetSP());
|
|
|
|
if (target_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
|
|
|
{
|
|
|
|
lldb::addr_t value = LLDB_INVALID_ADDRESS;
|
|
|
|
const bool scalar_is_load_address = true;
|
|
|
|
AddressType addr_type;
|
2012-02-04 10:27:34 +08:00
|
|
|
value = value_sp->GetAddressOf(scalar_is_load_address, &addr_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
|
|
|
if (addr_type == eAddressTypeFile)
|
|
|
|
{
|
2012-02-24 09:59:29 +08:00
|
|
|
ModuleSP module_sp (value_sp->GetModule());
|
|
|
|
if (module_sp)
|
|
|
|
module_sp->ResolveFileAddress(value, addr);
|
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 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)
|
2012-02-17 15:49:44 +08:00
|
|
|
addr.SetLoadAddress(value, target_sp.get());
|
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
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
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
|
|
|
if (log)
|
2012-11-30 05:49:15 +08:00
|
|
|
log->Printf ("SBValue(%p)::GetAddress () => (%s,%" PRIu64 ")", value_sp.get(),
|
2012-10-17 05:41:58 +08:00
|
|
|
(addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"),
|
|
|
|
addr.GetOffset());
|
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
|
|
|
return SBAddress(new Address(addr));
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBData
|
|
|
|
SBValue::GetPointeeData (uint32_t item_idx,
|
|
|
|
uint32_t item_count)
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
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::SBData sb_data;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
TargetSP target_sp (value_sp->GetTargetSP());
|
|
|
|
if (target_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
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
DataExtractorSP data_sp(new DataExtractor());
|
|
|
|
value_sp->GetPointeeData(*data_sp, item_idx, item_count);
|
|
|
|
if (data_sp->GetByteSize() > 0)
|
|
|
|
*sb_data = data_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
|
|
|
}
|
|
|
|
}
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
|
2012-02-04 10:27:34 +08:00
|
|
|
value_sp.get(),
|
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
|
|
|
item_idx,
|
|
|
|
item_count,
|
|
|
|
sb_data.get());
|
|
|
|
|
|
|
|
return sb_data;
|
|
|
|
}
|
|
|
|
|
|
|
|
lldb::SBData
|
|
|
|
SBValue::GetData ()
|
|
|
|
{
|
2013-03-28 07:08:40 +08:00
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
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::SBData sb_data;
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
if (value_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
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
DataExtractorSP data_sp(new DataExtractor());
|
|
|
|
value_sp->GetData(*data_sp);
|
|
|
|
if (data_sp->GetByteSize() > 0)
|
|
|
|
*sb_data = data_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
|
|
|
}
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
|
2012-02-04 10:27:34 +08:00
|
|
|
value_sp.get(),
|
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
|
|
|
sb_data.get());
|
|
|
|
|
|
|
|
return sb_data;
|
|
|
|
}
|
2011-10-14 02:08:26 +08:00
|
|
|
|
2013-04-13 09:21:23 +08:00
|
|
|
bool
|
|
|
|
SBValue::SetData (lldb::SBData &data, SBError &error)
|
|
|
|
{
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2013-04-13 09:21:23 +08:00
|
|
|
bool ret = true;
|
|
|
|
|
|
|
|
if (value_sp)
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
DataExtractor *data_extractor = data.get();
|
|
|
|
|
|
|
|
if (!data_extractor)
|
2013-04-13 09:21:23 +08:00
|
|
|
{
|
|
|
|
if (log)
|
2013-05-15 10:16:21 +08:00
|
|
|
log->Printf ("SBValue(%p)::SetData() => error: no data to set", value_sp.get());
|
2013-04-13 09:21:23 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
error.SetErrorString("No data to set");
|
2013-04-13 09:21:23 +08:00
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
Error set_error;
|
|
|
|
|
|
|
|
value_sp->SetData(*data_extractor, set_error);
|
2013-04-13 09:21:23 +08:00
|
|
|
|
2013-05-15 10:16:21 +08:00
|
|
|
if (!set_error.Success())
|
2013-04-13 09:21:23 +08:00
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
error.SetErrorStringWithFormat("Couldn't set data: %s", set_error.AsCString());
|
2013-04-13 09:21:23 +08:00
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
error.SetErrorStringWithFormat ("Couldn't set data: could not get SBValue: %s", locker.GetError().AsCString());
|
2013-04-13 09:21:23 +08:00
|
|
|
ret = false;
|
|
|
|
}
|
|
|
|
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::SetData (%p) => %s",
|
|
|
|
value_sp.get(),
|
|
|
|
data.get(),
|
|
|
|
ret ? "true" : "false");
|
|
|
|
return ret;
|
|
|
|
}
|
|
|
|
|
2012-10-11 06:54:17 +08:00
|
|
|
lldb::SBDeclaration
|
|
|
|
SBValue::GetDeclaration ()
|
|
|
|
{
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-10-11 06:54:17 +08:00
|
|
|
SBDeclaration decl_sb;
|
|
|
|
if (value_sp)
|
|
|
|
{
|
|
|
|
Declaration decl;
|
|
|
|
if (value_sp->GetDeclaration(decl))
|
|
|
|
decl_sb.SetDeclaration(decl);
|
|
|
|
}
|
|
|
|
return decl_sb;
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
lldb::SBWatchpoint
|
2012-06-05 07:19:54 +08:00
|
|
|
SBValue::Watch (bool resolve_location, bool read, bool write, SBError &error)
|
2011-10-14 02:08:26 +08:00
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
SBWatchpoint sb_watchpoint;
|
|
|
|
|
|
|
|
// If the SBValue is not valid, there's no point in even trying to watch it.
|
2013-05-15 10:16:21 +08:00
|
|
|
ValueLocker locker;
|
|
|
|
lldb::ValueObjectSP value_sp(GetSP(locker));
|
2012-02-04 10:27:34 +08:00
|
|
|
TargetSP target_sp (GetTarget().GetSP());
|
|
|
|
if (value_sp && target_sp)
|
2011-10-14 02:08:26 +08:00
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
// Read and Write cannot both be false.
|
|
|
|
if (!read && !write)
|
|
|
|
return sb_watchpoint;
|
|
|
|
|
|
|
|
// If the value is not in scope, don't try and watch and invalid value
|
|
|
|
if (!IsInScope())
|
|
|
|
return sb_watchpoint;
|
|
|
|
|
|
|
|
addr_t addr = GetLoadAddress();
|
|
|
|
if (addr == LLDB_INVALID_ADDRESS)
|
|
|
|
return sb_watchpoint;
|
|
|
|
size_t byte_size = GetByteSize();
|
|
|
|
if (byte_size == 0)
|
|
|
|
return sb_watchpoint;
|
2013-08-27 07:57:52 +08:00
|
|
|
|
2012-02-04 10:27:34 +08:00
|
|
|
uint32_t watch_type = 0;
|
|
|
|
if (read)
|
|
|
|
watch_type |= LLDB_WATCH_TYPE_READ;
|
|
|
|
if (write)
|
|
|
|
watch_type |= LLDB_WATCH_TYPE_WRITE;
|
|
|
|
|
2012-06-05 07:19:54 +08:00
|
|
|
Error rc;
|
2013-07-12 06:46:58 +08:00
|
|
|
ClangASTType type (value_sp->GetClangType());
|
2012-10-23 15:20:06 +08:00
|
|
|
WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, &type, watch_type, rc);
|
2012-06-05 07:19:54 +08:00
|
|
|
error.SetError(rc);
|
2013-08-27 07:57:52 +08:00
|
|
|
|
|
|
|
if (watchpoint_sp)
|
2012-02-04 10:27:34 +08:00
|
|
|
{
|
|
|
|
sb_watchpoint.SetSP (watchpoint_sp);
|
|
|
|
Declaration decl;
|
|
|
|
if (value_sp->GetDeclaration (decl))
|
|
|
|
{
|
2013-08-27 07:57:52 +08:00
|
|
|
if (decl.GetFile())
|
2012-02-04 10:27:34 +08:00
|
|
|
{
|
|
|
|
StreamString ss;
|
|
|
|
// True to show fullpath for declaration file.
|
|
|
|
decl.DumpStopContext(&ss, true);
|
|
|
|
watchpoint_sp->SetDeclInfo(ss.GetString());
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2011-10-14 02:08:26 +08:00
|
|
|
}
|
2013-05-15 10:16:21 +08:00
|
|
|
else if (target_sp)
|
|
|
|
{
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::Watch() => error getting SBValue: %s", value_sp.get(), locker.GetError().AsCString());
|
|
|
|
|
|
|
|
error.SetErrorStringWithFormat("could not get SBValue: %s", locker.GetError().AsCString());
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Log *log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
|
|
|
if (log)
|
|
|
|
log->Printf ("SBValue(%p)::Watch() => error getting SBValue: no target", value_sp.get());
|
|
|
|
error.SetErrorString("could not set watchpoint, a target is required");
|
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
return sb_watchpoint;
|
|
|
|
}
|
|
|
|
|
2012-06-05 07:45:50 +08:00
|
|
|
// FIXME: Remove this method impl (as well as the decl in .h) once it is no longer needed.
|
|
|
|
// Backward compatibility fix in the interim.
|
|
|
|
lldb::SBWatchpoint
|
|
|
|
SBValue::Watch (bool resolve_location, bool read, bool write)
|
|
|
|
{
|
2012-06-05 08:14:15 +08:00
|
|
|
SBError error;
|
|
|
|
return Watch(resolve_location, read, write, error);
|
2012-06-05 07:45:50 +08:00
|
|
|
}
|
|
|
|
|
2011-10-14 02:08:26 +08:00
|
|
|
lldb::SBWatchpoint
|
2012-06-05 07:19:54 +08:00
|
|
|
SBValue::WatchPointee (bool resolve_location, bool read, bool write, SBError &error)
|
2011-10-14 02:08:26 +08:00
|
|
|
{
|
2012-02-04 10:27:34 +08:00
|
|
|
SBWatchpoint sb_watchpoint;
|
|
|
|
if (IsInScope() && GetType().IsPointerType())
|
2012-06-05 07:19:54 +08:00
|
|
|
sb_watchpoint = Dereference().Watch (resolve_location, read, write, error);
|
2011-10-14 02:08:26 +08:00
|
|
|
return sb_watchpoint;
|
|
|
|
}
|