forked from OSchip/llvm-project
Convert lldb::ModuleSP to use an instrusive ref counted pointer.
We had some cases where getting the shared pointer for a module from the global module list was causing a performance issue when debugging with DWARF in .o files. Now that the module uses intrusive ref counts, we can easily convert any pointer to a shared pointer. llvm-svn: 139983
This commit is contained in:
parent
5631ebce5e
commit
747bcb03d2
lldb
include/lldb
lldb.xcodeproj/xcshareddata/xcschemes
source
Commands
Core
Expression
Plugins/LanguageRuntime/ObjC/AppleObjCRuntime
AppleObjCRuntime.hAppleObjCRuntimeV1.hAppleObjCRuntimeV2.cppAppleObjCRuntimeV2.hAppleObjCTrampolineHandler.cppAppleObjCTrampolineHandler.hAppleThreadPlanStepThroughObjCTrampoline.cppAppleThreadPlanStepThroughObjCTrampoline.h
Symbol
Utility
tools/debugserver/source/MacOSX
|
@ -44,6 +44,7 @@
|
|||
namespace lldb_private {
|
||||
|
||||
class Module :
|
||||
public ReferenceCountedBaseVirtual<Module>,
|
||||
public SymbolContextScope
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -97,6 +97,7 @@ public:
|
|||
LineEntry *line_entry = NULL,
|
||||
Symbol *symbol = NULL);
|
||||
|
||||
~SymbolContext ();
|
||||
//------------------------------------------------------------------
|
||||
/// Copy constructor
|
||||
///
|
||||
|
@ -294,13 +295,9 @@ public:
|
|||
} SpecificationType;
|
||||
|
||||
// This one produces a specifier that matches everything...
|
||||
SymbolContextSpecifier (lldb::TargetSP target_sp) :
|
||||
m_start_line(0),
|
||||
m_end_line(0)
|
||||
{
|
||||
m_target_sp = target_sp;
|
||||
m_type = eNothingSpecified;
|
||||
}
|
||||
SymbolContextSpecifier (const lldb::TargetSP& target_sp);
|
||||
|
||||
~SymbolContextSpecifier();
|
||||
|
||||
bool
|
||||
AddSpecification (const char *spec_string, SpecificationType type);
|
||||
|
|
|
@ -531,7 +531,282 @@ public:
|
|||
baton_ = 0;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
template <class T>
|
||||
class IntrusiveSharingPtr;
|
||||
|
||||
} // namespace lldb
|
||||
template <class T>
|
||||
class ReferenceCountedBase
|
||||
{
|
||||
public:
|
||||
explicit ReferenceCountedBase(long refs = 0)
|
||||
: shared_owners_(refs)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
add_shared()
|
||||
{
|
||||
__sync_add_and_fetch(&shared_owners_, 1);
|
||||
}
|
||||
void
|
||||
release_shared()
|
||||
{
|
||||
if (__sync_add_and_fetch(&shared_owners_, -1) == -1)
|
||||
delete static_cast<T*>(this);
|
||||
}
|
||||
|
||||
long
|
||||
use_count() const
|
||||
{
|
||||
return shared_owners_ + 1;
|
||||
}
|
||||
|
||||
protected:
|
||||
long shared_owners_;
|
||||
|
||||
friend class IntrusiveSharingPtr<T>;
|
||||
|
||||
private:
|
||||
ReferenceCountedBase(const ReferenceCountedBase&);
|
||||
ReferenceCountedBase& operator=(const ReferenceCountedBase&);
|
||||
};
|
||||
|
||||
|
||||
//template <class T>
|
||||
//class ReferenceCountedBaseVirtual
|
||||
//{
|
||||
//public:
|
||||
// explicit ReferenceCountedBaseVirtual(long refs = 0) :
|
||||
// shared_owners_(refs)
|
||||
// {
|
||||
// }
|
||||
//
|
||||
// void
|
||||
// add_shared();
|
||||
//
|
||||
// void
|
||||
// release_shared();
|
||||
//
|
||||
// long
|
||||
// use_count() const
|
||||
// {
|
||||
// return shared_owners_ + 1;
|
||||
// }
|
||||
//
|
||||
//protected:
|
||||
// long shared_owners_;
|
||||
//
|
||||
// virtual ~ReferenceCountedBaseVirtual() {}
|
||||
//
|
||||
// friend class IntrusiveSharingPtr<T>;
|
||||
//
|
||||
//private:
|
||||
// ReferenceCountedBaseVirtual(const ReferenceCountedBaseVirtual&);
|
||||
// ReferenceCountedBaseVirtual& operator=(const ReferenceCountedBaseVirtual&);
|
||||
//};
|
||||
//
|
||||
//template <class T>
|
||||
//void
|
||||
//ReferenceCountedBaseVirtual<T>::add_shared()
|
||||
//{
|
||||
// __sync_add_and_fetch(&shared_owners_, 1);
|
||||
//}
|
||||
//
|
||||
//template <class T>
|
||||
//void
|
||||
//ReferenceCountedBaseVirtual<T>::release_shared()
|
||||
//{
|
||||
// if (__sync_add_and_fetch(&shared_owners_, -1) == -1)
|
||||
// delete this;
|
||||
//}
|
||||
|
||||
|
||||
template <class T>
|
||||
class ReferenceCountedBaseVirtual : public imp::shared_count
|
||||
{
|
||||
public:
|
||||
explicit ReferenceCountedBaseVirtual () :
|
||||
imp::shared_count(-1)
|
||||
{
|
||||
}
|
||||
|
||||
virtual
|
||||
~ReferenceCountedBaseVirtual ()
|
||||
{
|
||||
}
|
||||
|
||||
virtual void on_zero_shared ();
|
||||
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
ReferenceCountedBaseVirtual<T>::on_zero_shared()
|
||||
{
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
class IntrusiveSharingPtr
|
||||
{
|
||||
public:
|
||||
typedef T element_type;
|
||||
|
||||
explicit
|
||||
IntrusiveSharingPtr () :
|
||||
ptr_(0)
|
||||
{
|
||||
}
|
||||
|
||||
explicit
|
||||
IntrusiveSharingPtr (T* ptr) :
|
||||
ptr_(ptr)
|
||||
{
|
||||
add_shared();
|
||||
}
|
||||
|
||||
IntrusiveSharingPtr (const IntrusiveSharingPtr& rhs) :
|
||||
ptr_(rhs.ptr_)
|
||||
{
|
||||
add_shared();
|
||||
}
|
||||
|
||||
template <class X>
|
||||
IntrusiveSharingPtr (const IntrusiveSharingPtr<X>& rhs)
|
||||
: ptr_(rhs.get())
|
||||
{
|
||||
add_shared();
|
||||
}
|
||||
|
||||
IntrusiveSharingPtr&
|
||||
operator= (const IntrusiveSharingPtr& rhs)
|
||||
{
|
||||
reset(rhs.get());
|
||||
return *this;
|
||||
}
|
||||
|
||||
template <class X> IntrusiveSharingPtr&
|
||||
operator= (const IntrusiveSharingPtr<X>& rhs)
|
||||
{
|
||||
reset(rhs.get());
|
||||
return *this;
|
||||
}
|
||||
|
||||
IntrusiveSharingPtr&
|
||||
operator= (T *ptr)
|
||||
{
|
||||
reset(ptr);
|
||||
return *this;
|
||||
}
|
||||
|
||||
~IntrusiveSharingPtr()
|
||||
{
|
||||
release_shared();
|
||||
}
|
||||
|
||||
T&
|
||||
operator*() const
|
||||
{
|
||||
return *ptr_;
|
||||
}
|
||||
|
||||
T*
|
||||
operator->() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
T*
|
||||
get() const
|
||||
{
|
||||
return ptr_;
|
||||
}
|
||||
|
||||
operator bool() const
|
||||
{
|
||||
return ptr_ != 0;
|
||||
}
|
||||
|
||||
void
|
||||
swap (IntrusiveSharingPtr& rhs)
|
||||
{
|
||||
std::swap(ptr_, rhs.ptr_);
|
||||
}
|
||||
|
||||
void
|
||||
reset(T* ptr = NULL)
|
||||
{
|
||||
IntrusiveSharingPtr(ptr).swap(*this);
|
||||
}
|
||||
|
||||
long
|
||||
use_count () const
|
||||
{
|
||||
if (ptr_)
|
||||
return ptr_->use_count();
|
||||
return 0;
|
||||
}
|
||||
|
||||
bool
|
||||
unique () const
|
||||
{
|
||||
return use_count () == 1;
|
||||
}
|
||||
|
||||
private:
|
||||
element_type *ptr_;
|
||||
|
||||
void
|
||||
add_shared()
|
||||
{
|
||||
if (ptr_)
|
||||
ptr_->add_shared();
|
||||
}
|
||||
void
|
||||
release_shared()
|
||||
{
|
||||
if (ptr_)
|
||||
ptr_->release_shared();
|
||||
}
|
||||
};
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator== (const IntrusiveSharingPtr<T>& lhs, const IntrusiveSharingPtr<U>& rhs)
|
||||
{
|
||||
return lhs.get() == rhs.get();
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator!= (const IntrusiveSharingPtr<T>& lhs, const IntrusiveSharingPtr<U>& rhs)
|
||||
{
|
||||
return lhs.get() != rhs.get();
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator== (const IntrusiveSharingPtr<T>& lhs, U* rhs)
|
||||
{
|
||||
return lhs.get() == rhs;
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator!= (const IntrusiveSharingPtr<T>& lhs, U* rhs)
|
||||
{
|
||||
return lhs.get() != rhs;
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator== (T* lhs, const IntrusiveSharingPtr<U>& rhs)
|
||||
{
|
||||
return lhs == rhs.get();
|
||||
}
|
||||
|
||||
template<class T, class U>
|
||||
inline bool operator!= (T* lhs, const IntrusiveSharingPtr<U>& rhs)
|
||||
{
|
||||
return lhs != rhs.get();
|
||||
}
|
||||
|
||||
} // namespace lldb_private
|
||||
|
||||
#endif // utility_SharingPtr_h_
|
||||
|
|
|
@ -50,7 +50,7 @@ namespace lldb {
|
|||
typedef SharedPtr<lldb_private::Listener>::Type ListenerSP;
|
||||
typedef SharedPtr<lldb_private::Log>::Type LogSP;
|
||||
typedef SharedPtr<lldb_private::LogChannel>::Type LogChannelSP;
|
||||
typedef SharedPtr<lldb_private::Module>::Type ModuleSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::Module>::Type ModuleSP;
|
||||
typedef SharedPtr<lldb_private::OptionValue>::Type OptionValueSP;
|
||||
typedef SharedPtr<lldb_private::Platform>::Type PlatformSP;
|
||||
typedef SharedPtr<lldb_private::Process>::Type ProcessSP;
|
||||
|
|
|
@ -48,8 +48,10 @@ class ClangExpressionVariable;
|
|||
class ClangExpressionVariableList;
|
||||
class ClangExpressionVariableList;
|
||||
class ClangExpressionVariables;
|
||||
class ClangFunction;
|
||||
class ClangPersistentVariables;
|
||||
class ClangUserExpression;
|
||||
class ClangUtilityFunction;
|
||||
class CommandInterpreter;
|
||||
class CommandObject;
|
||||
class CommandReturnObject;
|
||||
|
|
|
@ -69,6 +69,12 @@ namespace lldb {
|
|||
{
|
||||
typedef lldb_private::LoggingSharingPtr<_Tp> Type;
|
||||
};
|
||||
|
||||
template <typename _Tp>
|
||||
struct IntrusiveSharedPtr
|
||||
{
|
||||
typedef lldb_private::IntrusiveSharingPtr<_Tp> Type;
|
||||
};
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
|
|
|
@ -99,6 +99,12 @@
|
|||
ReferencedContainer = "container:lldb.xcodeproj">
|
||||
</BuildableReference>
|
||||
</BuildableProductRunnable>
|
||||
<CommandLineArguments>
|
||||
<CommandLineArgument
|
||||
argument = "/Volumes/work/gclayton/Documents/src/args/a.out"
|
||||
isEnabled = "YES">
|
||||
</CommandLineArgument>
|
||||
</CommandLineArguments>
|
||||
<EnvironmentVariables>
|
||||
<EnvironmentVariable
|
||||
key = "LLDB_LAUNCH_FLAG_DISABLE_ASLR"
|
||||
|
|
|
@ -684,7 +684,7 @@ CommandCompletions::ModuleCompleter::SearchCallback (
|
|||
bool complete
|
||||
)
|
||||
{
|
||||
if (context.module_sp != NULL)
|
||||
if (context.module_sp)
|
||||
{
|
||||
const char *cur_file_name = context.module_sp->GetFileSpec().GetFilename().GetCString();
|
||||
const char *cur_dir_name = context.module_sp->GetFileSpec().GetDirectory().GetCString();
|
||||
|
|
|
@ -131,7 +131,8 @@ Module::~Module()
|
|||
ModuleSP
|
||||
Module::GetSP () const
|
||||
{
|
||||
return ModuleList::GetModuleSP (this);
|
||||
ModuleSP module_sp(const_cast<Module*>(this));
|
||||
return module_sp;
|
||||
}
|
||||
|
||||
const lldb_private::UUID&
|
||||
|
|
|
@ -10,6 +10,7 @@
|
|||
|
||||
#include "clang/AST/ASTContext.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Expression/ClangASTSource.h"
|
||||
#include "lldb/Expression/ClangExpression.h"
|
||||
#include "lldb/Expression/ClangExpressionDeclMap.h"
|
||||
|
|
|
@ -98,7 +98,7 @@ protected:
|
|||
AppleIsModuleObjCLibrary (const lldb::ModuleSP &module_sp);
|
||||
|
||||
static enum ObjCRuntimeVersions
|
||||
GetObjCVersion (Process *process, ModuleSP &objc_module_sp);
|
||||
GetObjCVersion (Process *process, lldb::ModuleSP &objc_module_sp);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
// PluginInterface protocol
|
||||
|
|
|
@ -15,12 +15,8 @@
|
|||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Target/LanguageRuntime.h"
|
||||
#include "lldb/Target/ObjCLanguageRuntime.h"
|
||||
#include "lldb/Core/ValueObject.h"
|
||||
#include "AppleObjCRuntime.h"
|
||||
#include "AppleObjCTrampolineHandler.h"
|
||||
#include "AppleThreadPlanStepThroughObjCTrampoline.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
|
|
@ -91,8 +91,9 @@ extern \"C\" void *__lldb_apple_objc_v2_find_class_name (
|
|||
const char *AppleObjCRuntimeV2::g_objc_class_symbol_prefix = "OBJC_CLASS_$_";
|
||||
const char *AppleObjCRuntimeV2::g_objc_class_data_section_name = "__objc_data";
|
||||
|
||||
AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process, ModuleSP &objc_module_sp) :
|
||||
lldb_private::AppleObjCRuntime (process),
|
||||
AppleObjCRuntimeV2::AppleObjCRuntimeV2 (Process *process,
|
||||
const ModuleSP &objc_module_sp) :
|
||||
AppleObjCRuntime (process),
|
||||
m_get_class_name_args(LLDB_INVALID_ADDRESS),
|
||||
m_get_class_name_args_mutex(Mutex::eMutexTypeNormal),
|
||||
m_isa_to_name_cache(),
|
||||
|
@ -109,7 +110,7 @@ AppleObjCRuntimeV2::RunFunctionToFindClassName(lldb::addr_t object_addr, Thread
|
|||
|
||||
StreamString errors;
|
||||
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); // FIXME - a more appropriate log channel?
|
||||
LogSP log(GetLogIfAllCategoriesSet (LIBLLDB_LOG_STEP)); // FIXME - a more appropriate log channel?
|
||||
|
||||
int32_t debug;
|
||||
if (log)
|
||||
|
@ -417,7 +418,7 @@ AppleObjCRuntimeV2::GetDynamicTypeAndAddress (ValueObject &in_value,
|
|||
//------------------------------------------------------------------
|
||||
// Static Functions
|
||||
//------------------------------------------------------------------
|
||||
lldb_private::LanguageRuntime *
|
||||
LanguageRuntime *
|
||||
AppleObjCRuntimeV2::CreateInstance (Process *process, lldb::LanguageType language)
|
||||
{
|
||||
// FIXME: This should be a MacOS or iOS process, and we need to look for the OBJC section to make
|
||||
|
@ -581,7 +582,7 @@ AppleObjCRuntimeV2::IsTaggedPointer(lldb::addr_t ptr)
|
|||
// this code relies on the assumption that an Objective-C object always starts
|
||||
// with an ISA at offset 0. an ISA is effectively a pointer to an instance of
|
||||
// struct class_t in the ObjCv2 runtime
|
||||
lldb_private::ObjCLanguageRuntime::ObjCISA
|
||||
ObjCLanguageRuntime::ObjCISA
|
||||
AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
|
||||
{
|
||||
if (ClangASTType::GetMinimumLanguage(valobj.GetClangAST(),valobj.GetClangType()) != lldb::eLanguageTypeObjC)
|
||||
|
@ -602,7 +603,7 @@ AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
|
|||
uint8_t pointer_size = valobj.GetUpdatePoint().GetProcessSP()->GetAddressByteSize();
|
||||
|
||||
Error error;
|
||||
lldb_private::ObjCLanguageRuntime::ObjCISA isa =
|
||||
ObjCLanguageRuntime::ObjCISA isa =
|
||||
valobj.GetUpdatePoint().GetProcessSP()->ReadUnsignedIntegerFromMemory(isa_pointer,
|
||||
pointer_size,
|
||||
0,
|
||||
|
@ -613,7 +614,7 @@ AppleObjCRuntimeV2::GetISA(ValueObject& valobj)
|
|||
// TODO: should we have a transparent_kvo parameter here to say if we
|
||||
// want to replace the KVO swizzled class with the actual user-level type?
|
||||
ConstString
|
||||
AppleObjCRuntimeV2::GetActualTypeName(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
|
||||
AppleObjCRuntimeV2::GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa)
|
||||
{
|
||||
if (!IsValidISA(isa))
|
||||
return ConstString(NULL);
|
||||
|
@ -713,8 +714,8 @@ AppleObjCRuntimeV2::GetActualTypeName(lldb_private::ObjCLanguageRuntime::ObjCISA
|
|||
return ConstString("unknown");
|
||||
}
|
||||
|
||||
lldb_private::ObjCLanguageRuntime::ObjCISA
|
||||
AppleObjCRuntimeV2::GetParentClass(lldb_private::ObjCLanguageRuntime::ObjCISA isa)
|
||||
ObjCLanguageRuntime::ObjCISA
|
||||
AppleObjCRuntimeV2::GetParentClass(ObjCLanguageRuntime::ObjCISA isa)
|
||||
{
|
||||
if (!IsValidISA(isa))
|
||||
return 0;
|
||||
|
|
|
@ -18,12 +18,8 @@
|
|||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/lldb-private.h"
|
||||
#include "lldb/Target/LanguageRuntime.h"
|
||||
#include "lldb/Target/ObjCLanguageRuntime.h"
|
||||
#include "lldb/Core/ValueObject.h"
|
||||
#include "AppleObjCRuntime.h"
|
||||
#include "AppleObjCTrampolineHandler.h"
|
||||
#include "AppleThreadPlanStepThroughObjCTrampoline.h"
|
||||
|
||||
namespace lldb_private {
|
||||
|
||||
|
@ -81,7 +77,7 @@ public:
|
|||
GetByteOffsetForIvar (ClangASTType &parent_qual_type, const char *ivar_name);
|
||||
|
||||
virtual bool
|
||||
IsValidISA(ObjCISA isa)
|
||||
IsValidISA (ObjCLanguageRuntime::ObjCISA isa)
|
||||
{
|
||||
return (isa != 0);
|
||||
}
|
||||
|
@ -89,28 +85,29 @@ public:
|
|||
// this is not a valid ISA in the sense that no valid
|
||||
// class pointer can live at address 1. we use it to refer to
|
||||
// tagged types, where the ISA must be dynamically determined
|
||||
static const ObjCISA g_objc_Tagged_ISA = 1;
|
||||
static const ObjCLanguageRuntime::ObjCISA g_objc_Tagged_ISA = 1;
|
||||
|
||||
virtual ObjCISA
|
||||
virtual ObjCLanguageRuntime::ObjCISA
|
||||
GetISA(ValueObject& valobj);
|
||||
|
||||
virtual ConstString
|
||||
GetActualTypeName(ObjCISA isa);
|
||||
GetActualTypeName(ObjCLanguageRuntime::ObjCISA isa);
|
||||
|
||||
virtual ObjCISA
|
||||
GetParentClass(ObjCISA isa);
|
||||
virtual ObjCLanguageRuntime::ObjCISA
|
||||
GetParentClass(ObjCLanguageRuntime::ObjCISA isa);
|
||||
|
||||
protected:
|
||||
|
||||
private:
|
||||
|
||||
typedef std::map<ObjCISA,ConstString> ISAToNameCache;
|
||||
typedef std::map<ObjCISA,ObjCISA> ISAToParentCache;
|
||||
typedef std::map<ObjCLanguageRuntime::ObjCISA, ConstString> ISAToNameCache;
|
||||
typedef std::map<ObjCLanguageRuntime::ObjCISA, ObjCLanguageRuntime::ObjCISA> ISAToParentCache;
|
||||
|
||||
typedef ISAToNameCache::iterator ISAToNameIterator;
|
||||
typedef ISAToParentCache::iterator ISAToParentIterator;
|
||||
|
||||
AppleObjCRuntimeV2(Process *process, ModuleSP &objc_module_sp);
|
||||
AppleObjCRuntimeV2 (Process *process,
|
||||
const lldb::ModuleSP &objc_module_sp);
|
||||
|
||||
bool
|
||||
IsTaggedPointer(lldb::addr_t ptr);
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
#include "lldb/Core/Log.h"
|
||||
#include "lldb/Core/Module.h"
|
||||
#include "lldb/Core/Value.h"
|
||||
#include "lldb/Expression/ClangExpression.h"
|
||||
#include "lldb/Expression/ClangFunction.h"
|
||||
#include "lldb/Expression/ClangUtilityFunction.h"
|
||||
|
||||
#include "lldb/Symbol/ClangASTContext.h"
|
||||
#include "lldb/Target/ObjCLanguageRuntime.h"
|
||||
#include "lldb/Target/Process.h"
|
||||
|
@ -156,6 +160,10 @@ AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::VTableRegion(AppleOb
|
|||
SetUpRegion ();
|
||||
}
|
||||
|
||||
AppleObjCTrampolineHandler::~AppleObjCTrampolineHandler()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::SetUpRegion()
|
||||
{
|
||||
|
@ -301,11 +309,12 @@ AppleObjCTrampolineHandler::AppleObjCVTables::VTableRegion::Dump (Stream &s)
|
|||
}
|
||||
}
|
||||
|
||||
AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (ProcessSP &process_sp, ModuleSP &objc_module_sp) :
|
||||
m_process_sp(process_sp),
|
||||
m_trampoline_header(LLDB_INVALID_ADDRESS),
|
||||
m_trampolines_changed_bp_id(LLDB_INVALID_BREAK_ID),
|
||||
m_objc_module_sp(objc_module_sp)
|
||||
AppleObjCTrampolineHandler::AppleObjCVTables::AppleObjCVTables (const ProcessSP &process_sp,
|
||||
const ModuleSP &objc_module_sp) :
|
||||
m_process_sp (process_sp),
|
||||
m_trampoline_header (LLDB_INVALID_ADDRESS),
|
||||
m_trampolines_changed_bp_id (LLDB_INVALID_BREAK_ID),
|
||||
m_objc_module_sp (objc_module_sp)
|
||||
{
|
||||
|
||||
}
|
||||
|
@ -510,7 +519,8 @@ AppleObjCTrampolineHandler::g_dispatch_functions[] =
|
|||
{NULL}
|
||||
};
|
||||
|
||||
AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp) :
|
||||
AppleObjCTrampolineHandler::AppleObjCTrampolineHandler (const ProcessSP &process_sp,
|
||||
const ModuleSP &objc_module_sp) :
|
||||
m_process_sp (process_sp),
|
||||
m_objc_module_sp (objc_module_sp),
|
||||
m_impl_fn_addr (LLDB_INVALID_ADDRESS),
|
||||
|
|
|
@ -13,28 +13,27 @@
|
|||
// C Includes
|
||||
// C++ Includes
|
||||
#include <map>
|
||||
#include <string>
|
||||
#include <vector>
|
||||
// Other libraries and framework includes
|
||||
// Project includes
|
||||
#include "lldb/Expression/ClangExpression.h"
|
||||
#include "lldb/Expression/ClangFunction.h"
|
||||
#include "lldb/Expression/ClangUtilityFunction.h"
|
||||
#include "lldb/lldb-public.h"
|
||||
#include "lldb/Host/Mutex.h"
|
||||
|
||||
|
||||
namespace lldb_private
|
||||
{
|
||||
using namespace lldb;
|
||||
|
||||
class AppleObjCTrampolineHandler {
|
||||
public:
|
||||
|
||||
AppleObjCTrampolineHandler (ProcessSP process_sp, ModuleSP objc_module_sp);
|
||||
AppleObjCTrampolineHandler (const lldb::ProcessSP &process_sp,
|
||||
const lldb::ModuleSP &objc_module_sp);
|
||||
|
||||
~AppleObjCTrampolineHandler() {}
|
||||
~AppleObjCTrampolineHandler();
|
||||
|
||||
ThreadPlanSP
|
||||
GetStepThroughDispatchPlan (Thread &thread, bool stop_others);
|
||||
lldb::ThreadPlanSP
|
||||
GetStepThroughDispatchPlan (Thread &thread,
|
||||
bool stop_others);
|
||||
|
||||
ClangFunction *
|
||||
GetLookupImplementationWrapperFunction ();
|
||||
|
@ -80,7 +79,7 @@ private:
|
|||
private:
|
||||
struct VTableDescriptor
|
||||
{
|
||||
VTableDescriptor(uint32_t in_flags, addr_t in_code_start) :
|
||||
VTableDescriptor(uint32_t in_flags, lldb::addr_t in_code_start) :
|
||||
flags(in_flags),
|
||||
code_start(in_code_start) {}
|
||||
|
||||
|
@ -151,7 +150,8 @@ private:
|
|||
};
|
||||
|
||||
public:
|
||||
AppleObjCVTables(ProcessSP &process_sp, ModuleSP &objc_module_sp);
|
||||
AppleObjCVTables(const lldb::ProcessSP &process_sp,
|
||||
const lldb::ModuleSP &objc_module_sp);
|
||||
|
||||
~AppleObjCVTables();
|
||||
|
||||
|
@ -177,7 +177,7 @@ private:
|
|||
}
|
||||
|
||||
private:
|
||||
ProcessSP m_process_sp;
|
||||
lldb::ProcessSP m_process_sp;
|
||||
typedef std::vector<VTableRegion> region_collection;
|
||||
lldb::addr_t m_trampoline_header;
|
||||
lldb::break_id_t m_trampolines_changed_bp_id;
|
||||
|
@ -190,8 +190,8 @@ private:
|
|||
|
||||
typedef std::map<lldb::addr_t, int> MsgsendMap; // This table maps an dispatch fn address to the index in g_dispatch_functions
|
||||
MsgsendMap m_msgSend_map;
|
||||
ProcessSP m_process_sp;
|
||||
ModuleSP m_objc_module_sp;
|
||||
lldb::ProcessSP m_process_sp;
|
||||
lldb::ModuleSP m_objc_module_sp;
|
||||
std::auto_ptr<ClangFunction> m_impl_function;
|
||||
std::auto_ptr<ClangUtilityFunction> m_impl_code;
|
||||
Mutex m_impl_function_mutex;
|
||||
|
|
|
@ -23,6 +23,8 @@
|
|||
#include "lldb/Target/ThreadPlanStepOut.h"
|
||||
#include "lldb/Core/Log.h"
|
||||
|
||||
|
||||
using namespace lldb;
|
||||
using namespace lldb_private;
|
||||
|
||||
//----------------------------------------------------------------------
|
||||
|
|
|
@ -82,9 +82,9 @@ private:
|
|||
lldb::addr_t m_object_addr; // This is only for Description.
|
||||
lldb::addr_t m_isa_addr; // isa_addr and sel_addr are the keys we will use to cache the implementation.
|
||||
lldb::addr_t m_sel_addr;
|
||||
ThreadPlanSP m_func_sp; // This is the function call plan. We fill it at start, then set it
|
||||
// to NULL when this plan is done. That way we know to go to:
|
||||
ThreadPlanSP m_run_to_sp; // The plan that runs to the target.
|
||||
lldb::ThreadPlanSP m_func_sp; // This is the function call plan. We fill it at start, then set it
|
||||
// to NULL when this plan is done. That way we know to go to:
|
||||
lldb::ThreadPlanSP m_run_to_sp; // The plan that runs to the target.
|
||||
ClangFunction *m_impl_function; // This is a pointer to a impl function that
|
||||
// is owned by the client that pushes this plan.
|
||||
bool m_stop_others;
|
||||
|
|
|
@ -82,6 +82,10 @@ SymbolContext::SymbolContext (SymbolContextScope *sc_scope) :
|
|||
sc_scope->CalculateSymbolContext (this);
|
||||
}
|
||||
|
||||
SymbolContext::~SymbolContext ()
|
||||
{
|
||||
}
|
||||
|
||||
const SymbolContext&
|
||||
SymbolContext::operator= (const SymbolContext& rhs)
|
||||
{
|
||||
|
@ -447,7 +451,7 @@ SymbolContext::FindFunctionsByName (const ConstString &name,
|
|||
// for methods matching name.
|
||||
}
|
||||
|
||||
if (module_sp != NULL)
|
||||
if (module_sp)
|
||||
module_sp->FindFunctions (name, eFunctionNameTypeBase | eFunctionNameTypeFull, include_symbols, true, sc_list);
|
||||
|
||||
if (target_sp)
|
||||
|
@ -489,6 +493,24 @@ SymbolContext::FindTypeByName (const ConstString &name) const
|
|||
//
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
SymbolContextSpecifier::SymbolContextSpecifier (const TargetSP &target_sp) :
|
||||
m_target_sp (target_sp),
|
||||
m_module_spec (),
|
||||
m_module_sp (),
|
||||
m_file_spec_ap (),
|
||||
m_start_line (0),
|
||||
m_end_line (0),
|
||||
m_function_spec (),
|
||||
m_class_name (),
|
||||
m_address_range_ap (),
|
||||
m_type (eNothingSpecified)
|
||||
{
|
||||
}
|
||||
|
||||
SymbolContextSpecifier::~SymbolContextSpecifier()
|
||||
{
|
||||
}
|
||||
|
||||
bool
|
||||
SymbolContextSpecifier::AddLineSpecification (uint32_t line_no, SpecificationType type)
|
||||
{
|
||||
|
|
|
@ -14,40 +14,42 @@ namespace lldb_private {
|
|||
namespace imp
|
||||
{
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
increment(T& t)
|
||||
{
|
||||
return __sync_add_and_fetch(&t, 1);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
decrement(T& t)
|
||||
{
|
||||
return __sync_add_and_fetch(&t, -1);
|
||||
}
|
||||
|
||||
shared_count::~shared_count()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
shared_count::add_shared()
|
||||
{
|
||||
increment(shared_owners_);
|
||||
}
|
||||
|
||||
void
|
||||
shared_count::release_shared()
|
||||
{
|
||||
if (decrement(shared_owners_) == -1)
|
||||
template <class T>
|
||||
inline T
|
||||
increment(T& t)
|
||||
{
|
||||
on_zero_shared();
|
||||
delete this;
|
||||
return __sync_add_and_fetch(&t, 1);
|
||||
}
|
||||
|
||||
template <class T>
|
||||
inline T
|
||||
decrement(T& t)
|
||||
{
|
||||
return __sync_add_and_fetch(&t, -1);
|
||||
}
|
||||
|
||||
shared_count::~shared_count()
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
shared_count::add_shared()
|
||||
{
|
||||
increment(shared_owners_);
|
||||
}
|
||||
|
||||
void
|
||||
shared_count::release_shared()
|
||||
{
|
||||
if (decrement(shared_owners_) == -1)
|
||||
{
|
||||
on_zero_shared();
|
||||
delete this;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
} // imp
|
||||
|
||||
|
||||
} // namespace lldb
|
||||
|
||||
|
|
|
@ -252,7 +252,8 @@ enum
|
|||
gdb_ymm7 = gdb_xmm7
|
||||
};
|
||||
|
||||
enum DNBArchImplI386::AVXPresence DNBArchImplI386::s_has_avx = DNBArchImplI386::kAVXUnknown;
|
||||
// AVX support isn't working at all from user space, so disable it for now.
|
||||
enum DNBArchImplI386::AVXPresence DNBArchImplI386::s_has_avx = DNBArchImplI386::kAVXNotPresent;
|
||||
|
||||
uint64_t
|
||||
DNBArchImplI386::GetPC(uint64_t failValue)
|
||||
|
|
|
@ -65,7 +65,7 @@ static bool ForceAVXRegs ()
|
|||
#define FORCE_AVX_REGS (0)
|
||||
#endif
|
||||
|
||||
enum DNBArchImplX86_64::AVXPresence DNBArchImplX86_64::s_has_avx = DNBArchImplX86_64::kAVXUnknown;
|
||||
enum DNBArchImplX86_64::AVXPresence DNBArchImplX86_64::s_has_avx = DNBArchImplX86_64::kAVXNotPresent;
|
||||
|
||||
uint64_t
|
||||
DNBArchImplX86_64::GetPC(uint64_t failValue)
|
||||
|
|
Loading…
Reference in New Issue