forked from OSchip/llvm-project
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. llvm-svn: 149743
This commit is contained in:
parent
d0ba3793aa
commit
81e871ed76
|
@ -167,6 +167,9 @@ protected:
|
|||
const lldb_private::TypeImpl &
|
||||
ref () const;
|
||||
|
||||
lldb::TypeImplSP
|
||||
GetSP ();
|
||||
|
||||
void
|
||||
SetSP (const lldb::TypeImplSP &type_impl_sp);
|
||||
#endif
|
||||
|
|
|
@ -355,27 +355,13 @@ protected:
|
|||
friend class SBValueList;
|
||||
friend class SBFrame;
|
||||
|
||||
#ifndef SWIG
|
||||
// Mimic shared pointer...
|
||||
lldb_private::ValueObject *
|
||||
get() const;
|
||||
|
||||
lldb_private::ValueObject *
|
||||
operator->() const;
|
||||
|
||||
lldb::ValueObjectSP &
|
||||
operator*();
|
||||
|
||||
const lldb::ValueObjectSP &
|
||||
operator*() const;
|
||||
|
||||
#endif
|
||||
|
||||
lldb::ValueObjectSP
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
SetSP (const lldb::ValueObjectSP &sp);
|
||||
|
||||
private:
|
||||
// Helper function for SBValue::Watch() and SBValue::WatchPointee().
|
||||
lldb::SBWatchpoint
|
||||
WatchValue(bool read, bool write, bool watch_pointee);
|
||||
|
||||
lldb::ValueObjectSP m_opaque_sp;
|
||||
};
|
||||
|
||||
|
|
|
@ -22,12 +22,12 @@ public:
|
|||
|
||||
SBWatchpoint (const lldb::SBWatchpoint &rhs);
|
||||
|
||||
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
|
||||
|
||||
~SBWatchpoint ();
|
||||
|
||||
#ifndef SWIG
|
||||
const lldb::SBWatchpoint &
|
||||
operator = (const lldb::SBWatchpoint &rhs);
|
||||
#endif
|
||||
|
||||
bool
|
||||
IsValid() const;
|
||||
|
@ -72,27 +72,20 @@ public:
|
|||
bool
|
||||
GetDescription (lldb::SBStream &description, DescriptionLevel level);
|
||||
|
||||
#ifndef SWIG
|
||||
SBWatchpoint (const lldb::WatchpointSP &wp_sp);
|
||||
#endif
|
||||
void
|
||||
Clear ();
|
||||
|
||||
lldb::WatchpointSP
|
||||
GetSP () const;
|
||||
|
||||
void
|
||||
SetSP (const lldb::WatchpointSP &sp);
|
||||
|
||||
private:
|
||||
friend class SBTarget;
|
||||
friend class SBValue;
|
||||
|
||||
#ifndef SWIG
|
||||
|
||||
lldb_private::Watchpoint *
|
||||
operator->();
|
||||
|
||||
lldb_private::Watchpoint *
|
||||
get();
|
||||
|
||||
lldb::WatchpointSP &
|
||||
operator *();
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
lldb::WatchpointSP m_opaque_sp;
|
||||
|
||||
};
|
||||
|
|
|
@ -518,6 +518,9 @@ public:
|
|||
virtual ConstString
|
||||
GetTypeName() = 0;
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// Sublasses can implement the functions below.
|
||||
//------------------------------------------------------------------
|
||||
virtual lldb::LanguageType
|
||||
GetObjectRuntimeLanguage();
|
||||
|
||||
|
@ -632,6 +635,10 @@ public:
|
|||
return m_parent->GetModule();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
virtual bool
|
||||
GetDeclaration (Declaration &decl);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// The functions below should NOT be modified by sublasses
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -22,6 +22,11 @@ namespace lldb_private {
|
|||
class ValueObjectCast : public ValueObject
|
||||
{
|
||||
public:
|
||||
static lldb::ValueObjectSP
|
||||
Create (ValueObject &parent,
|
||||
const ConstString &name,
|
||||
const ClangASTType &cast_type);
|
||||
|
||||
virtual
|
||||
~ValueObjectCast();
|
||||
|
||||
|
@ -83,7 +88,6 @@ namespace lldb_private {
|
|||
ClangASTType m_cast_type;
|
||||
|
||||
private:
|
||||
friend class ValueObject;
|
||||
ValueObjectCast (ValueObject &parent,
|
||||
const ConstString &name,
|
||||
const ClangASTType &cast_type);
|
||||
|
|
|
@ -58,6 +58,9 @@ public:
|
|||
virtual SymbolContextScope *
|
||||
GetSymbolContextScope();
|
||||
|
||||
virtual bool
|
||||
GetDeclaration (Declaration &decl);
|
||||
|
||||
protected:
|
||||
virtual bool
|
||||
UpdateValue ();
|
||||
|
|
|
@ -301,7 +301,7 @@ public:
|
|||
uint32_t& stride);
|
||||
|
||||
lldb::clang_type_t
|
||||
GetPointerType ();
|
||||
GetPointerType () const;
|
||||
|
||||
static lldb::clang_type_t
|
||||
GetPointerType (clang::ASTContext *ast_context,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
|
||||
%extend lldb::SBAddress {
|
||||
PyObject *lldb::SBAddress::__repr__ (){
|
||||
PyObject *lldb::SBAddress::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -9,11 +9,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBBlock {
|
||||
PyObject *lldb::SBBlock::__repr__ (){
|
||||
PyObject *lldb::SBBlock::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -22,11 +23,13 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
|
||||
}
|
||||
}
|
||||
%extend lldb::SBBreakpoint {
|
||||
PyObject *lldb::SBBreakpoint::__repr__ (){
|
||||
PyObject *lldb::SBBreakpoint::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -35,11 +38,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBBreakpointLocation {
|
||||
PyObject *lldb::SBBreakpointLocation::__repr__ (){
|
||||
PyObject *lldb::SBBreakpointLocation::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelFull);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -48,11 +52,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBCommandReturnObject {
|
||||
PyObject *lldb::SBCommandReturnObject::__repr__ (){
|
||||
PyObject *lldb::SBCommandReturnObject::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -61,11 +66,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBCompileUnit {
|
||||
PyObject *lldb::SBCompileUnit::__repr__ (){
|
||||
PyObject *lldb::SBCompileUnit::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -74,11 +80,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBData {
|
||||
PyObject *lldb::SBData::__repr__ (){
|
||||
PyObject *lldb::SBData::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -87,11 +94,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBDebugger {
|
||||
PyObject *lldb::SBDebugger::__repr__ (){
|
||||
PyObject *lldb::SBDebugger::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -100,11 +108,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBError {
|
||||
PyObject *lldb::SBError::__repr__ (){
|
||||
PyObject *lldb::SBError::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -113,11 +122,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBFileSpec {
|
||||
PyObject *lldb::SBFileSpec::__repr__ (){
|
||||
PyObject *lldb::SBFileSpec::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -126,11 +136,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBFrame {
|
||||
PyObject *lldb::SBFrame::__repr__ (){
|
||||
PyObject *lldb::SBFrame::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -139,11 +150,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBFunction {
|
||||
PyObject *lldb::SBFunction::__repr__ (){
|
||||
PyObject *lldb::SBFunction::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -152,11 +164,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBInstruction {
|
||||
PyObject *lldb::SBInstruction::__repr__ (){
|
||||
PyObject *lldb::SBInstruction::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -165,11 +178,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBInstructionList {
|
||||
PyObject *lldb::SBInstructionList::__repr__ (){
|
||||
PyObject *lldb::SBInstructionList::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -178,11 +192,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBLineEntry {
|
||||
PyObject *lldb::SBLineEntry::__repr__ (){
|
||||
PyObject *lldb::SBLineEntry::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -191,11 +206,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBModule {
|
||||
PyObject *lldb::SBModule::__repr__ (){
|
||||
PyObject *lldb::SBModule::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -204,11 +220,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBProcess {
|
||||
PyObject *lldb::SBProcess::__repr__ (){
|
||||
PyObject *lldb::SBProcess::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -217,11 +234,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBSection {
|
||||
PyObject *lldb::SBSection::__repr__ (){
|
||||
PyObject *lldb::SBSection::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -230,11 +248,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBSymbol {
|
||||
PyObject *lldb::SBSymbol::__repr__ (){
|
||||
PyObject *lldb::SBSymbol::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -243,11 +262,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBSymbolContext {
|
||||
PyObject *lldb::SBSymbolContext::__repr__ (){
|
||||
PyObject *lldb::SBSymbolContext::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -256,11 +276,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBTarget {
|
||||
PyObject *lldb::SBTarget::__repr__ (){
|
||||
PyObject *lldb::SBTarget::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -269,11 +290,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBType {
|
||||
PyObject *lldb::SBType::__repr__ (){
|
||||
PyObject *lldb::SBType::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -282,11 +304,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBTypeMember {
|
||||
PyObject *lldb::SBTypeMember::__repr__ (){
|
||||
PyObject *lldb::SBTypeMember::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelBrief);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -295,11 +318,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBThread {
|
||||
PyObject *lldb::SBThread::__repr__ (){
|
||||
PyObject *lldb::SBThread::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -308,11 +332,12 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBValue {
|
||||
PyObject *lldb::SBValue::__repr__ (){
|
||||
PyObject *lldb::SBValue::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -321,7 +346,8 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
%extend lldb::SBValueList {
|
||||
|
@ -347,7 +373,7 @@
|
|||
}
|
||||
}
|
||||
%extend lldb::SBWatchpoint {
|
||||
PyObject *lldb::SBWatchpoint::__repr__ (){
|
||||
PyObject *lldb::SBWatchpoint::__str__ (){
|
||||
lldb::SBStream description;
|
||||
$self->GetDescription (description, lldb::eDescriptionLevelVerbose);
|
||||
const char *desc = description.GetData();
|
||||
|
@ -356,7 +382,8 @@
|
|||
--desc_len;
|
||||
if (desc_len > 0)
|
||||
return PyString_FromStringAndSize (desc, desc_len);
|
||||
return Py_None;
|
||||
else
|
||||
return PyString_FromString("");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -382,9 +409,6 @@ class value(object):
|
|||
def __nonzero__(self):
|
||||
return self.sbvalue.__nonzero__()
|
||||
|
||||
def __repr__(self):
|
||||
return self.sbvalue.__repr__()
|
||||
|
||||
def __str__(self):
|
||||
return self.sbvalue.__str__()
|
||||
|
||||
|
|
|
@ -483,7 +483,7 @@ SBFrame::GetValueForVariablePath (const char *var_path, DynamicValueType use_dyn
|
|||
StackFrame::eExpressionPathOptionCheckPtrVsMember,
|
||||
var_sp,
|
||||
error));
|
||||
*sb_value = value_sp;
|
||||
sb_value.SetSP(value_sp);
|
||||
}
|
||||
return sb_value;
|
||||
}
|
||||
|
@ -507,6 +507,7 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
|
|||
{
|
||||
VariableSP var_sp;
|
||||
SBValue sb_value;
|
||||
ValueObjectSP value_sp;
|
||||
StackFrameSP frame_sp(GetFrameSP());
|
||||
if (frame_sp && name && name[0])
|
||||
{
|
||||
|
@ -530,14 +531,17 @@ SBFrame::FindVariable (const char *name, lldb::DynamicValueType use_dynamic)
|
|||
}
|
||||
|
||||
if (var_sp)
|
||||
*sb_value = ValueObjectSP (frame_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic));
|
||||
{
|
||||
value_sp = frame_sp->GetValueObjectForFrameVariable(var_sp, use_dynamic);
|
||||
sb_value.SetSP(value_sp);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf ("SBFrame(%p)::FindVariable (name=\"%s\") => SBValue(%p)",
|
||||
frame_sp.get(), name, sb_value.get());
|
||||
frame_sp.get(), name, value_sp.get());
|
||||
|
||||
return sb_value;
|
||||
}
|
||||
|
@ -559,6 +563,7 @@ SBValue
|
|||
SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueType use_dynamic)
|
||||
{
|
||||
SBValue sb_value;
|
||||
ValueObjectSP value_sp;
|
||||
StackFrameSP frame_sp(GetFrameSP());
|
||||
if (frame_sp && name && name[0])
|
||||
{
|
||||
|
@ -593,8 +598,8 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
|
|||
variable_sp->GetScope() == value_type &&
|
||||
variable_sp->GetName() == const_name)
|
||||
{
|
||||
*sb_value = ValueObjectSP (frame_sp->GetValueObjectForFrameVariable(variable_sp,
|
||||
use_dynamic));
|
||||
value_sp = frame_sp->GetValueObjectForFrameVariable (variable_sp, use_dynamic);
|
||||
sb_value.SetSP (value_sp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
@ -615,7 +620,9 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
|
|||
((reg_info->name && strcasecmp (reg_info->name, name) == 0) ||
|
||||
(reg_info->alt_name && strcasecmp (reg_info->alt_name, name) == 0)))
|
||||
{
|
||||
*sb_value = ValueObjectRegister::Create (frame_sp.get(), reg_ctx, reg_idx);
|
||||
value_sp = ValueObjectRegister::Create (frame_sp.get(), reg_ctx, reg_idx);
|
||||
sb_value.SetSP (value_sp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -635,7 +642,9 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
|
|||
((reg_set->name && strcasecmp (reg_set->name, name) == 0) ||
|
||||
(reg_set->short_name && strcasecmp (reg_set->short_name, name) == 0)))
|
||||
{
|
||||
*sb_value = ValueObjectRegisterSet::Create (frame_sp.get(), reg_ctx, set_idx);
|
||||
value_sp = ValueObjectRegisterSet::Create (frame_sp.get(), reg_ctx, set_idx);
|
||||
sb_value.SetSP (value_sp);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -647,7 +656,10 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
|
|||
ConstString const_name(name);
|
||||
ClangExpressionVariableSP expr_var_sp (frame_sp->GetThread().GetProcess().GetTarget().GetPersistentVariables().GetVariable (const_name));
|
||||
if (expr_var_sp)
|
||||
*sb_value = expr_var_sp->GetValueObject();
|
||||
{
|
||||
value_sp = expr_var_sp->GetValueObject();
|
||||
sb_value.SetSP (value_sp);
|
||||
}
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -659,7 +671,7 @@ SBFrame::FindValue (const char *name, ValueType value_type, lldb::DynamicValueTy
|
|||
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf ("SBFrame(%p)::FindVariableInScope (name=\"%s\", value_type=%i) => SBValue(%p)",
|
||||
frame_sp.get(), name, value_type, sb_value.get());
|
||||
frame_sp.get(), name, value_type, value_sp.get());
|
||||
|
||||
|
||||
return sb_value;
|
||||
|
@ -885,6 +897,7 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
|
|||
|
||||
ExecutionResults exe_results;
|
||||
SBValue expr_result;
|
||||
ValueObjectSP expr_value_sp;
|
||||
|
||||
StackFrameSP frame_sp(GetFrameSP());
|
||||
if (log)
|
||||
|
@ -912,8 +925,8 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
|
|||
unwind_on_error,
|
||||
keep_in_memory,
|
||||
fetch_dynamic_value,
|
||||
*expr_result);
|
||||
|
||||
expr_value_sp);
|
||||
expr_result.SetSP(expr_value_sp);
|
||||
Host::SetCrashDescription (NULL);
|
||||
}
|
||||
|
||||
|
@ -925,7 +938,7 @@ SBFrame::EvaluateExpression (const char *expr, lldb::DynamicValueType fetch_dyna
|
|||
if (log)
|
||||
log->Printf ("SBFrame(%p)::EvaluateExpression (expr=\"%s\") => SBValue(%p) (execution result=%d)", frame_sp.get(),
|
||||
expr,
|
||||
expr_result.get(),
|
||||
expr_value_sp.get(),
|
||||
exe_results);
|
||||
|
||||
return expr_result;
|
||||
|
|
|
@ -947,7 +947,7 @@ SBTarget::GetWatchpointAtIndex (uint32_t idx) const
|
|||
if (target_sp)
|
||||
{
|
||||
// The watchpoint list is thread safe, no need to lock
|
||||
*sb_watchpoint = target_sp->GetWatchpointList().GetByIndex(idx);
|
||||
sb_watchpoint.SetSP (target_sp->GetWatchpointList().GetByIndex(idx));
|
||||
}
|
||||
return sb_watchpoint;
|
||||
}
|
||||
|
@ -979,17 +979,19 @@ SBTarget::FindWatchpointByID (lldb::watch_id_t wp_id)
|
|||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
SBWatchpoint sb_watchpoint;
|
||||
lldb::WatchpointSP watchpoint_sp;
|
||||
TargetSP target_sp(GetSP());
|
||||
if (target_sp && wp_id != LLDB_INVALID_WATCH_ID)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
*sb_watchpoint = target_sp->GetWatchpointList().FindByID(wp_id);
|
||||
watchpoint_sp = target_sp->GetWatchpointList().FindByID(wp_id);
|
||||
sb_watchpoint.SetSP (watchpoint_sp);
|
||||
}
|
||||
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("SBTarget(%p)::FindWatchpointByID (bp_id=%d) => SBWatchpoint(%p)",
|
||||
target_sp.get(), (uint32_t) wp_id, sb_watchpoint.get());
|
||||
target_sp.get(), (uint32_t) wp_id, watchpoint_sp.get());
|
||||
}
|
||||
|
||||
return sb_watchpoint;
|
||||
|
@ -1001,19 +1003,24 @@ SBTarget::WatchAddress (lldb::addr_t addr, size_t size, bool read, bool write)
|
|||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
SBWatchpoint sb_watchpoint;
|
||||
lldb::WatchpointSP watchpoint_sp;
|
||||
TargetSP target_sp(GetSP());
|
||||
if (target_sp)
|
||||
if (target_sp && (read || write) && addr != LLDB_INVALID_ADDRESS && size > 0)
|
||||
{
|
||||
Mutex::Locker api_locker (target_sp->GetAPIMutex());
|
||||
uint32_t watch_type = (read ? LLDB_WATCH_TYPE_READ : 0) |
|
||||
(write ? LLDB_WATCH_TYPE_WRITE : 0);
|
||||
sb_watchpoint = target_sp->CreateWatchpoint(addr, size, watch_type);
|
||||
uint32_t watch_type = 0;
|
||||
if (read)
|
||||
watch_type |= LLDB_WATCH_TYPE_READ;
|
||||
if (write)
|
||||
watch_type |= LLDB_WATCH_TYPE_WRITE;
|
||||
watchpoint_sp = target_sp->CreateWatchpoint(addr, size, watch_type);
|
||||
sb_watchpoint.SetSP (watchpoint_sp);
|
||||
}
|
||||
|
||||
if (log)
|
||||
{
|
||||
log->Printf ("SBTarget(%p)::WatchAddress (addr=0x%llx, 0x%u) => SBWatchpoint(%p)",
|
||||
target_sp.get(), addr, (uint32_t) size, sb_watchpoint.get());
|
||||
target_sp.get(), addr, (uint32_t) size, watchpoint_sp.get());
|
||||
}
|
||||
|
||||
return sb_watchpoint;
|
||||
|
|
|
@ -83,6 +83,13 @@ SBType::operator != (SBType &rhs)
|
|||
(rhs.m_opaque_sp->GetOpaqueQualType() != m_opaque_sp->GetOpaqueQualType());
|
||||
}
|
||||
|
||||
lldb::TypeImplSP
|
||||
SBType::GetSP ()
|
||||
{
|
||||
return m_opaque_sp;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
SBType::SetSP (const lldb::TypeImplSP &type_impl_sp)
|
||||
{
|
||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -110,10 +110,11 @@ SBValueList::operator*() const
|
|||
void
|
||||
SBValueList::Append (const SBValue &val_obj)
|
||||
{
|
||||
if (val_obj.get())
|
||||
ValueObjectSP value_sp (val_obj.GetSP());
|
||||
if (value_sp)
|
||||
{
|
||||
CreateIfNeeded ();
|
||||
m_opaque_ap->Append (*val_obj);
|
||||
m_opaque_ap->Append (value_sp);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -147,15 +148,19 @@ SBValueList::GetValueAtIndex (uint32_t idx) const
|
|||
// log->Printf ("SBValueList::GetValueAtIndex (uint32_t idx) idx = %d", idx);
|
||||
|
||||
SBValue sb_value;
|
||||
ValueObjectSP value_sp;
|
||||
if (m_opaque_ap.get())
|
||||
*sb_value = m_opaque_ap->GetValueObjectAtIndex (idx);
|
||||
{
|
||||
value_sp = m_opaque_ap->GetValueObjectAtIndex (idx);
|
||||
sb_value.SetSP (value_sp);
|
||||
}
|
||||
|
||||
if (log)
|
||||
{
|
||||
SBStream sstr;
|
||||
sb_value.GetDescription (sstr);
|
||||
log->Printf ("SBValueList::GetValueAtIndex (this.ap=%p, idx=%d) => SBValue (this.sp = %p, '%s')",
|
||||
m_opaque_ap.get(), idx, sb_value.get(), sstr.GetData());
|
||||
m_opaque_ap.get(), idx, value_sp.get(), sstr.GetData());
|
||||
}
|
||||
|
||||
return sb_value;
|
||||
|
@ -192,7 +197,7 @@ SBValueList::FindValueObjectByUID (lldb::user_id_t uid)
|
|||
{
|
||||
SBValue sb_value;
|
||||
if (m_opaque_ap.get())
|
||||
*sb_value = m_opaque_ap->FindValueObjectByUID (uid);
|
||||
sb_value.SetSP (m_opaque_ap->FindValueObjectByUID (uid));
|
||||
return sb_value;
|
||||
}
|
||||
|
||||
|
|
|
@ -69,15 +69,16 @@ SBWatchpoint::GetID ()
|
|||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
|
||||
watch_id_t watch_id = LLDB_INVALID_WATCH_ID;
|
||||
if (m_opaque_sp)
|
||||
watch_id = m_opaque_sp->GetID();
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
watch_id = watchpoint_sp->GetID();
|
||||
|
||||
if (log)
|
||||
{
|
||||
if (watch_id == LLDB_INVALID_WATCH_ID)
|
||||
log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", m_opaque_sp.get());
|
||||
log->Printf ("SBWatchpoint(%p)::GetID () => LLDB_INVALID_WATCH_ID", watchpoint_sp.get());
|
||||
else
|
||||
log->Printf ("SBWatchpoint(%p)::GetID () => %u", m_opaque_sp.get(), watch_id);
|
||||
log->Printf ("SBWatchpoint(%p)::GetID () => %u", watchpoint_sp.get(), watch_id);
|
||||
}
|
||||
|
||||
return watch_id;
|
||||
|
@ -86,7 +87,8 @@ SBWatchpoint::GetID ()
|
|||
bool
|
||||
SBWatchpoint::IsValid() const
|
||||
{
|
||||
if (m_opaque_sp && m_opaque_sp->GetError().Success())
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp && watchpoint_sp->GetError().Success())
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
@ -95,9 +97,10 @@ SBError
|
|||
SBWatchpoint::GetError ()
|
||||
{
|
||||
SBError sb_error;
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
sb_error.SetError(m_opaque_sp->GetError());
|
||||
sb_error.SetError(watchpoint_sp->GetError());
|
||||
}
|
||||
return sb_error;
|
||||
}
|
||||
|
@ -107,10 +110,11 @@ SBWatchpoint::GetHardwareIndex ()
|
|||
{
|
||||
int32_t hw_index = -1;
|
||||
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
hw_index = m_opaque_sp->GetHardwareIndex();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
hw_index = watchpoint_sp->GetHardwareIndex();
|
||||
}
|
||||
|
||||
return hw_index;
|
||||
|
@ -121,10 +125,11 @@ SBWatchpoint::GetWatchAddress ()
|
|||
{
|
||||
addr_t ret_addr = LLDB_INVALID_ADDRESS;
|
||||
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
ret_addr = m_opaque_sp->GetLoadAddress();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
ret_addr = watchpoint_sp->GetLoadAddress();
|
||||
}
|
||||
|
||||
return ret_addr;
|
||||
|
@ -135,10 +140,11 @@ SBWatchpoint::GetWatchSize ()
|
|||
{
|
||||
size_t watch_size = 0;
|
||||
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
watch_size = m_opaque_sp->GetByteSize();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
watch_size = watchpoint_sp->GetByteSize();
|
||||
}
|
||||
|
||||
return watch_size;
|
||||
|
@ -147,20 +153,22 @@ SBWatchpoint::GetWatchSize ()
|
|||
void
|
||||
SBWatchpoint::SetEnabled (bool enabled)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
m_opaque_sp->GetTarget().DisableWatchpointByID(m_opaque_sp->GetID());
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
watchpoint_sp->GetTarget().DisableWatchpointByID(watchpoint_sp->GetID());
|
||||
}
|
||||
}
|
||||
|
||||
bool
|
||||
SBWatchpoint::IsEnabled ()
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
return m_opaque_sp->IsEnabled();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
return watchpoint_sp->IsEnabled();
|
||||
}
|
||||
else
|
||||
return false;
|
||||
|
@ -170,15 +178,16 @@ uint32_t
|
|||
SBWatchpoint::GetHitCount ()
|
||||
{
|
||||
uint32_t count = 0;
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
count = m_opaque_sp->GetHitCount();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
count = watchpoint_sp->GetHitCount();
|
||||
}
|
||||
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_API));
|
||||
if (log)
|
||||
log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", m_opaque_sp.get(), count);
|
||||
log->Printf ("SBWatchpoint(%p)::GetHitCount () => %u", watchpoint_sp.get(), count);
|
||||
|
||||
return count;
|
||||
}
|
||||
|
@ -186,10 +195,11 @@ SBWatchpoint::GetHitCount ()
|
|||
uint32_t
|
||||
SBWatchpoint::GetIgnoreCount ()
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
return m_opaque_sp->GetIgnoreCount();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
return watchpoint_sp->GetIgnoreCount();
|
||||
}
|
||||
else
|
||||
return 0;
|
||||
|
@ -198,20 +208,22 @@ SBWatchpoint::GetIgnoreCount ()
|
|||
void
|
||||
SBWatchpoint::SetIgnoreCount (uint32_t n)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
m_opaque_sp->SetIgnoreCount (n);
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
watchpoint_sp->SetIgnoreCount (n);
|
||||
}
|
||||
}
|
||||
|
||||
const char *
|
||||
SBWatchpoint::GetCondition ()
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
return m_opaque_sp->GetConditionText ();
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
return watchpoint_sp->GetConditionText ();
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -219,10 +231,11 @@ SBWatchpoint::GetCondition ()
|
|||
void
|
||||
SBWatchpoint::SetCondition (const char *condition)
|
||||
{
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
m_opaque_sp->SetCondition (condition);
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
watchpoint_sp->SetCondition (condition);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -231,10 +244,11 @@ SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
|
|||
{
|
||||
Stream &strm = description.ref();
|
||||
|
||||
if (m_opaque_sp)
|
||||
lldb::WatchpointSP watchpoint_sp(GetSP());
|
||||
if (watchpoint_sp)
|
||||
{
|
||||
Mutex::Locker api_locker (m_opaque_sp->GetTarget().GetAPIMutex());
|
||||
m_opaque_sp->GetDescription (&strm, level);
|
||||
Mutex::Locker api_locker (watchpoint_sp->GetTarget().GetAPIMutex());
|
||||
watchpoint_sp->GetDescription (&strm, level);
|
||||
strm.EOL();
|
||||
}
|
||||
else
|
||||
|
@ -243,20 +257,20 @@ SBWatchpoint::GetDescription (SBStream &description, DescriptionLevel level)
|
|||
return true;
|
||||
}
|
||||
|
||||
lldb_private::Watchpoint *
|
||||
SBWatchpoint::operator->()
|
||||
void
|
||||
SBWatchpoint::Clear ()
|
||||
{
|
||||
return m_opaque_sp.get();
|
||||
m_opaque_sp.reset();
|
||||
}
|
||||
|
||||
lldb_private::Watchpoint *
|
||||
SBWatchpoint::get()
|
||||
{
|
||||
return m_opaque_sp.get();
|
||||
}
|
||||
|
||||
lldb::WatchpointSP &
|
||||
SBWatchpoint::operator *()
|
||||
lldb::WatchpointSP
|
||||
SBWatchpoint::GetSP () const
|
||||
{
|
||||
return m_opaque_sp;
|
||||
}
|
||||
|
||||
void
|
||||
SBWatchpoint::SetSP (const lldb::WatchpointSP &sp)
|
||||
{
|
||||
m_opaque_sp = sp;
|
||||
}
|
||||
|
|
|
@ -1551,6 +1551,13 @@ ValueObject::SetValueFromCString (const char *value_str)
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
ValueObject::GetDeclaration (Declaration &decl)
|
||||
{
|
||||
decl.Clear();
|
||||
return false;
|
||||
}
|
||||
|
||||
LanguageType
|
||||
ValueObject::GetObjectRuntimeLanguage ()
|
||||
{
|
||||
|
@ -3432,8 +3439,7 @@ ValueObject::AddressOf (Error &error)
|
|||
ValueObjectSP
|
||||
ValueObject::Cast (const ClangASTType &clang_ast_type)
|
||||
{
|
||||
ValueObjectSP valobj_sp(new ValueObjectCast (*this, GetName(), clang_ast_type));
|
||||
return valobj_sp;
|
||||
return ValueObjectCast::Create (*this, GetName(), clang_ast_type);
|
||||
}
|
||||
|
||||
ValueObjectSP
|
||||
|
|
|
@ -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
|
||||
(
|
||||
|
|
|
@ -276,3 +276,14 @@ ValueObjectVariable::GetSymbolContextScope()
|
|||
return m_variable_sp->GetSymbolContextScope();
|
||||
return NULL;
|
||||
}
|
||||
|
||||
bool
|
||||
ValueObjectVariable::GetDeclaration (Declaration &decl)
|
||||
{
|
||||
if (m_variable_sp)
|
||||
{
|
||||
decl = m_variable_sp->GetDeclaration();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -182,10 +182,9 @@ ClangASTType::GetArrayElementType (clang::ASTContext* ast,
|
|||
}
|
||||
|
||||
lldb::clang_type_t
|
||||
ClangASTType::GetPointerType ()
|
||||
ClangASTType::GetPointerType () const
|
||||
{
|
||||
return GetPointerType (m_ast,
|
||||
m_type);
|
||||
return GetPointerType (m_ast, m_type);
|
||||
}
|
||||
|
||||
lldb::clang_type_t
|
||||
|
|
|
@ -94,7 +94,7 @@ class BasicExprCommandsTestCase(TestBase):
|
|||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
# Verify the breakpoint just created.
|
||||
self.expect(repr(breakpoint), BREAKPOINT_CREATED, exe=False,
|
||||
self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
|
||||
substrs = ['main.cpp',
|
||||
str(self.line)])
|
||||
|
||||
|
|
|
@ -101,7 +101,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
# Sanity check the print representation of breakpoint.
|
||||
bp = repr(breakpoint)
|
||||
bp = str(breakpoint)
|
||||
self.expect(bp, msg="Breakpoint looks good", exe=False,
|
||||
substrs = ["file ='main.c'",
|
||||
"line = %d" % self.line,
|
||||
|
@ -114,7 +114,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
self.assertTrue(process, PROCESS_IS_VALID)
|
||||
|
||||
# Sanity check the print representation of process.
|
||||
proc = repr(process)
|
||||
proc = str(process)
|
||||
self.expect(proc, msg="Process looks good", exe=False,
|
||||
substrs = ["state = stopped",
|
||||
"executable = a.out"])
|
||||
|
@ -127,7 +127,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
stop_reason_to_str(thread.GetStopReason()))
|
||||
|
||||
# Sanity check the print representation of thread.
|
||||
thr = repr(thread)
|
||||
thr = str(thread)
|
||||
self.expect(thr, "Thread looks good with stop reason = breakpoint", exe=False,
|
||||
substrs = ["tid = 0x%4.4x" % thread.GetThreadID()])
|
||||
|
||||
|
@ -135,7 +135,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
self.assertTrue(breakpoint.GetHitCount() == 1, BREAKPOINT_HIT_ONCE)
|
||||
|
||||
# The breakpoint should be resolved by now.
|
||||
bp = repr(breakpoint)
|
||||
bp = str(breakpoint)
|
||||
self.expect(bp, "Breakpoint looks good and is resolved", exe=False,
|
||||
substrs = ["file ='main.c'",
|
||||
"line = %d" % self.line,
|
||||
|
@ -143,7 +143,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
|
||||
# Sanity check the print representation of frame.
|
||||
frame = thread.GetFrameAtIndex(0)
|
||||
frm = repr(frame)
|
||||
frm = str(frame)
|
||||
self.expect(frm,
|
||||
"Frame looks good with correct index %d" % frame.GetFrameID(),
|
||||
exe=False,
|
||||
|
@ -152,7 +152,7 @@ class ArrayTypesTestCase(TestBase):
|
|||
# Lookup the "strings" string array variable and sanity check its print
|
||||
# representation.
|
||||
variable = frame.FindVariable("strings")
|
||||
var = repr(variable)
|
||||
var = str(variable)
|
||||
self.expect(var, "Variable for 'strings' looks good with correct name", exe=False,
|
||||
substrs = ["%s" % variable.GetName()])
|
||||
self.DebugSBValue(variable)
|
||||
|
|
|
@ -114,7 +114,7 @@ class ClassTypesTestCase(TestBase):
|
|||
self.assertTrue(breakpoint, VALID_BREAKPOINT)
|
||||
|
||||
# Verify the breakpoint just created.
|
||||
self.expect(repr(breakpoint), BREAKPOINT_CREATED, exe=False,
|
||||
self.expect(str(breakpoint), BREAKPOINT_CREATED, exe=False,
|
||||
substrs = ['main.cpp',
|
||||
str(self.line)])
|
||||
|
||||
|
|
|
@ -43,7 +43,7 @@ class StdCXXDisassembleTestCase(TestBase):
|
|||
process = target.GetProcess()
|
||||
|
||||
# The process should be in a 'stopped' state.
|
||||
self.expect(repr(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
|
||||
self.expect(str(process), STOPPED_DUE_TO_BREAKPOINT, exe=False,
|
||||
substrs = ["a.out",
|
||||
"stopped"])
|
||||
|
||||
|
@ -61,7 +61,7 @@ class StdCXXDisassembleTestCase(TestBase):
|
|||
module = target.GetModuleAtIndex(i)
|
||||
fs = module.GetFileSpec()
|
||||
if (fs.GetFilename().startswith("libstdc++")):
|
||||
lib_stdcxx = repr(fs)
|
||||
lib_stdcxx = str(fs)
|
||||
break
|
||||
|
||||
# At this point, lib_stdcxx is the full path to the stdc++ library and
|
||||
|
@ -70,7 +70,7 @@ class StdCXXDisassembleTestCase(TestBase):
|
|||
self.expect(fs.GetFilename(), "Libraray StdC++ is located", exe=False,
|
||||
substrs = ["libstdc++"])
|
||||
|
||||
self.runCmd("image dump symtab %s" % repr(fs))
|
||||
self.runCmd("image dump symtab %s" % str(fs))
|
||||
raw_output = self.res.GetOutput()
|
||||
# Now, look for every 'Code' symbol and feed its load address into the
|
||||
# command: 'disassemble -s load_address -e end_address', where the
|
||||
|
|
|
@ -459,7 +459,7 @@ def print_stacktraces(process, string_buffer = False):
|
|||
|
||||
output = StringIO.StringIO() if string_buffer else sys.stdout
|
||||
|
||||
print >> output, "Stack traces for " + repr(process)
|
||||
print >> output, "Stack traces for " + str(process)
|
||||
|
||||
for thread in process:
|
||||
print >> output, print_stacktrace(thread, string_buffer=True)
|
||||
|
@ -516,7 +516,7 @@ def print_registers(frame, string_buffer = False):
|
|||
|
||||
output = StringIO.StringIO() if string_buffer else sys.stdout
|
||||
|
||||
print >> output, "Register sets for " + repr(frame)
|
||||
print >> output, "Register sets for " + str(frame)
|
||||
|
||||
registerSet = frame.GetRegisters() # Return type of SBValueList.
|
||||
print >> output, "Frame registers (size of register set = %d):" % registerSet.GetSize()
|
||||
|
|
|
@ -43,7 +43,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
|||
# Get the executable module at index 0.
|
||||
exe_module = target.GetModuleAtIndex(0)
|
||||
|
||||
print "Exe module: %s" % repr(exe_module)
|
||||
print "Exe module: %s" % str(exe_module)
|
||||
print "Number of sections: %d" % exe_module.GetNumSections()
|
||||
INDENT = ' ' * 4
|
||||
INDENT2 = INDENT * 2
|
||||
|
@ -52,14 +52,14 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
|||
print INDENT + "Number of subsections: %d" % sec.GetNumSubSections()
|
||||
if sec.GetNumSubSections() == 0:
|
||||
for sym in exe_module.symbol_in_section_iter(sec):
|
||||
print INDENT + repr(sym)
|
||||
print INDENT + str(sym)
|
||||
print INDENT + "symbol type: %s" % symbol_type_to_str(sym.GetType())
|
||||
else:
|
||||
for subsec in sec:
|
||||
print INDENT + repr(subsec)
|
||||
print INDENT + str(subsec)
|
||||
# Now print the symbols belonging to the subsection....
|
||||
for sym in exe_module.symbol_in_section_iter(subsec):
|
||||
print INDENT2 + repr(sym)
|
||||
print INDENT2 + str(sym)
|
||||
print INDENT2 + "symbol type: %s" % symbol_type_to_str(sym.GetType())
|
||||
|
||||
def module_and_section_boundary_condition(self):
|
||||
|
@ -80,7 +80,7 @@ class ModuleAndSectionAPIsTestCase(TestBase):
|
|||
# Get the executable module at index 0.
|
||||
exe_module = target.GetModuleAtIndex(0)
|
||||
|
||||
print "Exe module: %s" % repr(exe_module)
|
||||
print "Exe module: %s" % str(exe_module)
|
||||
print "Number of sections: %d" % exe_module.GetNumSections()
|
||||
|
||||
# Boundary condition testings. Should not crash lldb!
|
||||
|
|
|
@ -53,9 +53,9 @@ class SBDataAPICase(TestBase):
|
|||
thread = process.GetThreadAtIndex(0)
|
||||
|
||||
frame = thread.GetSelectedFrame()
|
||||
|
||||
print frame
|
||||
foobar = frame.FindVariable('foobar')
|
||||
|
||||
self.assertTrue(foobar.IsValid())
|
||||
if self.TraceOn():
|
||||
print foobar
|
||||
|
||||
|
@ -98,6 +98,7 @@ class SBDataAPICase(TestBase):
|
|||
self.assertTrue(data.GetUnsignedInt32(error, offset) == 0, 'do not read beyond end')
|
||||
|
||||
star_foobar = foobar.Dereference()
|
||||
self.assertTrue(star_foobar.IsValid())
|
||||
|
||||
data = star_foobar.GetData()
|
||||
|
||||
|
@ -118,7 +119,7 @@ class SBDataAPICase(TestBase):
|
|||
nothing = foobar.CreateValueFromAddress("nothing", foobar_addr, star_foobar.GetType().GetBasicType(lldb.eBasicTypeInvalid))
|
||||
|
||||
new_foobar = foobar.CreateValueFromAddress("f00", foobar_addr, star_foobar.GetType())
|
||||
|
||||
self.assertTrue(new_foobar.IsValid())
|
||||
if self.TraceOn():
|
||||
print new_foobar
|
||||
|
||||
|
|
|
@ -68,7 +68,7 @@ class SymbolContextAPITestCase(TestBase):
|
|||
substrs = [os.path.join(self.mydir, 'a.out')])
|
||||
|
||||
compileUnit = context.GetCompileUnit()
|
||||
self.expect(repr(compileUnit), "The compile unit should match", exe=False,
|
||||
self.expect(str(compileUnit), "The compile unit should match", exe=False,
|
||||
substrs = [os.path.join(self.mydir, 'main.c')])
|
||||
|
||||
function = context.GetFunction()
|
||||
|
|
Loading…
Reference in New Issue