summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--lldb/include/lldb/API/SBType.h3
-rw-r--r--lldb/include/lldb/API/SBValue.h26
-rw-r--r--lldb/include/lldb/API/SBWatchpoint.h29
-rw-r--r--lldb/include/lldb/Core/ValueObject.h7
-rw-r--r--lldb/include/lldb/Core/ValueObjectDynamicValue.h6
-rw-r--r--lldb/include/lldb/Core/ValueObjectVariable.h3
-rw-r--r--lldb/include/lldb/Symbol/ClangASTType.h2
-rw-r--r--lldb/scripts/Python/python-extensions.swig134
-rw-r--r--lldb/source/API/SBFrame.cpp37
-rw-r--r--lldb/source/API/SBTarget.cpp23
-rw-r--r--lldb/source/API/SBType.cpp7
-rw-r--r--lldb/source/API/SBValue.cpp793
-rw-r--r--lldb/source/API/SBValueList.cpp15
-rw-r--r--lldb/source/API/SBWatchpoint.cpp114
-rw-r--r--lldb/source/Core/ValueObject.cpp10
-rw-r--r--lldb/source/Core/ValueObjectDynamicValue.cpp8
-rw-r--r--lldb/source/Core/ValueObjectVariable.cpp11
-rw-r--r--lldb/source/Symbol/ClangASTType.cpp5
-rw-r--r--lldb/test/expression_command/test/TestExprs.py2
-rw-r--r--lldb/test/lang/c/array_types/TestArrayTypes.py12
-rw-r--r--lldb/test/lang/cpp/class_types/TestClassTypes.py2
-rw-r--r--lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py6
-rw-r--r--lldb/test/lldbutil.py4
-rw-r--r--lldb/test/python_api/module_section/TestModuleAndSection.py10
-rw-r--r--lldb/test/python_api/sbdata/TestSBData.py7
-rw-r--r--lldb/test/python_api/symbol-context/TestSymbolContext.py2
26 files changed, 701 insertions, 577 deletions
diff --git a/lldb/include/lldb/API/SBType.h b/lldb/include/lldb/API/SBType.h
index b4ee97b2ca4..4517e702b86 100644
--- a/lldb/include/lldb/API/SBType.h
+++ b/lldb/include/lldb/API/SBType.h
@@ -167,6 +167,9 @@ protected:
const lldb_private::TypeImpl &
ref () const;
+ lldb::TypeImplSP
+ GetSP ();
+
void
SetSP (const lldb::TypeImplSP &type_impl_sp);
#endif
diff --git a/lldb/include/lldb/API/SBValue.h b/lldb/include/lldb/API/SBValue.h
index 3abd8a8f97e..6c01a544ffa 100644
--- a/lldb/include/lldb/API/SBValue.h
+++ b/lldb/include/lldb/API/SBValue.h
@@ -355,27 +355,13 @@ protected:
friend class SBValueList;
friend class SBFrame;
-#ifndef SWIG
- // Mimic shared pointer...
- lldb_private::ValueObject *
- get() const;
-
- lldb_private::ValueObject *
- operator->() const;
-
- lldb::ValueObjectSP &
- operator*();
-
- const lldb::ValueObjectSP &
- operator*() const;
-
-#endif
-
+ lldb::ValueObjectSP
+ GetSP () const;
+
+ void
+ SetSP (const lldb::ValueObjectSP &sp);
+
private:
- // Helper function for SBValue::Watch() and SBValue::WatchPointee().
- lldb::SBWatchpoint
- WatchValue(bool read, bool write, bool watch_pointee);
-
lldb::ValueObjectSP m_opaque_sp;
};
diff --git a/lldb/include/lldb/API/SBWatchpoint.h b/lldb/include/lldb/API/SBWatchpoint.h
index 539dc4147fa..d4f8d21a220 100644
--- a/lldb/include/lldb/API/SBWatchpoint.h
+++ b/lldb/include/lldb/API/SBWatchpoint.h
@@ -22,12 +22,12 @@ public:
SBWatchpoint (const lldb::SBWatchpoint &rhs);
+ SBWatchpoint (const lldb::WatchpointSP &wp_sp);
+
~SBWatchpoint ();
-#ifndef SWIG
const lldb::SBWatchpoint &
operator = (const lldb::SBWatchpoint &rhs);
-#endif
bool
IsValid() const;
@@ -72,27 +72,20 @@ public:
bool
GetDescription (lldb::SBStream &description, DescriptionLevel level);
-#ifndef SWIG
- SBWatchpoint (const lldb::WatchpointSP &wp_sp);
-#endif
+ void
+ Clear ();
+
+ lldb::WatchpointSP
+ GetSP () const;
+
+ void
+ SetSP (const lldb::WatchpointSP &sp);
private:
friend class SBTarget;
friend class SBValue;
-#ifndef SWIG
-
- lldb_private::Watchpoint *
- operator->();
-
- lldb_private::Watchpoint *
- get();
-
- lldb::WatchpointSP &
- operator *();
-
-#endif
-
+
lldb::WatchpointSP m_opaque_sp;
};
diff --git a/lldb/include/lldb/Core/ValueObject.h b/lldb/include/lldb/Core/ValueObject.h
index 102cd6349e9..9307cce70d2 100644
--- a/lldb/include/lldb/Core/ValueObject.h
+++ b/lldb/include/lldb/Core/ValueObject.h
@@ -518,6 +518,9 @@ public:
virtual ConstString
GetTypeName() = 0;
+ //------------------------------------------------------------------
+ // Sublasses can implement the functions below.
+ //------------------------------------------------------------------
virtual lldb::LanguageType
GetObjectRuntimeLanguage();
@@ -632,6 +635,10 @@ public:
return m_parent->GetModule();
return NULL;
}
+
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
//------------------------------------------------------------------
// The functions below should NOT be modified by sublasses
//------------------------------------------------------------------
diff --git a/lldb/include/lldb/Core/ValueObjectDynamicValue.h b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
index 00b629ddd09..361599a91fd 100644
--- a/lldb/include/lldb/Core/ValueObjectDynamicValue.h
+++ b/lldb/include/lldb/Core/ValueObjectDynamicValue.h
@@ -22,6 +22,11 @@ namespace lldb_private {
class ValueObjectCast : public ValueObject
{
public:
+ static lldb::ValueObjectSP
+ Create (ValueObject &parent,
+ const ConstString &name,
+ const ClangASTType &cast_type);
+
virtual
~ValueObjectCast();
@@ -83,7 +88,6 @@ namespace lldb_private {
ClangASTType m_cast_type;
private:
- friend class ValueObject;
ValueObjectCast (ValueObject &parent,
const ConstString &name,
const ClangASTType &cast_type);
diff --git a/lldb/include/lldb/Core/ValueObjectVariable.h b/lldb/include/lldb/Core/ValueObjectVariable.h
index 575d37ae1b3..20c9589ceca 100644
--- a/lldb/include/lldb/Core/ValueObjectVariable.h
+++ b/lldb/include/lldb/Core/ValueObjectVariable.h
@@ -58,6 +58,9 @@ public:
virtual SymbolContextScope *
GetSymbolContextScope();
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
protected:
virtual bool
UpdateValue ();
diff --git a/lldb/include/lldb/Symbol/ClangASTType.h b/lldb/include/lldb/Symbol/ClangASTType.h
index 800accc7101..dd6e3657155 100644
--- a/lldb/include/lldb/Symbol/ClangASTType.h
+++ b/lldb/include/lldb/Symbol/ClangASTType.h
@@ -301,7 +301,7 @@ public:
uint32_t& stride);
lldb::clang_type_t
- GetPointerType ();
+ GetPointerType () const;
static lldb::clang_type_t
GetPointerType (clang::ASTContext *ast_context,
diff --git a/lldb/scripts/Python/python-extensions.swig b/lldb/scripts/Python/python-extensions.swig
index 49172b3cd0b..c6c12fc0efc 100644
--- a/lldb/scripts/Python/python-extensions.swig
+++ b/lldb/scripts/Python/python-extensions.swig
@@ -1,6 +1,6 @@
%extend lldb::SBAddress {
- PyObject *lldb::SBAddress::__repr__ (){
+ PyObject *lldb::SBAddress::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -9,11 +9,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBBlock {
- PyObject *lldb::SBBlock::__repr__ (){
+ PyObject *lldb::SBBlock::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -22,11 +23,13 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
+
}
}
%extend lldb::SBBreakpoint {
- PyObject *lldb::SBBreakpoint::__repr__ (){
+ PyObject *lldb::SBBreakpoint::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -35,11 +38,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBBreakpointLocation {
- PyObject *lldb::SBBreakpointLocation::__repr__ (){
+ PyObject *lldb::SBBreakpointLocation::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelFull);
const char *desc = description.GetData();
@@ -48,11 +52,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBCommandReturnObject {
- PyObject *lldb::SBCommandReturnObject::__repr__ (){
+ PyObject *lldb::SBCommandReturnObject::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -61,11 +66,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBCompileUnit {
- PyObject *lldb::SBCompileUnit::__repr__ (){
+ PyObject *lldb::SBCompileUnit::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -74,11 +80,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBData {
- PyObject *lldb::SBData::__repr__ (){
+ PyObject *lldb::SBData::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -87,11 +94,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBDebugger {
- PyObject *lldb::SBDebugger::__repr__ (){
+ PyObject *lldb::SBDebugger::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -100,11 +108,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBError {
- PyObject *lldb::SBError::__repr__ (){
+ PyObject *lldb::SBError::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -113,11 +122,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBFileSpec {
- PyObject *lldb::SBFileSpec::__repr__ (){
+ PyObject *lldb::SBFileSpec::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -126,11 +136,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBFrame {
- PyObject *lldb::SBFrame::__repr__ (){
+ PyObject *lldb::SBFrame::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -139,11 +150,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBFunction {
- PyObject *lldb::SBFunction::__repr__ (){
+ PyObject *lldb::SBFunction::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -152,11 +164,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBInstruction {
- PyObject *lldb::SBInstruction::__repr__ (){
+ PyObject *lldb::SBInstruction::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -165,11 +178,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBInstructionList {
- PyObject *lldb::SBInstructionList::__repr__ (){
+ PyObject *lldb::SBInstructionList::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -178,11 +192,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBLineEntry {
- PyObject *lldb::SBLineEntry::__repr__ (){
+ PyObject *lldb::SBLineEntry::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -191,11 +206,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBModule {
- PyObject *lldb::SBModule::__repr__ (){
+ PyObject *lldb::SBModule::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -204,11 +220,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBProcess {
- PyObject *lldb::SBProcess::__repr__ (){
+ PyObject *lldb::SBProcess::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -217,11 +234,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBSection {
- PyObject *lldb::SBSection::__repr__ (){
+ PyObject *lldb::SBSection::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -230,11 +248,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBSymbol {
- PyObject *lldb::SBSymbol::__repr__ (){
+ PyObject *lldb::SBSymbol::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -243,11 +262,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBSymbolContext {
- PyObject *lldb::SBSymbolContext::__repr__ (){
+ PyObject *lldb::SBSymbolContext::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -256,11 +276,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBTarget {
- PyObject *lldb::SBTarget::__repr__ (){
+ PyObject *lldb::SBTarget::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
@@ -269,11 +290,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBType {
- PyObject *lldb::SBType::__repr__ (){
+ PyObject *lldb::SBType::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
@@ -282,11 +304,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBTypeMember {
- PyObject *lldb::SBTypeMember::__repr__ (){
+ PyObject *lldb::SBTypeMember::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
const char *desc = description.GetData();
@@ -295,11 +318,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBThread {
- PyObject *lldb::SBThread::__repr__ (){
+ PyObject *lldb::SBThread::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -308,11 +332,12 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBValue {
- PyObject *lldb::SBValue::__repr__ (){
+ PyObject *lldb::SBValue::__str__ (){
lldb::SBStream description;
$self->GetDescription (description);
const char *desc = description.GetData();
@@ -321,7 +346,8 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
%extend lldb::SBValueList {
@@ -347,7 +373,7 @@
}
}
%extend lldb::SBWatchpoint {
- PyObject *lldb::SBWatchpoint::__repr__ (){
+ PyObject *lldb::SBWatchpoint::__str__ (){
lldb::SBStream description;
$self->GetDescription (description, lldb::eDescriptionLevelVerbose);
const char *desc = description.GetData();
@@ -356,7 +382,8 @@
--desc_len;
if (desc_len > 0)
return PyString_FromStringAndSize (desc, desc_len);
- return Py_None;
+ else
+ return PyString_FromString("");
}
}
@@ -382,9 +409,6 @@ class value(object):
def __nonzero__(self):
return self.sbvalue.__nonzero__()
- def __repr__(self):
- return self.sbvalue.__repr__()
-
def __str__(self):
return self.sbvalue.__str__()
diff --git a/lldb/source/API/SBFrame.cpp b/lldb/source/API/SBFrame.cpp
index d17e32b1707..ce57c83520d 100644
--- a/lldb/source/API/SBFrame.cpp
+++ b/lldb/source/API/SBFrame.cpp
@@ -483,7 +483,7 @@ SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dyn
StackFrame::eExpressionPathOptionCheckPtrVsMember,
var_sp,
error));
- *sb_value = value_sp;
+ sb_value.SetSP(value_sp);
}
return sb_value;
}
@@ -507,6 +507,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
{
VariableSP var_sp;
SBValue sb_value;
+ ValueObjectSP value_sp;
StackFrameSP frame_sp(GetFrameSP());
if (frame_sp && name && name[0])
{
@@ -530,14 +531,17 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
}
if (var_sp)
- *sb_value = ValueObjectSP (frame_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic));
+ {
+ value_sp = frame_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic);
+ sb_value.SetSP(value_sp);
+ }
}
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
- frame_sp.get(), name, sb_value.get());
+ frame_sp.get(), name, value_sp.get());
return sb_value;
}
@@ -559,6 +563,7 @@ SBValue
SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
{
SBValue sb_value;
+ ValueObjectSP value_sp;
StackFrameSP frame_sp(GetFrameSP());
if (frame_sp && name && name[0])
{
@@ -593,8 +598,8 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
variable_sp->GetScope() == value_type &&
variable_sp->GetName() == const_name)
{
- *sb_value = ValueObjectSP (frame_sp->GetValueObjectForFrameVariable(variable_sp,
- use_dynamic));
+ value_sp = frame_sp->GetValueObjectForFrameVariable (variable_sp, use_dynamic);
+ sb_value.SetSP (value_sp);
break;
}
}
@@ -615,7 +620,9 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
(reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
{
- *sb_value = ValueObjectRegister::Create (frame_sp.get(), reg_ctx, reg_idx);
+ value_sp = ValueObjectRegister::Create (frame_sp.get(), reg_ctx, reg_idx);
+ sb_value.SetSP (value_sp);
+ break;
}
}
}
@@ -635,7 +642,9 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
(reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
{
- *sb_value = ValueObjectRegisterSet::Create (frame_sp.get(), reg_ctx, set_idx);
+ value_sp = ValueObjectRegisterSet::Create (frame_sp.get(), reg_ctx, set_idx);
+ sb_value.SetSP (value_sp);
+ break;
}
}
}
@@ -647,7 +656,10 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
ConstString const_name(name);
ClangExpressionVariableSP expr_var_sp (frame_sp->GetThread().GetProcess().GetTarget().GetPersistentVariables().GetVariable (const_name));
if (expr_var_sp)
- *sb_value = expr_var_sp->GetValueObject();
+ {
+ value_sp = expr_var_sp->GetValueObject();
+ sb_value.SetSP (value_sp);
+ }
}
break;
@@ -659,7 +671,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
- frame_sp.get(), name, value_type, sb_value.get());
+ frame_sp.get(), name, value_type, value_sp.get());
return sb_value;
@@ -885,6 +897,7 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
ExecutionResults exe_results;
SBValue expr_result;
+ ValueObjectSP expr_value_sp;
StackFrameSP frame_sp(GetFrameSP());
if (log)
@@ -912,8 +925,8 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
unwind_on_error,
keep_in_memory,
fetch_dynamic_value,
- *expr_result);
-
+ expr_value_sp);
+ expr_result.SetSP(expr_value_sp);
Host::SetCrashDescription (NULL);
}
@@ -925,7 +938,7 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
if (log)
log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", frame_sp.get(),
expr,
- expr_result.get(),
+ expr_value_sp.get(),
exe_results);
return expr_result;
diff --git a/lldb/source/API/SBTarget.cpp b/lldb/source/API/SBTarget.cpp
index 376ed78d9a7..ed667cc52ea 100644
--- a/lldb/source/API/SBTarget.cpp
+++ b/lldb/source/API/SBTarget.cpp
@@ -947,7 +947,7 @@ SBTarget::GetWatchpointAtIndex (uint32_t idx) const
if (target_sp)
{
// The watchpoint list is thread safe, no need to lock
- *sb_watchpoint = target_sp->GetWatchpointList().GetByIndex(idx);
+ sb_watchpoint.SetSP (target_sp->GetWatchpointList().GetByIndex(idx));
}
return sb_watchpoint;
}
@@ -979,17 +979,19 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBWatchpoint sb_watchpoint;
+ lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
if (target_sp && wp_id != LLDB_INVALID_WATCH_ID)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
- *sb_watchpoint = target_sp->GetWatchpointList().FindByID(wp_id);
+ watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
+ sb_watchpoint.SetSP (watchpoint_sp);
}
if (log)
{
log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
- target_sp.get(), (uint32_t) wp_id, sb_watchpoint.get());
+ target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get());
}
return sb_watchpoint;
@@ -1001,19 +1003,24 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
SBWatchpoint sb_watchpoint;
+ lldb::WatchpointSP watchpoint_sp;
TargetSP target_sp(GetSP());
- if (target_sp)
+ if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS && size > 0)
{
Mutex::Locker api_locker (target_sp->GetAPIMutex());
- uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
- (write ? LLDB_WATCH_TYPE_WRITE : 0);
- sb_watchpoint = target_sp->CreateWatchpoint(addr, size, watch_type);
+ uint32_t watch_type = 0;
+ if (read)
+ watch_type |= LLDB_WATCH_TYPE_READ;
+ if (write)
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+ watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
+ sb_watchpoint.SetSP (watchpoint_sp);
}
if (log)
{
log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)",
- target_sp.get(), addr, (uint32_t) size, sb_watchpoint.get());
+ target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
}
return sb_watchpoint;
diff --git a/lldb/source/API/SBType.cpp b/lldb/source/API/SBType.cpp
index e4343fd2cce..52f173f8300 100644
--- a/lldb/source/API/SBType.cpp
+++ b/lldb/source/API/SBType.cpp
@@ -83,6 +83,13 @@ SBType::operator != (SBType &rhs)
(rhs.m_opaque_sp->GetOpaqueQualType() != m_opaque_sp->GetOpaqueQualType());
}
+lldb::TypeImplSP
+SBType::GetSP ()
+{
+ return m_opaque_sp;
+}
+
+
void
SBType::SetSP (const lldb::TypeImplSP &type_impl_sp)
{
diff --git a/lldb/source/API/SBValue.cpp b/lldb/source/API/SBValue.cpp
index 58a718bdebc..2369d6ba980 100644
--- a/lldb/source/API/SBValue.cpp
+++ b/lldb/source/API/SBValue.cpp
@@ -22,6 +22,7 @@
#include "lldb/Core/ValueObjectConstResult.h"
#include "lldb/Symbol/Block.h"
#include "lldb/Symbol/ObjectFile.h"
+#include "lldb/Symbol/Type.h"
#include "lldb/Symbol/Variable.h"
#include "lldb/Symbol/VariableList.h"
#include "lldb/Target/ExecutionContext.h"
@@ -86,8 +87,9 @@ SBValue::GetError()
{
SBError sb_error;
- if (m_opaque_sp.get())
- sb_error.SetError(m_opaque_sp->GetError());
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ sb_error.SetError(value_sp->GetError());
else
sb_error.SetErrorString("error: invalid value");
@@ -97,8 +99,9 @@ SBValue::GetError()
user_id_t
SBValue::GetID()
{
- if (m_opaque_sp)
- return m_opaque_sp->GetID();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ return value_sp->GetID();
return LLDB_INVALID_UID;
}
@@ -107,16 +110,17 @@ SBValue::GetName()
{
const char *name = NULL;
- if (m_opaque_sp)
- name = m_opaque_sp->GetName().GetCString();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ name = value_sp->GetName().GetCString();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetName () => \"%s\"", m_opaque_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetName () => \"%s\"", value_sp.get(), name);
else
- log->Printf ("SBValue(%p)::GetName () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetName () => NULL", value_sp.get());
}
return name;
@@ -126,15 +130,16 @@ const char *
SBValue::GetTypeName ()
{
const char *name = NULL;
- if (m_opaque_sp)
- name = m_opaque_sp->GetTypeName().GetCString();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ name = value_sp->GetTypeName().GetCString();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (name)
- log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", m_opaque_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetTypeName () => \"%s\"", value_sp.get(), name);
else
- log->Printf ("SBValue(%p)::GetTypeName () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetTypeName () => NULL", value_sp.get());
}
return name;
@@ -145,12 +150,13 @@ SBValue::GetByteSize ()
{
size_t result = 0;
- if (m_opaque_sp)
- result = m_opaque_sp->GetByteSize();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ result = value_sp->GetByteSize();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetByteSize () => %zu", m_opaque_sp.get(), result);
+ log->Printf ("SBValue(%p)::GetByteSize () => %zu", value_sp.get(), result);
return result;
}
@@ -160,18 +166,20 @@ SBValue::IsInScope ()
{
bool result = false;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- result = m_opaque_sp->IsInScope ();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ result = value_sp->IsInScope ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::IsInScope () => %i", m_opaque_sp.get(), result);
+ log->Printf ("SBValue(%p)::IsInScope () => %i", value_sp.get(), result);
return result;
}
@@ -180,21 +188,23 @@ const char *
SBValue::GetValue ()
{
const char *cstr = NULL;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- cstr = m_opaque_sp->GetValueAsCString ();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ cstr = value_sp->GetValueAsCString ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetValue => \"%s\"", m_opaque_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetValue => \"%s\"", value_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetValue => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetValue => NULL", value_sp.get());
}
return cstr;
@@ -204,22 +214,23 @@ ValueType
SBValue::GetValueType ()
{
ValueType result = eValueTypeInvalid;
- if (m_opaque_sp)
- result = m_opaque_sp->GetValueType();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ result = value_sp->GetValueType();
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
switch (result)
{
- case eValueTypeInvalid: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeInvalid", m_opaque_sp.get()); break;
- case eValueTypeVariableGlobal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableGlobal", m_opaque_sp.get()); break;
- case eValueTypeVariableStatic: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableStatic", m_opaque_sp.get()); break;
- case eValueTypeVariableArgument:log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableArgument", m_opaque_sp.get()); break;
- case eValueTypeVariableLocal: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeVariableLocal", m_opaque_sp.get()); break;
- case eValueTypeRegister: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegister", m_opaque_sp.get()); break;
- case eValueTypeRegisterSet: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeRegisterSet", m_opaque_sp.get()); break;
- case eValueTypeConstResult: log->Printf ("SBValue(%p)::GetValueType () => eValueTypeConstResult", m_opaque_sp.get()); break;
- default: log->Printf ("SBValue(%p)::GetValueType () => %i ???", m_opaque_sp.get(), result); break;
+ 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;
+ default: log->Printf ("SBValue(%p)::GetValueType () => %i ???", value_sp.get(), result); break;
}
}
return result;
@@ -229,21 +240,23 @@ const char *
SBValue::GetObjectDescription ()
{
const char *cstr = NULL;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- cstr = m_opaque_sp->GetObjectDescription ();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ cstr = value_sp->GetObjectDescription ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", m_opaque_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetObjectDescription => \"%s\"", value_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetObjectDescription => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetObjectDescription => NULL", value_sp.get());
}
return cstr;
}
@@ -251,41 +264,42 @@ SBValue::GetObjectDescription ()
SBType
SBValue::GetType()
{
- SBType result;
- if (m_opaque_sp)
+ SBType sb_type;
+ lldb::ValueObjectSP value_sp(GetSP());
+ TypeImplSP type_sp;
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
- {
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- result = SBType(ClangASTType (m_opaque_sp->GetClangAST(), m_opaque_sp->GetClangType()));
- }
+ type_sp.reset (new TypeImpl(ClangASTType (value_sp->GetClangAST(), value_sp->GetClangType())));
+ sb_type.SetSP(type_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (result.IsValid())
- log->Printf ("SBValue(%p)::GetType => %p", m_opaque_sp.get(), &result);
+ if (type_sp)
+ log->Printf ("SBValue(%p)::GetType => SBType(%p)", value_sp.get(), type_sp.get());
else
- log->Printf ("SBValue(%p)::GetType => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetType => NULL", value_sp.get());
}
- return result;
+ return sb_type;
}
bool
SBValue::GetValueDidChange ()
{
bool result = false;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- result = m_opaque_sp->GetValueDidChange ();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ result = value_sp->GetValueDidChange ();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetValueDidChange => %i", m_opaque_sp.get(), result);
+ log->Printf ("SBValue(%p)::GetValueDidChange => %i", value_sp.get(), result);
return result;
}
@@ -294,21 +308,23 @@ const char *
SBValue::GetSummary ()
{
const char *cstr = NULL;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- cstr = m_opaque_sp->GetSummaryAsCString();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ cstr = value_sp->GetSummaryAsCString();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary => \"%s\"", value_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetSummary => NULL", value_sp.get());
}
return cstr;
}
@@ -317,21 +333,23 @@ const char *
SBValue::GetLocation ()
{
const char *cstr = NULL;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- cstr = m_opaque_sp->GetLocationAsCString();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ cstr = value_sp->GetLocationAsCString();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (cstr)
- log->Printf ("SBValue(%p)::GetSummary => \"%s\"", m_opaque_sp.get(), cstr);
+ log->Printf ("SBValue(%p)::GetSummary => \"%s\"", value_sp.get(), cstr);
else
- log->Printf ("SBValue(%p)::GetSummary => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetSummary => NULL", value_sp.get());
}
return cstr;
}
@@ -340,12 +358,14 @@ bool
SBValue::SetValueFromCString (const char *value_str)
{
bool success = false;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- success = m_opaque_sp->SetValueFromCString (value_str);
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ success = value_sp->SetValueFromCString (value_str);
}
}
return success;
@@ -354,136 +374,147 @@ SBValue::SetValueFromCString (const char *value_str)
lldb::SBValue
SBValue::CreateChildAtOffset (const char *name, uint32_t offset, SBType type)
{
- lldb::SBValue result;
- if (m_opaque_sp)
+ lldb::SBValue sb_value;
+ lldb::ValueObjectSP value_sp(GetSP());
+ lldb::ValueObjectSP new_value_sp;
+ if (value_sp)
{
+ TypeImplSP type_sp (type.GetSP());
if (type.IsValid())
{
- result = SBValue(m_opaque_sp->GetSyntheticChildAtOffset(offset, type.m_opaque_sp->GetClangASTType(), true));
- result.m_opaque_sp->SetName(ConstString(name));
+ sb_value = SBValue(value_sp->GetSyntheticChildAtOffset(offset, type_sp->GetClangASTType(), true));
+ new_value_sp = sb_value.GetSP();
+ if (new_value_sp)
+ new_value_sp->SetName(ConstString(name));
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (result.IsValid())
- log->Printf ("SBValue(%p)::GetChildAtOffset => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
+ if (new_value_sp)
+ log->Printf ("SBValue(%p)::GetChildAtOffset => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::GetChildAtOffset => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetChildAtOffset => NULL", value_sp.get());
}
- return result;
+ return sb_value;
}
lldb::SBValue
SBValue::Cast (SBType type)
{
lldb::SBValue sb_value;
- if (m_opaque_sp && type.IsValid())
- *sb_value = m_opaque_sp->Cast(type.ref().GetClangASTType());
+ lldb::ValueObjectSP value_sp(GetSP());
+ TypeImplSP type_sp (type.GetSP());
+ if (value_sp && type_sp)
+ sb_value.SetSP(value_sp->Cast(type_sp->GetClangASTType()));
return sb_value;
}
lldb::SBValue
SBValue::CreateValueFromExpression (const char *name, const char* expression)
{
- lldb::SBValue result;
- if (m_opaque_sp)
+ lldb::SBValue sb_value;
+ lldb::ValueObjectSP value_sp(GetSP());
+ lldb::ValueObjectSP new_value_sp;
+ if (value_sp)
{
- ValueObjectSP result_valobj_sp;
- m_opaque_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression (expression,
- m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame(),
- eExecutionPolicyOnlyWhenNeeded,
- false, // coerce to id
- true, // unwind on error
- true, // keep in memory
- eNoDynamicValues,
- result_valobj_sp);
- if (result_valobj_sp)
+ value_sp->GetUpdatePoint().GetTargetSP()->EvaluateExpression (expression,
+ value_sp->GetExecutionContextScope()->CalculateStackFrame(),
+ eExecutionPolicyOnlyWhenNeeded,
+ false, // coerce to id
+ true, // unwind on error
+ true, // keep in memory
+ eNoDynamicValues,
+ new_value_sp);
+ if (new_value_sp)
{
- result_valobj_sp->SetName(ConstString(name));
- result = SBValue(result_valobj_sp);
+ new_value_sp->SetName(ConstString(name));
+ sb_value.SetSP(new_value_sp);
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (result.IsValid())
- log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
+ if (new_value_sp)
+ log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", value_sp.get());
}
- return result;
+ return sb_value;
}
lldb::SBValue
-SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType type)
+SBValue::CreateValueFromAddress(const char* name, lldb::addr_t address, SBType sb_type)
{
- lldb::SBValue result;
- if (m_opaque_sp && type.IsValid() && type.GetPointerType().IsValid())
+ lldb::SBValue sb_value;
+ lldb::ValueObjectSP value_sp(GetSP());
+ lldb::ValueObjectSP new_value_sp;
+ lldb::TypeImplSP type_impl_sp (sb_type.GetSP());
+ if (value_sp && type_impl_sp)
{
- SBType real_type(type.GetPointerType());
-
- lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
+ ClangASTType pointee_ast_type(type_impl_sp->GetASTContext(), type_impl_sp->GetClangASTType().GetPointerType ());
+ lldb::TypeImplSP pointee_type_impl_sp (new TypeImpl(pointee_ast_type));
+ if (pointee_type_impl_sp)
+ {
- ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (m_opaque_sp->GetExecutionContextScope(),
- real_type.m_opaque_sp->GetASTContext(),
- real_type.m_opaque_sp->GetOpaqueQualType(),
- ConstString(name),
- buffer,
- lldb::endian::InlHostByteOrder(),
- GetTarget().GetProcess().GetAddressByteSize()));
+ lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
- ValueObjectSP result_valobj_sp;
+ ValueObjectSP ptr_result_valobj_sp(ValueObjectConstResult::Create (value_sp->GetExecutionContextScope(),
+ pointee_type_impl_sp->GetASTContext(),
+ pointee_type_impl_sp->GetOpaqueQualType(),
+ ConstString(name),
+ buffer,
+ lldb::endian::InlHostByteOrder(),
+ GetTarget().GetProcess().GetAddressByteSize()));
- ptr_result_valobj_sp->GetValue().SetValueType(Value::eValueTypeLoadAddress);
- if (ptr_result_valobj_sp)
- {
- Error err;
- result_valobj_sp = ptr_result_valobj_sp->Dereference(err);
- if (result_valobj_sp)
- result_valobj_sp->SetName(ConstString(name));
+ 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);
}
- result = SBValue(result_valobj_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (result.IsValid())
- log->Printf ("SBValue(%p)::GetChildFromAddress => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
+ if (new_value_sp)
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::GetChildFromAddress => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::CreateValueFromAddress => NULL", value_sp.get());
}
- return result;
+ return sb_value;
}
lldb::SBValue
SBValue::CreateValueFromData (const char* name, SBData data, SBType type)
{
- SBValue result;
-
- AddressType addr_of_children_priv = eAddressTypeLoad;
-
- if (m_opaque_sp)
+ lldb::SBValue sb_value;
+ lldb::ValueObjectSP new_value_sp;
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- ValueObjectSP valobj_sp;
- valobj_sp = ValueObjectConstResult::Create (m_opaque_sp->GetExecutionContextScope(),
- type.m_opaque_sp->GetASTContext() ,
- type.m_opaque_sp->GetOpaqueQualType(),
- ConstString(name),
- *data.m_opaque_sp,
- LLDB_INVALID_ADDRESS);
- valobj_sp->SetAddressTypeOfChildren(addr_of_children_priv);
- result = SBValue(valobj_sp);
+ new_value_sp = ValueObjectConstResult::Create (value_sp->GetExecutionContextScope(),
+ type.m_opaque_sp->GetASTContext() ,
+ type.m_opaque_sp->GetOpaqueQualType(),
+ ConstString(name),
+ *data.m_opaque_sp,
+ LLDB_INVALID_ADDRESS);
+ new_value_sp->SetAddressTypeOfChildren(eAddressTypeLoad);
+ sb_value.SetSP(new_value_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
- if (result.IsValid())
- log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", m_opaque_sp.get(), result.m_opaque_sp->GetName().AsCString());
+ if (new_value_sp)
+ log->Printf ("SBValue(%p)::GetChildFromExpression => \"%s\"", value_sp.get(), new_value_sp->GetName().AsCString());
else
- log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetChildFromExpression => NULL", value_sp.get());
}
- return result;
+ return sb_value;
}
SBValue
@@ -491,8 +522,9 @@ SBValue::GetChildAtIndex (uint32_t idx)
{
const bool can_create_synthetic = false;
lldb::DynamicValueType use_dynamic = eNoDynamicValues;
- if (m_opaque_sp)
- use_dynamic = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ use_dynamic = value_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue();
return GetChildAtIndex (idx, use_dynamic, can_create_synthetic);
}
@@ -501,22 +533,24 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
{
lldb::ValueObjectSP child_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
const bool can_create = true;
- child_sp = m_opaque_sp->GetChildAtIndex (idx, can_create);
+ child_sp = value_sp->GetChildAtIndex (idx, can_create);
if (can_create_synthetic && !child_sp)
{
- if (m_opaque_sp->IsPointerType())
+ if (value_sp->IsPointerType())
{
- child_sp = m_opaque_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
+ child_sp = value_sp->GetSyntheticArrayMemberFromPointer(idx, can_create);
}
- else if (m_opaque_sp->IsArrayType())
+ else if (value_sp->IsArrayType())
{
- child_sp = m_opaque_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
+ child_sp = value_sp->GetSyntheticArrayMemberFromArray(idx, can_create);
}
}
@@ -535,7 +569,7 @@ SBValue::GetChildAtIndex (uint32_t idx, lldb::DynamicValueType use_dynamic, bool
SBValue sb_value (child_sp);
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", m_opaque_sp.get(), idx, sb_value.get());
+ log->Printf ("SBValue(%p)::GetChildAtIndex (%u) => SBValue(%p)", value_sp.get(), idx, value_sp.get());
return sb_value;
}
@@ -544,22 +578,24 @@ uint32_t
SBValue::GetIndexOfChildWithName (const char *name)
{
uint32_t idx = UINT32_MAX;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- idx = m_opaque_sp->GetIndexOfChildWithName (ConstString(name));
+ idx = value_sp->GetIndexOfChildWithName (ConstString(name));
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (idx == UINT32_MAX)
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", m_opaque_sp.get(), name);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => NOT FOUND", value_sp.get(), name);
else
- log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", m_opaque_sp.get(), name, idx);
+ log->Printf ("SBValue(%p)::GetIndexOfChildWithName (name=\"%s\") => %u", value_sp.get(), name, idx);
}
return idx;
}
@@ -567,13 +603,19 @@ SBValue::GetIndexOfChildWithName (const char *name)
SBValue
SBValue::GetChildMemberWithName (const char *name)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- lldb::DynamicValueType use_dynamic_value = m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetPreferDynamicValue();
+ lldb::DynamicValueType use_dynamic_value = eNoDynamicValues;
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
+ {
+ Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ use_dynamic_value = target_sp->GetPreferDynamicValue();
+ }
return GetChildMemberWithName (name, use_dynamic_value);
}
- else
- return GetChildMemberWithName (name, eNoDynamicValues);
+ return SBValue();
}
SBValue
@@ -583,12 +625,14 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
const ConstString str_name (name);
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- child_sp = m_opaque_sp->GetChildMemberWithName (str_name, true);
+ Mutex::Locker api_locker (target_sp->GetAPIMutex());
+ child_sp = value_sp->GetChildMemberWithName (str_name, true);
if (use_dynamic_value != lldb::eNoDynamicValues)
{
if (child_sp)
@@ -605,7 +649,7 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", m_opaque_sp.get(), name, sb_value.get());
+ log->Printf ("SBValue(%p)::GetChildMemberWithName (name=\"%s\") => SBValue(%p)", value_sp.get(), name, value_sp.get());
return sb_value;
}
@@ -613,12 +657,14 @@ SBValue::GetChildMemberWithName (const char *name, lldb::DynamicValueType use_dy
lldb::SBValue
SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- return SBValue (m_opaque_sp->GetDynamicValue(use_dynamic));
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue (value_sp->GetDynamicValue(use_dynamic));
}
}
@@ -628,12 +674,14 @@ SBValue::GetDynamicValue (lldb::DynamicValueType use_dynamic)
lldb::SBValue
SBValue::GetStaticValue ()
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- return SBValue(m_opaque_sp->GetStaticValue());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return SBValue(value_sp->GetStaticValue());
}
}
@@ -643,12 +691,14 @@ SBValue::GetStaticValue ()
bool
SBValue::IsDynamic()
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- return m_opaque_sp->IsDynamic();
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ return value_sp->IsDynamic();
}
}
return false;
@@ -658,13 +708,15 @@ lldb::SBValue
SBValue::GetValueForExpressionPath(const char* expr_path)
{
lldb::ValueObjectSP child_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
// using default values for all the fancy options, just do it if you can
- child_sp = m_opaque_sp->GetValueForExpressionPath(expr_path);
+ child_sp = value_sp->GetValueForExpressionPath(expr_path);
}
}
@@ -672,7 +724,7 @@ SBValue::GetValueForExpressionPath(const char* expr_path)
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", m_opaque_sp.get(), expr_path, sb_value.get());
+ log->Printf ("SBValue(%p)::GetValueForExpressionPath (expr_path=\"%s\") => SBValue(%p)", value_sp.get(), expr_path, value_sp.get());
return sb_value;
}
@@ -681,13 +733,15 @@ int64_t
SBValue::GetValueAsSigned(SBError& error, int64_t fail_value)
{
error.Clear();
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
- if (m_opaque_sp->ResolveValue (scalar))
+ if (value_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
else
error.SetErrorString("could not get value");
@@ -703,13 +757,15 @@ uint64_t
SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
{
error.Clear();
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
- if (m_opaque_sp->ResolveValue (scalar))
+ if (value_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
else
error.SetErrorString("could not get value");
@@ -724,13 +780,15 @@ SBValue::GetValueAsUnsigned(SBError& error, uint64_t fail_value)
int64_t
SBValue::GetValueAsSigned(int64_t fail_value)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
- if (m_opaque_sp->ResolveValue (scalar))
+ if (value_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
}
}
@@ -740,13 +798,15 @@ SBValue::GetValueAsSigned(int64_t fail_value)
uint64_t
SBValue::GetValueAsUnsigned(uint64_t fail_value)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Scalar scalar;
- if (m_opaque_sp->ResolveValue (scalar))
+ if (value_sp->ResolveValue (scalar))
return scalar.GetRawBits64(fail_value);
}
}
@@ -758,19 +818,21 @@ SBValue::GetNumChildren ()
{
uint32_t num_children = 0;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- num_children = m_opaque_sp->GetNumChildren();
+ num_children = value_sp->GetNumChildren();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetNumChildren () => %u", m_opaque_sp.get(), num_children);
+ log->Printf ("SBValue(%p)::GetNumChildren () => %u", value_sp.get(), num_children);
return num_children;
}
@@ -780,19 +842,21 @@ SBValue
SBValue::Dereference ()
{
SBValue sb_value;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
Error error;
- sb_value = m_opaque_sp->Dereference (error);
+ sb_value = value_sp->Dereference (error);
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", m_opaque_sp.get(), sb_value.get());
+ log->Printf ("SBValue(%p)::Dereference () => SBValue(%p)", value_sp.get(), value_sp.get());
return sb_value;
}
@@ -802,19 +866,21 @@ SBValue::TypeIsPointerType ()
{
bool is_ptr_type = false;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- is_ptr_type = m_opaque_sp->IsPointerType();
+ is_ptr_type = value_sp->IsPointerType();
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", m_opaque_sp.get(), is_ptr_type);
+ log->Printf ("SBValue(%p)::TypeIsPointerType () => %i", value_sp.get(), is_ptr_type);
return is_ptr_type;
@@ -823,13 +889,15 @@ SBValue::TypeIsPointerType ()
void *
SBValue::GetOpaqueType()
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetUpdatePoint().GetTargetSP())
+ TargetSP target_sp(value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
+ Mutex::Locker api_locker (value_sp->GetUpdatePoint().GetTargetSP()->GetAPIMutex());
- return m_opaque_sp->GetClangType();
+ return value_sp->GetClangType();
}
}
return NULL;
@@ -840,18 +908,19 @@ SBValue::GetTarget()
{
SBTarget sb_target;
TargetSP target_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- target_sp = m_opaque_sp->GetUpdatePoint().GetTargetSP();
+ target_sp = value_sp->GetUpdatePoint().GetTargetSP();
sb_target.SetSP (target_sp);
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
{
if (target_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetTarget () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => NULL", value_sp.get());
else
- log->Printf ("SBValue(%p)::GetTarget () => %p", m_opaque_sp.get(), target_sp.get());
+ log->Printf ("SBValue(%p)::GetTarget () => %p", value_sp.get(), target_sp.get());
}
return sb_target;
}
@@ -861,9 +930,10 @@ SBValue::GetProcess()
{
SBProcess sb_process;
ProcessSP process_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- process_sp = m_opaque_sp->GetUpdatePoint().GetProcessSP();
+ process_sp = value_sp->GetUpdatePoint().GetProcessSP();
if (process_sp)
sb_process.SetSP (process_sp);
}
@@ -871,9 +941,9 @@ SBValue::GetProcess()
if (log)
{
if (process_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetProcess () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => NULL", value_sp.get());
else
- log->Printf ("SBValue(%p)::GetProcess () => %p", m_opaque_sp.get(), process_sp.get());
+ log->Printf ("SBValue(%p)::GetProcess () => %p", value_sp.get(), process_sp.get());
}
return sb_process;
}
@@ -883,11 +953,12 @@ SBValue::GetThread()
{
SBThread sb_thread;
ThreadSP thread_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetExecutionContextScope())
+ if (value_sp->GetExecutionContextScope())
{
- thread_sp = m_opaque_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this();
+ thread_sp = value_sp->GetExecutionContextScope()->CalculateThread()->shared_from_this();
sb_thread.SetThread(thread_sp);
}
}
@@ -895,9 +966,9 @@ SBValue::GetThread()
if (log)
{
if (thread_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetThread () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => NULL", value_sp.get());
else
- log->Printf ("SBValue(%p)::GetThread () => %p", m_opaque_sp.get(), thread_sp.get());
+ log->Printf ("SBValue(%p)::GetThread () => %p", value_sp.get(), thread_sp.get());
}
return sb_thread;
}
@@ -907,11 +978,12 @@ SBValue::GetFrame()
{
SBFrame sb_frame;
StackFrameSP frame_sp;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- if (m_opaque_sp->GetExecutionContextScope())
+ if (value_sp->GetExecutionContextScope())
{
- frame_sp = m_opaque_sp->GetExecutionContextScope()->CalculateStackFrame()->shared_from_this();
+ frame_sp = value_sp->GetExecutionContextScope()->CalculateStackFrame()->shared_from_this();
sb_frame.SetFrameSP (frame_sp);
}
}
@@ -919,45 +991,34 @@ SBValue::GetFrame()
if (log)
{
if (frame_sp.get() == NULL)
- log->Printf ("SBValue(%p)::GetFrame () => NULL", m_opaque_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => NULL", value_sp.get());
else
- log->Printf ("SBValue(%p)::GetFrame () => %p", m_opaque_sp.get(), frame_sp.get());
+ log->Printf ("SBValue(%p)::GetFrame () => %p", value_sp.get(), frame_sp.get());
}
return sb_frame;
}
-// Mimic shared pointer...
-lldb_private::ValueObject *
-SBValue::get() const
-{
- return m_opaque_sp.get();
-}
-
-lldb_private::ValueObject *
-SBValue::operator->() const
-{
- return m_opaque_sp.get();
-}
-
-lldb::ValueObjectSP &
-SBValue::operator*()
+lldb::ValueObjectSP
+SBValue::GetSP () const
{
return m_opaque_sp;
}
-const lldb::ValueObjectSP &
-SBValue::operator*() const
+void
+SBValue::SetSP (const lldb::ValueObjectSP &sp)
{
- return m_opaque_sp;
+ m_opaque_sp = sp;
}
+
bool
SBValue::GetExpressionPath (SBStream &description)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- m_opaque_sp->GetExpressionPath (description.ref(), false);
+ value_sp->GetExpressionPath (description.ref(), false);
return true;
}
return false;
@@ -966,9 +1027,10 @@ SBValue::GetExpressionPath (SBStream &description)
bool
SBValue::GetExpressionPath (SBStream &description, bool qualify_cxx_base_classes)
{
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- m_opaque_sp->GetExpressionPath (description.ref(), qualify_cxx_base_classes);
+ value_sp->GetExpressionPath (description.ref(), qualify_cxx_base_classes);
return true;
}
return false;
@@ -979,9 +1041,10 @@ SBValue::GetDescription (SBStream &description)
{
Stream &strm = description.ref();
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- ValueObject::DumpValueObject (strm, m_opaque_sp.get());
+ ValueObject::DumpValueObject (strm, value_sp.get());
}
else
strm.PutCString ("No value");
@@ -992,35 +1055,38 @@ SBValue::GetDescription (SBStream &description)
lldb::Format
SBValue::GetFormat ()
{
- if (m_opaque_sp)
- return m_opaque_sp->GetFormat();
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ return value_sp->GetFormat();
return eFormatDefault;
}
void
SBValue::SetFormat (lldb::Format format)
{
- if (m_opaque_sp)
- m_opaque_sp->SetFormat(format);
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
+ value_sp->SetFormat(format);
}
lldb::SBValue
SBValue::AddressOf()
{
SBValue sb_value;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
+ Target* target = value_sp->GetUpdatePoint().GetTargetSP().get();
if (target)
{
Mutex::Locker api_locker (target->GetAPIMutex());
Error error;
- sb_value = m_opaque_sp->AddressOf (error);
+ sb_value = value_sp->AddressOf (error);
}
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetPointerToObject () => SBValue(%p)", m_opaque_sp.get(), sb_value.get());
+ log->Printf ("SBValue(%p)::GetPointerToObject () => SBValue(%p)", value_sp.get(), value_sp.get());
return sb_value;
}
@@ -1029,25 +1095,26 @@ lldb::addr_t
SBValue::GetLoadAddress()
{
lldb::addr_t value = LLDB_INVALID_ADDRESS;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
+ Target* target = value_sp->GetUpdatePoint().GetTargetSP().get();
if (target)
{
Mutex::Locker api_locker (target->GetAPIMutex());
const bool scalar_is_load_address = true;
AddressType addr_type;
- value = m_opaque_sp->GetAddressOf(scalar_is_load_address, &addr_type);
+ value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
if (addr_type == eAddressTypeFile)
{
- Module* module = m_opaque_sp->GetModule();
+ Module* module = value_sp->GetModule();
if (!module)
value = LLDB_INVALID_ADDRESS;
else
{
Address addr;
module->ResolveFileAddress(value, addr);
- value = addr.GetLoadAddress(m_opaque_sp->GetUpdatePoint().GetTargetSP().get());
+ value = addr.GetLoadAddress(value_sp->GetUpdatePoint().GetTargetSP().get());
}
}
else if (addr_type == eAddressTypeHost || addr_type == eAddressTypeInvalid)
@@ -1056,7 +1123,7 @@ SBValue::GetLoadAddress()
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetLoadAddress () => (%llu)", m_opaque_sp.get(), value);
+ log->Printf ("SBValue(%p)::GetLoadAddress () => (%llu)", value_sp.get(), value);
return value;
}
@@ -1065,19 +1132,20 @@ lldb::SBAddress
SBValue::GetAddress()
{
Address addr;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
+ Target* target = value_sp->GetUpdatePoint().GetTargetSP().get();
if (target)
{
lldb::addr_t value = LLDB_INVALID_ADDRESS;
Mutex::Locker api_locker (target->GetAPIMutex());
const bool scalar_is_load_address = true;
AddressType addr_type;
- value = m_opaque_sp->GetAddressOf(scalar_is_load_address, &addr_type);
+ value = value_sp->GetAddressOf(scalar_is_load_address, &addr_type);
if (addr_type == eAddressTypeFile)
{
- Module* module = m_opaque_sp->GetModule();
+ Module* module = value_sp->GetModule();
if (module)
module->ResolveFileAddress(value, addr);
}
@@ -1092,7 +1160,7 @@ SBValue::GetAddress()
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", m_opaque_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset());
+ log->Printf ("SBValue(%p)::GetAddress () => (%s,%llu)", value_sp.get(), (addr.GetSection() ? addr.GetSection()->GetName().GetCString() : "NULL"), addr.GetOffset());
return SBAddress(new Address(addr));
}
@@ -1101,14 +1169,15 @@ SBValue::GetPointeeData (uint32_t item_idx,
uint32_t item_count)
{
lldb::SBData sb_data;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
+ Target* target = value_sp->GetUpdatePoint().GetTargetSP().get();
if (target)
{
DataExtractorSP data_sp(new DataExtractor());
Mutex::Locker api_locker (target->GetAPIMutex());
- m_opaque_sp->GetPointeeData(*data_sp, item_idx, item_count);
+ value_sp->GetPointeeData(*data_sp, item_idx, item_count);
if (data_sp->GetByteSize() > 0)
*sb_data = data_sp;
}
@@ -1116,7 +1185,7 @@ SBValue::GetPointeeData (uint32_t item_idx,
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetPointeeData (%d, %d) => SBData(%p)",
- m_opaque_sp.get(),
+ value_sp.get(),
item_idx,
item_count,
sb_data.get());
@@ -1128,14 +1197,15 @@ lldb::SBData
SBValue::GetData ()
{
lldb::SBData sb_data;
- if (m_opaque_sp)
+ lldb::ValueObjectSP value_sp(GetSP());
+ if (value_sp)
{
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
- if (target)
+ TargetSP target_sp (value_sp->GetUpdatePoint().GetTargetSP());
+ if (target_sp)
{
+ Mutex::Locker api_locker (target_sp->GetAPIMutex());
DataExtractorSP data_sp(new DataExtractor());
- Mutex::Locker api_locker (target->GetAPIMutex());
- m_opaque_sp->GetData(*data_sp);
+ value_sp->GetData(*data_sp);
if (data_sp->GetByteSize() > 0)
*sb_data = data_sp;
}
@@ -1143,7 +1213,7 @@ SBValue::GetData ()
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
log->Printf ("SBValue(%p)::GetData () => SBData(%p)",
- m_opaque_sp.get(),
+ value_sp.get(),
sb_data.get());
return sb_data;
@@ -1152,98 +1222,61 @@ SBValue::GetData ()
lldb::SBWatchpoint
SBValue::Watch (bool resolve_location, bool read, bool write)
{
- lldb::SBWatchpoint sb_watchpoint;
- if (!m_opaque_sp)
- return sb_watchpoint;
-
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
- if (target)
+ SBWatchpoint sb_watchpoint;
+
+ // If the SBValue is not valid, there's no point in even trying to watch it.
+ lldb::ValueObjectSP value_sp(GetSP());
+ TargetSP target_sp (GetTarget().GetSP());
+ if (value_sp && target_sp)
{
- Mutex::Locker api_locker (target->GetAPIMutex());
- sb_watchpoint = WatchValue(read, write, false);
+ // 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;
+
+ uint32_t watch_type = 0;
+ if (read)
+ watch_type |= LLDB_WATCH_TYPE_READ;
+ if (write)
+ watch_type |= LLDB_WATCH_TYPE_WRITE;
+
+ WatchpointSP watchpoint_sp = target_sp->CreateWatchpoint(addr, byte_size, watch_type);
+
+ if (watchpoint_sp)
+ {
+ sb_watchpoint.SetSP (watchpoint_sp);
+ Declaration decl;
+ if (value_sp->GetDeclaration (decl))
+ {
+ if (decl.GetFile())
+ {
+ StreamString ss;
+ // True to show fullpath for declaration file.
+ decl.DumpStopContext(&ss, true);
+ watchpoint_sp->SetDeclInfo(ss.GetString());
+ }
+ }
+ }
}
- LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- if (log)
- log->Printf ("SBValue(%p)::Watch (resolve_location=%i, read=%i, write=%i) => wp(%p)",
- m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get());
return sb_watchpoint;
}
lldb::SBWatchpoint
SBValue::WatchPointee (bool resolve_location, bool read, bool write)
{
- lldb::SBWatchpoint sb_watchpoint;
- if (!m_opaque_sp)
- return sb_watchpoint;
-
- Target* target = m_opaque_sp->GetUpdatePoint().GetTargetSP().get();
- if (target)
- {
- Mutex::Locker api_locker (target->GetAPIMutex());
- sb_watchpoint = WatchValue(read, write, true);
- }
- LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
- if (log)
- log->Printf ("SBValue(%p)::WatchPointee (resolve_location=%i, read=%i, write=%i) => wp(%p)",
- m_opaque_sp.get(), resolve_location, read, write, sb_watchpoint.get());
+ SBWatchpoint sb_watchpoint;
+ if (IsInScope() && GetType().IsPointerType())
+ sb_watchpoint = Dereference().Watch (resolve_location, read, write);
return sb_watchpoint;
}
-// Helper function for SBValue::Watch() and SBValue::WatchPointee().
-SBWatchpoint
-SBValue::WatchValue(bool read, bool write, bool watch_pointee)
-{
- SBWatchpoint sb_wp_empty;
-
- // If the SBValue is not valid, there's no point in even trying to watch it.
- if (!IsValid())
- return sb_wp_empty;
-
- // Read and Write cannot both be false.
- if (!read && !write)
- return sb_wp_empty;
-
- // If we are watching the pointee, check that the SBValue is a pointer type.
- if (watch_pointee && !GetType().IsPointerType())
- return sb_wp_empty;
-
- TargetSP target_sp (GetTarget().GetSP());
- if (!target_sp)
- return sb_wp_empty;
-
- StackFrameSP frame_sp (GetFrame().GetFrameSP());
- if (!frame_sp)
- return sb_wp_empty;
-
- addr_t addr;
- size_t size;
- if (watch_pointee) {
- addr = GetValueAsUnsigned(LLDB_INVALID_ADDRESS);
- size = GetType().GetPointeeType().GetByteSize();
- } else {
- addr = GetLoadAddress();
- size = GetByteSize();
- }
-
- // Sanity check the address and the size before calling Target::CreateWatchpoint().
- if (addr == LLDB_INVALID_ADDRESS || size == 0)
- return sb_wp_empty;
-
- uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
- (write ? LLDB_WATCH_TYPE_WRITE : 0);
- WatchpointSP wp_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
-
- if (wp_sp) {
- // StackFrame::GetInScopeVariableList(true) to get file globals as well.
- VariableListSP var_list_sp(frame_sp->GetInScopeVariableList(true));
- VariableSP var_sp = var_list_sp->FindVariable(ConstString(GetName()));
- if (var_sp && var_sp->GetDeclaration().GetFile()) {
- StreamString ss;
- // True to show fullpath for declaration file.
- var_sp->GetDeclaration().DumpStopContext(&ss, true);
- wp_sp->SetDeclInfo(ss.GetString());
- }
- }
- return wp_sp;
-}
-
diff --git a/lldb/source/API/SBValueList.cpp b/lldb/source/API/SBValueList.cpp
index c5932b02c86..2142f476adc 100644
--- a/lldb/source/API/SBValueList.cpp
+++ b/lldb/source/API/SBValueList.cpp
@@ -110,10 +110,11 @@ SBValueList::operator*() const
void
SBValueList::Append (const SBValue &val_obj)
{
- if (val_obj.get())
+ ValueObjectSP value_sp (val_obj.GetSP());
+ if (value_sp)
{
CreateIfNeeded ();
- m_opaque_ap->Append (*val_obj);
+ m_opaque_ap->Append (value_sp);
}
}
@@ -147,15 +148,19 @@ SBValueList::GetValueAtIndex (uint32_t idx) const
// log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx);
SBValue sb_value;
+ ValueObjectSP value_sp;
if (m_opaque_ap.get())
- *sb_value = m_opaque_ap->GetValueObjectAtIndex (idx);
+ {
+ value_sp = m_opaque_ap->GetValueObjectAtIndex (idx);
+ sb_value.SetSP (value_sp);
+ }
if (log)
{
SBStream sstr;
sb_value.GetDescription (sstr);
log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')",
- m_opaque_ap.get(), idx, sb_value.get(), sstr.GetData());
+ m_opaque_ap.get(), idx, value_sp.get(), sstr.GetData());
}
return sb_value;
@@ -192,7 +197,7 @@ SBValueList::FindValueObjectByUID (lldb::user_id_t uid)
{
SBValue sb_value;
if (m_opaque_ap.get())
- *sb_value = m_opaque_ap->FindValueObjectByUID (uid);
+ sb_value.SetSP (m_opaque_ap->FindValueObjectByUID (uid));
return sb_value;
}
diff --git a/lldb/source/API/SBWatchpoint.cpp b/lldb/source/API/SBWatchpoint.cpp
index f7885753641..fd505aead54 100644
--- a/lldb/source/API/SBWatchpoint.cpp
+++ b/lldb/source/API/SBWatchpoint.cpp
@@ -69,15 +69,16 @@ SBWatchpoint::GetID ()
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
watch_id_t watch_id = LLDB_INVALID_WATCH_ID;
- if (m_opaque_sp)
- watch_id = m_opaque_sp->GetID();
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
+ watch_id = watchpoint_sp->GetID();
if (log)
{
if (watch_id == LLDB_INVALID_WATCH_ID)
- log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get());
+ log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", watchpoint_sp.get());
else
- log->Printf ("SBWatchpoint(%p)::GetID () => %u", m_opaque_sp.get(), watch_id);
+ log->Printf ("SBWatchpoint(%p)::GetID () => %u", watchpoint_sp.get(), watch_id);
}
return watch_id;
@@ -86,7 +87,8 @@ SBWatchpoint::GetID ()
bool
SBWatchpoint::IsValid() const
{
- if (m_opaque_sp && m_opaque_sp->GetError().Success())
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp && watchpoint_sp->GetError().Success())
return true;
return false;
}
@@ -95,9 +97,10 @@ SBError
SBWatchpoint::GetError ()
{
SBError sb_error;
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- sb_error.SetError(m_opaque_sp->GetError());
+ sb_error.SetError(watchpoint_sp->GetError());
}
return sb_error;
}
@@ -107,10 +110,11 @@ SBWatchpoint::GetHardwareIndex ()
{
int32_t hw_index = -1;
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- hw_index = m_opaque_sp->GetHardwareIndex();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ hw_index = watchpoint_sp->GetHardwareIndex();
}
return hw_index;
@@ -121,10 +125,11 @@ SBWatchpoint::GetWatchAddress ()
{
addr_t ret_addr = LLDB_INVALID_ADDRESS;
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- ret_addr = m_opaque_sp->GetLoadAddress();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ ret_addr = watchpoint_sp->GetLoadAddress();
}
return ret_addr;
@@ -135,10 +140,11 @@ SBWatchpoint::GetWatchSize ()
{
size_t watch_size = 0;
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- watch_size = m_opaque_sp->GetByteSize();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ watch_size = watchpoint_sp->GetByteSize();
}
return watch_size;
@@ -147,20 +153,22 @@ SBWatchpoint::GetWatchSize ()
void
SBWatchpoint::SetEnabled (bool enabled)
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetTarget().DisableWatchpointByID(m_opaque_sp->GetID());
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ watchpoint_sp->GetTarget().DisableWatchpointByID(watchpoint_sp->GetID());
}
}
bool
SBWatchpoint::IsEnabled ()
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->IsEnabled();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ return watchpoint_sp->IsEnabled();
}
else
return false;
@@ -170,15 +178,16 @@ uint32_t
SBWatchpoint::GetHitCount ()
{
uint32_t count = 0;
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- count = m_opaque_sp->GetHitCount();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ count = watchpoint_sp->GetHitCount();
}
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
if (log)
- log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count);
+ log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", watchpoint_sp.get(), count);
return count;
}
@@ -186,10 +195,11 @@ SBWatchpoint::GetHitCount ()
uint32_t
SBWatchpoint::GetIgnoreCount ()
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetIgnoreCount();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ return watchpoint_sp->GetIgnoreCount();
}
else
return 0;
@@ -198,20 +208,22 @@ SBWatchpoint::GetIgnoreCount ()
void
SBWatchpoint::SetIgnoreCount (uint32_t n)
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetIgnoreCount (n);
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ watchpoint_sp->SetIgnoreCount (n);
}
}
const char *
SBWatchpoint::GetCondition ()
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- return m_opaque_sp->GetConditionText ();
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ return watchpoint_sp->GetConditionText ();
}
return NULL;
}
@@ -219,10 +231,11 @@ SBWatchpoint::GetCondition ()
void
SBWatchpoint::SetCondition (const char *condition)
{
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->SetCondition (condition);
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ watchpoint_sp->SetCondition (condition);
}
}
@@ -231,10 +244,11 @@ SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
{
Stream &strm = description.ref();
- if (m_opaque_sp)
+ lldb::WatchpointSP watchpoint_sp(GetSP());
+ if (watchpoint_sp)
{
- Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
- m_opaque_sp->GetDescription (&strm, level);
+ Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
+ watchpoint_sp->GetDescription (&strm, level);
strm.EOL();
}
else
@@ -243,20 +257,20 @@ SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
return true;
}
-lldb_private::Watchpoint *
-SBWatchpoint::operator->()
+void
+SBWatchpoint::Clear ()
{
- return m_opaque_sp.get();
+ m_opaque_sp.reset();
}
-lldb_private::Watchpoint *
-SBWatchpoint::get()
+lldb::WatchpointSP
+SBWatchpoint::GetSP () const
{
- return m_opaque_sp.get();
+ return m_opaque_sp;
}
-lldb::WatchpointSP &
-SBWatchpoint::operator *()
+void
+SBWatchpoint::SetSP (const lldb::WatchpointSP &sp)
{
- return m_opaque_sp;
+ m_opaque_sp = sp;
}
diff --git a/lldb/source/Core/ValueObject.cpp b/lldb/source/Core/ValueObject.cpp
index 60eaa3afbd1..8767b82c87d 100644
--- a/lldb/source/Core/ValueObject.cpp
+++ b/lldb/source/Core/ValueObject.cpp
@@ -1551,6 +1551,13 @@ ValueObject::SetValueFromCString (const char *value_str)
return true;
}
+bool
+ValueObject::GetDeclaration (Declaration &decl)
+{
+ decl.Clear();
+ return false;
+}
+
LanguageType
ValueObject::GetObjectRuntimeLanguage ()
{
@@ -3432,8 +3439,7 @@ ValueObject::AddressOf (Error &error)
ValueObjectSP
ValueObject::Cast (const ClangASTType &clang_ast_type)
{
- ValueObjectSP valobj_sp(new ValueObjectCast (*this, GetName(), clang_ast_type));
- return valobj_sp;
+ return ValueObjectCast::Create (*this, GetName(), clang_ast_type);
}
ValueObjectSP
diff --git a/lldb/source/Core/ValueObjectDynamicValue.cpp b/lldb/source/Core/ValueObjectDynamicValue.cpp
index b55d927b760..5ea7993411b 100644
--- a/lldb/source/Core/ValueObjectDynamicValue.cpp
+++ b/lldb/source/Core/ValueObjectDynamicValue.cpp
@@ -34,6 +34,14 @@
using namespace lldb_private;
+lldb::ValueObjectSP
+ValueObjectCast::Create (ValueObject &parent,
+ const ConstString &name,
+ const ClangASTType &cast_type)
+{
+ ValueObjectCast *cast_valobj_ptr = new ValueObjectCast (parent, name, cast_type);
+ return cast_valobj_ptr->GetSP();
+}
ValueObjectCast::ValueObjectCast
(
diff --git a/lldb/source/Core/ValueObjectVariable.cpp b/lldb/source/Core/ValueObjectVariable.cpp
index 1a4a89ce382..181324db251 100644
--- a/lldb/source/Core/ValueObjectVariable.cpp
+++ b/lldb/source/Core/ValueObjectVariable.cpp
@@ -276,3 +276,14 @@ ValueObjectVariable::GetSymbolContextScope()
return m_variable_sp->GetSymbolContextScope();
return NULL;
}
+
+bool
+ValueObjectVariable::GetDeclaration (Declaration &decl)
+{
+ if (m_variable_sp)
+ {
+ decl = m_variable_sp->GetDeclaration();
+ return true;
+ }
+ return false;
+}
diff --git a/lldb/source/Symbol/ClangASTType.cpp b/lldb/source/Symbol/ClangASTType.cpp
index 503a0974c4c..6e9c05a053c 100644
--- a/lldb/source/Symbol/ClangASTType.cpp
+++ b/lldb/source/Symbol/ClangASTType.cpp
@@ -182,10 +182,9 @@ ClangASTType::GetArrayElementType (clang::ASTContext* ast,
}
lldb::clang_type_t
-ClangASTType::GetPointerType ()
+ClangASTType::GetPointerType () const
{
- return GetPointerType (m_ast,
- m_type);
+ return GetPointerType (m_ast, m_type);
}
lldb::clang_type_t
diff --git a/lldb/test/expression_command/test/TestExprs.py b/lldb/test/expression_command/test/TestExprs.py
index fe60b3e9726..0f7dc9e4abd 100644
--- a/lldb/test/expression_command/test/TestExprs.py
+++ b/lldb/test/expression_command/test/TestExprs.py
@@ -94,7 +94,7 @@ class BasicExprCommandsTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Verify the breakpoint just created.
- self.expect(repr(breakpoint), BREAKPOINT_CREATED, exe=False,
+ self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
substrs = ['main.cpp',
str(self.line)])
diff --git a/lldb/test/lang/c/array_types/TestArrayTypes.py b/lldb/test/lang/c/array_types/TestArrayTypes.py
index 7aca609d84b..a2d94b16a89 100644
--- a/lldb/test/lang/c/array_types/TestArrayTypes.py
+++ b/lldb/test/lang/c/array_types/TestArrayTypes.py
@@ -101,7 +101,7 @@ class ArrayTypesTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Sanity check the print representation of breakpoint.
- bp = repr(breakpoint)
+ bp = str(breakpoint)
self.expect(bp, msg="Breakpoint looks good", exe=False,
substrs = ["file ='main.c'",
"line = %d" % self.line,
@@ -114,7 +114,7 @@ class ArrayTypesTestCase(TestBase):
self.assertTrue(process, PROCESS_IS_VALID)
# Sanity check the print representation of process.
- proc = repr(process)
+ proc = str(process)
self.expect(proc, msg="Process looks good", exe=False,
substrs = ["state = stopped",
"executable = a.out"])
@@ -127,7 +127,7 @@ class ArrayTypesTestCase(TestBase):
stop_reason_to_str(thread.GetStopReason()))
# Sanity check the print representation of thread.
- thr = repr(thread)
+ thr = str(thread)
self.expect(thr, "Thread looks good with stop reason = breakpoint", exe=False,
substrs = ["tid = 0x%4.4x" % thread.GetThreadID()])
@@ -135,7 +135,7 @@ class ArrayTypesTestCase(TestBase):
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
# The breakpoint should be resolved by now.
- bp = repr(breakpoint)
+ bp = str(breakpoint)
self.expect(bp, "Breakpoint looks good and is resolved", exe=False,
substrs = ["file ='main.c'",
"line = %d" % self.line,
@@ -143,7 +143,7 @@ class ArrayTypesTestCase(TestBase):
# Sanity check the print representation of frame.
frame = thread.GetFrameAtIndex(0)
- frm = repr(frame)
+ frm = str(frame)
self.expect(frm,
"Frame looks good with correct index %d" % frame.GetFrameID(),
exe=False,
@@ -152,7 +152,7 @@ class ArrayTypesTestCase(TestBase):
# Lookup the "strings" string array variable and sanity check its print
# representation.
variable = frame.FindVariable("strings")
- var = repr(variable)
+ var = str(variable)
self.expect(var, "Variable for 'strings' looks good with correct name", exe=False,
substrs = ["%s" % variable.GetName()])
self.DebugSBValue(variable)
diff --git a/lldb/test/lang/cpp/class_types/TestClassTypes.py b/lldb/test/lang/cpp/class_types/TestClassTypes.py
index 4be117a0d0a..21bb489264b 100644
--- a/lldb/test/lang/cpp/class_types/TestClassTypes.py
+++ b/lldb/test/lang/cpp/class_types/TestClassTypes.py
@@ -114,7 +114,7 @@ class ClassTypesTestCase(TestBase):
self.assertTrue(breakpoint, VALID_BREAKPOINT)
# Verify the breakpoint just created.
- self.expect(repr(breakpoint), BREAKPOINT_CREATED, exe=False,
+ self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
substrs = ['main.cpp',
str(self.line)])
diff --git a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
index 64aba7f3dde..80a224e5307 100644
--- a/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
+++ b/lldb/test/lang/cpp/stl/TestStdCXXDisassembly.py
@@ -43,7 +43,7 @@ class StdCXXDisassembleTestCase(TestBase):
process = target.GetProcess()
# The process should be in a 'stopped' state.
- self.expect(repr(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
+ self.expect(str(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
substrs = ["a.out",
"stopped"])
@@ -61,7 +61,7 @@ class StdCXXDisassembleTestCase(TestBase):
module = target.GetModuleAtIndex(i)
fs = module.GetFileSpec()
if (fs.GetFilename().startswith("libstdc++")):
- lib_stdcxx = repr(fs)
+ lib_stdcxx = str(fs)
break
# At this point, lib_stdcxx is the full path to the stdc++ library and
@@ -70,7 +70,7 @@ class StdCXXDisassembleTestCase(TestBase):
self.expect(fs.GetFilename(), "Libraray StdC++ is located", exe=False,
substrs = ["libstdc++"])
- self.runCmd("image dump symtab %s" % repr(fs))
+ self.runCmd("image dump symtab %s" % str(fs))
raw_output = self.res.GetOutput()
# Now, look for every 'Code' symbol and feed its load address into the
# command: 'disassemble -s load_address -e end_address', where the
diff --git a/lldb/test/lldbutil.py b/lldb/test/lldbutil.py
index 8341f2cd9b7..7e4b4fcee8e 100644
--- a/lldb/test/lldbutil.py
+++ b/lldb/test/lldbutil.py
@@ -459,7 +459,7 @@ def print_stacktraces(process, string_buffer = False):
output = StringIO.StringIO() if string_buffer else sys.stdout
- print >> output, "Stack traces for " + repr(process)
+ print >> output, "Stack traces for " + str(process)
for thread in process:
print >> output, print_stacktrace(thread, string_buffer=True)
@@ -516,7 +516,7 @@ def print_registers(frame, string_buffer = False):
output = StringIO.StringIO() if string_buffer else sys.stdout
- print >> output, "Register sets for " + repr(frame)
+ print >> output, "Register sets for " + str(frame)
registerSet = frame.GetRegisters() # Return type of SBValueList.
print >> output, "Frame registers (size of register set = %d):" % registerSet.GetSize()
diff --git a/lldb/test/python_api/module_section/TestModuleAndSection.py b/lldb/test/python_api/module_section/TestModuleAndSection.py
index 1ebe9d33433..f9562cbf490 100644
--- a/lldb/test/python_api/module_section/TestModuleAndSection.py
+++ b/lldb/test/python_api/module_section/TestModuleAndSection.py
@@ -43,7 +43,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
# Get the executable module at index 0.
exe_module = target.GetModuleAtIndex(0)
- print "Exe module: %s" % repr(exe_module)
+ print "Exe module: %s" % str(exe_module)
print "Number of sections: %d" % exe_module.GetNumSections()
INDENT = ' ' * 4
INDENT2 = INDENT * 2
@@ -52,14 +52,14 @@ class ModuleAndSectionAPIsTestCase(TestBase):
print INDENT + "Number of subsections: %d" % sec.GetNumSubSections()
if sec.GetNumSubSections() == 0:
for sym in exe_module.symbol_in_section_iter(sec):
- print INDENT + repr(sym)
+ print INDENT + str(sym)
print INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType())
else:
for subsec in sec:
- print INDENT + repr(subsec)
+ print INDENT + str(subsec)
# Now print the symbols belonging to the subsection....
for sym in exe_module.symbol_in_section_iter(subsec):
- print INDENT2 + repr(sym)
+ print INDENT2 + str(sym)
print INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType())
def module_and_section_boundary_condition(self):
@@ -80,7 +80,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
# Get the executable module at index 0.
exe_module = target.GetModuleAtIndex(0)
- print "Exe module: %s" % repr(exe_module)
+ print "Exe module: %s" % str(exe_module)
print "Number of sections: %d" % exe_module.GetNumSections()
# Boundary condition testings. Should not crash lldb!
diff --git a/lldb/test/python_api/sbdata/TestSBData.py b/lldb/test/python_api/sbdata/TestSBData.py
index 9d5b5c06765..e9856d7b85e 100644
--- a/lldb/test/python_api/sbdata/TestSBData.py
+++ b/lldb/test/python_api/sbdata/TestSBData.py
@@ -53,9 +53,9 @@ class SBDataAPICase(TestBase):
thread = process.GetThreadAtIndex(0)
frame = thread.GetSelectedFrame()
-
+ print frame
foobar = frame.FindVariable('foobar')
-
+ self.assertTrue(foobar.IsValid())
if self.TraceOn():
print foobar
@@ -98,6 +98,7 @@ class SBDataAPICase(TestBase):
self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
star_foobar = foobar.Dereference()
+ self.assertTrue(star_foobar.IsValid())
data = star_foobar.GetData()
@@ -118,7 +119,7 @@ class SBDataAPICase(TestBase):
nothing = foobar.CreateValueFromAddress("nothing", foobar_addr, star_foobar.GetType().GetBasicType(lldb.eBasicTypeInvalid))
new_foobar = foobar.CreateValueFromAddress("f00", foobar_addr, star_foobar.GetType())
-
+ self.assertTrue(new_foobar.IsValid())
if self.TraceOn():
print new_foobar
diff --git a/lldb/test/python_api/symbol-context/TestSymbolContext.py b/lldb/test/python_api/symbol-context/TestSymbolContext.py
index b601920e10f..ad0a55b22f4 100644
--- a/lldb/test/python_api/symbol-context/TestSymbolContext.py
+++ b/lldb/test/python_api/symbol-context/TestSymbolContext.py
@@ -68,7 +68,7 @@ class SymbolContextAPITestCase(TestBase):
substrs = [os.path.join(self.mydir, 'a.out')])
compileUnit = context.GetCompileUnit()
- self.expect(repr(compileUnit), "The compile unit should match", exe=False,
+ self.expect(str(compileUnit), "The compile unit should match", exe=False,
substrs = [os.path.join(self.mydir, 'main.c')])
function = context.GetFunction()
OpenPOWER on IntegriCloud