[Lldb-commits] [lldb] r149743 - in /lldb/trunk: include/lldb/API/ include/lldb/Core/ include/lldb/Symbol/ scripts/Python/ source/API/ source/Core/ source/Symbol/ test/ test/expression_command/test/ test/lang/c/array_types/ test/lang/cpp/class_types/ test/lang/cpp/stl/ test/python_api/module_section/ test/python_api/sbdata/ test/python_api/symbol-context/
Greg Clayton
gclayton at apple.com
Fri Feb 3 18:27:34 PST 2012
Author: gclayton
Date: Fri Feb 3 20:27:34 2012
New Revision: 149743
URL: http://llvm.org/viewvc/llvm-project?rev=149743&view=rev
Log:
Convert all python objects in our API to use overload the __str__ method
instead of the __repr__. __repr__ is a function that should return an
expression that can be used to recreate an python object and we were using
it to just return a human readable string.
Fixed a crasher when using the new implementation of SBValue::Cast(SBType).
Thread hardened lldb::SBValue and lldb::SBWatchpoint and did other general
improvements to the API.
Fixed a crasher in lldb::SBValue::GetChildMemberWithName() where we didn't
correctly handle not having a target.
Modified:
lldb/trunk/include/lldb/API/SBType.h
lldb/trunk/include/lldb/API/SBValue.h
lldb/trunk/include/lldb/API/SBWatchpoint.h
lldb/trunk/include/lldb/Core/ValueObject.h
lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
lldb/trunk/include/lldb/Core/ValueObjectVariable.h
lldb/trunk/include/lldb/Symbol/ClangASTType.h
lldb/trunk/scripts/Python/python-extensions.swig
lldb/trunk/source/API/SBFrame.cpp
lldb/trunk/source/API/SBTarget.cpp
lldb/trunk/source/API/SBType.cpp
lldb/trunk/source/API/SBValue.cpp
lldb/trunk/source/API/SBValueList.cpp
lldb/trunk/source/API/SBWatchpoint.cpp
lldb/trunk/source/Core/ValueObject.cpp
lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
lldb/trunk/source/Core/ValueObjectVariable.cpp
lldb/trunk/source/Symbol/ClangASTType.cpp
lldb/trunk/test/expression_command/test/TestExprs.py
lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
lldb/trunk/test/lang/cpp/stl/TestStdCXXDisassembly.py
lldb/trunk/test/lldbutil.py
lldb/trunk/test/python_api/module_section/TestModuleAndSection.py
lldb/trunk/test/python_api/sbdata/TestSBData.py
lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py
Modified: lldb/trunk/include/lldb/API/SBType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBType.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBType.h (original)
+++ lldb/trunk/include/lldb/API/SBType.h Fri Feb 3 20:27:34 2012
@@ -167,6 +167,9 @@
const lldb_private::TypeImpl &
ref () const;
+ lldb::TypeImplSP
+ GetSP ();
+
void
SetSP (const lldb::TypeImplSP &type_impl_sp);
#endif
Modified: lldb/trunk/include/lldb/API/SBValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBValue.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBValue.h (original)
+++ lldb/trunk/include/lldb/API/SBValue.h Fri Feb 3 20:27:34 2012
@@ -355,27 +355,13 @@
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;
};
Modified: lldb/trunk/include/lldb/API/SBWatchpoint.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/API/SBWatchpoint.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/API/SBWatchpoint.h (original)
+++ lldb/trunk/include/lldb/API/SBWatchpoint.h Fri Feb 3 20:27:34 2012
@@ -22,12 +22,12 @@
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 @@
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;
};
Modified: lldb/trunk/include/lldb/Core/ValueObject.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObject.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObject.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObject.h Fri Feb 3 20:27:34 2012
@@ -518,6 +518,9 @@
virtual ConstString
GetTypeName() = 0;
+ //------------------------------------------------------------------
+ // Sublasses can implement the functions below.
+ //------------------------------------------------------------------
virtual lldb::LanguageType
GetObjectRuntimeLanguage();
@@ -632,6 +635,10 @@
return m_parent->GetModule();
return NULL;
}
+
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
//------------------------------------------------------------------
// The functions below should NOT be modified by sublasses
//------------------------------------------------------------------
Modified: lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectDynamicValue.h Fri Feb 3 20:27:34 2012
@@ -22,6 +22,11 @@
class ValueObjectCast : public ValueObject
{
public:
+ static lldb::ValueObjectSP
+ Create (ValueObject &parent,
+ const ConstString &name,
+ const ClangASTType &cast_type);
+
virtual
~ValueObjectCast();
@@ -83,7 +88,6 @@
ClangASTType m_cast_type;
private:
- friend class ValueObject;
ValueObjectCast (ValueObject &parent,
const ConstString &name,
const ClangASTType &cast_type);
Modified: lldb/trunk/include/lldb/Core/ValueObjectVariable.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Core/ValueObjectVariable.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Core/ValueObjectVariable.h (original)
+++ lldb/trunk/include/lldb/Core/ValueObjectVariable.h Fri Feb 3 20:27:34 2012
@@ -58,6 +58,9 @@
virtual SymbolContextScope *
GetSymbolContextScope();
+ virtual bool
+ GetDeclaration (Declaration &decl);
+
protected:
virtual bool
UpdateValue ();
Modified: lldb/trunk/include/lldb/Symbol/ClangASTType.h
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/include/lldb/Symbol/ClangASTType.h?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/include/lldb/Symbol/ClangASTType.h (original)
+++ lldb/trunk/include/lldb/Symbol/ClangASTType.h Fri Feb 3 20:27:34 2012
@@ -301,7 +301,7 @@
uint32_t& stride);
lldb::clang_type_t
- GetPointerType ();
+ GetPointerType () const;
static lldb::clang_type_t
GetPointerType (clang::ASTContext *ast_context,
Modified: lldb/trunk/scripts/Python/python-extensions.swig
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/scripts/Python/python-extensions.swig?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/scripts/Python/python-extensions.swig (original)
+++ lldb/trunk/scripts/Python/python-extensions.swig Fri Feb 3 20:27:34 2012
@@ -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 @@
def __nonzero__(self):
return self.sbvalue.__nonzero__()
- def __repr__(self):
- return self.sbvalue.__repr__()
-
def __str__(self):
return self.sbvalue.__str__()
Modified: lldb/trunk/source/API/SBFrame.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBFrame.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBFrame.cpp (original)
+++ lldb/trunk/source/API/SBFrame.cpp Fri Feb 3 20:27:34 2012
@@ -483,7 +483,7 @@
StackFrame::eExpressionPathOptionCheckPtrVsMember,
var_sp,
error));
- *sb_value = value_sp;
+ sb_value.SetSP(value_sp);
}
return sb_value;
}
@@ -507,6 +507,7 @@
{
VariableSP var_sp;
SBValue sb_value;
+ ValueObjectSP value_sp;
StackFrameSP frame_sp(GetFrameSP());
if (frame_sp && name && name[0])
{
@@ -530,14 +531,17 @@
}
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 @@
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 @@
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 @@
((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 @@
((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 @@
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 @@
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 @@
ExecutionResults exe_results;
SBValue expr_result;
+ ValueObjectSP expr_value_sp;
StackFrameSP frame_sp(GetFrameSP());
if (log)
@@ -912,8 +925,8 @@
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 @@
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;
Modified: lldb/trunk/source/API/SBTarget.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBTarget.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBTarget.cpp (original)
+++ lldb/trunk/source/API/SBTarget.cpp Fri Feb 3 20:27:34 2012
@@ -947,7 +947,7 @@
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 @@
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 @@
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;
Modified: lldb/trunk/source/API/SBType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBType.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBType.cpp (original)
+++ lldb/trunk/source/API/SBType.cpp Fri Feb 3 20:27:34 2012
@@ -83,6 +83,13 @@
(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)
{
Modified: lldb/trunk/source/API/SBValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValue.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValue.cpp (original)
+++ lldb/trunk/source/API/SBValue.cpp Fri Feb 3 20:27:34 2012
@@ -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 @@
{
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 @@
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 @@
{
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 @@
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 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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())
- {
- SBType real_type(type.GetPointerType());
-
- lldb::DataBufferSP buffer(new lldb_private::DataBufferHeap(&address,sizeof(lldb::addr_t)));
+ 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)
+ {
+ 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 @@
{
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 @@
{
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 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 @@
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
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
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::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 @@
{
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 @@
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 @@
{
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 @@
{
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 @@
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 @@
{
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 @@
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 @@
{
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 @@
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 @@
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 @@
{
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 @@
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 @@
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 @@
}
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 @@
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 @@
}
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 @@
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 @@
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 @@
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 @@
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 @@
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;
-}
-
Modified: lldb/trunk/source/API/SBValueList.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBValueList.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBValueList.cpp (original)
+++ lldb/trunk/source/API/SBValueList.cpp Fri Feb 3 20:27:34 2012
@@ -110,10 +110,11 @@
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 @@
// 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 @@
{
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;
}
Modified: lldb/trunk/source/API/SBWatchpoint.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/API/SBWatchpoint.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/API/SBWatchpoint.cpp (original)
+++ lldb/trunk/source/API/SBWatchpoint.cpp Fri Feb 3 20:27:34 2012
@@ -69,15 +69,16 @@
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 @@
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 @@
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 @@
{
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 @@
{
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 @@
{
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 @@
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 @@
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 @@
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 @@
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 @@
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 @@
{
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 @@
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;
}
Modified: lldb/trunk/source/Core/ValueObject.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObject.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObject.cpp (original)
+++ lldb/trunk/source/Core/ValueObject.cpp Fri Feb 3 20:27:34 2012
@@ -1551,6 +1551,13 @@
return true;
}
+bool
+ValueObject::GetDeclaration (Declaration &decl)
+{
+ decl.Clear();
+ return false;
+}
+
LanguageType
ValueObject::GetObjectRuntimeLanguage ()
{
@@ -3432,8 +3439,7 @@
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
Modified: lldb/trunk/source/Core/ValueObjectDynamicValue.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectDynamicValue.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectDynamicValue.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectDynamicValue.cpp Fri Feb 3 20:27:34 2012
@@ -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
(
Modified: lldb/trunk/source/Core/ValueObjectVariable.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Core/ValueObjectVariable.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/Core/ValueObjectVariable.cpp (original)
+++ lldb/trunk/source/Core/ValueObjectVariable.cpp Fri Feb 3 20:27:34 2012
@@ -276,3 +276,14 @@
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;
+}
Modified: lldb/trunk/source/Symbol/ClangASTType.cpp
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/source/Symbol/ClangASTType.cpp?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/source/Symbol/ClangASTType.cpp (original)
+++ lldb/trunk/source/Symbol/ClangASTType.cpp Fri Feb 3 20:27:34 2012
@@ -182,10 +182,9 @@
}
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
Modified: lldb/trunk/test/expression_command/test/TestExprs.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/expression_command/test/TestExprs.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/expression_command/test/TestExprs.py (original)
+++ lldb/trunk/test/expression_command/test/TestExprs.py Fri Feb 3 20:27:34 2012
@@ -94,7 +94,7 @@
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)])
Modified: lldb/trunk/test/lang/c/array_types/TestArrayTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/c/array_types/TestArrayTypes.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/lang/c/array_types/TestArrayTypes.py (original)
+++ lldb/trunk/test/lang/c/array_types/TestArrayTypes.py Fri Feb 3 20:27:34 2012
@@ -101,7 +101,7 @@
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 @@
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 @@
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 @@
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 @@
# 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 @@
# 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)
Modified: lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py (original)
+++ lldb/trunk/test/lang/cpp/class_types/TestClassTypes.py Fri Feb 3 20:27:34 2012
@@ -114,7 +114,7 @@
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)])
Modified: lldb/trunk/test/lang/cpp/stl/TestStdCXXDisassembly.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lang/cpp/stl/TestStdCXXDisassembly.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/lang/cpp/stl/TestStdCXXDisassembly.py (original)
+++ lldb/trunk/test/lang/cpp/stl/TestStdCXXDisassembly.py Fri Feb 3 20:27:34 2012
@@ -43,7 +43,7 @@
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 @@
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 @@
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
Modified: lldb/trunk/test/lldbutil.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/lldbutil.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/lldbutil.py (original)
+++ lldb/trunk/test/lldbutil.py Fri Feb 3 20:27:34 2012
@@ -459,7 +459,7 @@
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 @@
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()
Modified: lldb/trunk/test/python_api/module_section/TestModuleAndSection.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/module_section/TestModuleAndSection.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/python_api/module_section/TestModuleAndSection.py (original)
+++ lldb/trunk/test/python_api/module_section/TestModuleAndSection.py Fri Feb 3 20:27:34 2012
@@ -43,7 +43,7 @@
# 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 @@
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 @@
# 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!
Modified: lldb/trunk/test/python_api/sbdata/TestSBData.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/sbdata/TestSBData.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/python_api/sbdata/TestSBData.py (original)
+++ lldb/trunk/test/python_api/sbdata/TestSBData.py Fri Feb 3 20:27:34 2012
@@ -53,9 +53,9 @@
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 @@
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 @@
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
Modified: lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py
URL: http://llvm.org/viewvc/llvm-project/lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py?rev=149743&r1=149742&r2=149743&view=diff
==============================================================================
--- lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py (original)
+++ lldb/trunk/test/python_api/symbol-context/TestSymbolContext.py Fri Feb 3 20:27:34 2012
@@ -68,7 +68,7 @@
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()
More information about the lldb-commits
mailing list