forked from OSchip/llvm-project
Adopt the intrusive pointers in:
lldb_private::Breakpoint lldb_private::BreakpointLocations lldb_private::BreakpointSite lldb_private::Debugger lldb_private::StackFrame lldb_private::Thread lldb_private::Target llvm-svn: 139985
This commit is contained in:
parent
a2eee184e0
commit
4d122c4009
lldb
include/lldb
source
Breakpoint
Commands
Core
Expression
Interpreter
Plugins/LanguageRuntime/ObjC/AppleObjCRuntime
Target
Utility
|
@ -74,6 +74,7 @@ namespace lldb_private {
|
|||
/// not by the breakpoint.
|
||||
//----------------------------------------------------------------------
|
||||
class Breakpoint:
|
||||
public ReferenceCountedBase<Breakpoint>,
|
||||
public Stoppoint
|
||||
{
|
||||
public:
|
||||
|
@ -514,21 +515,6 @@ public:
|
|||
InvokeCallback (StoppointCallbackContext *context,
|
||||
lldb::break_id_t bp_loc_id);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
/// Returns the shared pointer that this breakpoint holds for the
|
||||
/// breakpoint location passed in as \a bp_loc_ptr. Passing in a
|
||||
/// breakpoint location that doesn't belong to this breakpoint will
|
||||
/// cause an assert.
|
||||
///
|
||||
/// Meant to be used by the BreakpointLocation::GetSP() function.
|
||||
///
|
||||
/// @return
|
||||
/// A copy of the shared pointer for the given location.
|
||||
//------------------------------------------------------------------
|
||||
lldb::BreakpointLocationSP
|
||||
GetLocationSP (BreakpointLocation *bp_loc_ptr);
|
||||
|
||||
|
||||
protected:
|
||||
friend class Target;
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -46,7 +46,9 @@ namespace lldb_private {
|
|||
/// would be useful if you've set options on the locations.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointLocation : public StoppointLocation
|
||||
class BreakpointLocation :
|
||||
public ReferenceCountedBase<BreakpointLocation>,
|
||||
public StoppointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -116,7 +116,7 @@ public:
|
|||
/// A thread plan to run to test the condition, or NULL if there is no thread plan.
|
||||
//------------------------------------------------------------------
|
||||
ThreadPlan *GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
|
||||
lldb::BreakpointLocationSP break_loc_sp,
|
||||
const lldb::BreakpointLocationSP& break_loc_sp,
|
||||
Stream &error);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
|
|
|
@ -38,7 +38,9 @@ namespace lldb_private {
|
|||
/// site. Breakpoint sites are owned by the process.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
class BreakpointSite : public StoppointLocation
|
||||
class BreakpointSite :
|
||||
public ReferenceCountedBase<BreakpointSite>,
|
||||
public StoppointLocation
|
||||
{
|
||||
public:
|
||||
|
||||
|
|
|
@ -220,6 +220,7 @@ private:
|
|||
|
||||
|
||||
class Debugger :
|
||||
public ReferenceCountedBaseVirtual<Debugger>,
|
||||
public UserID,
|
||||
public DebuggerInstanceSettings
|
||||
{
|
||||
|
@ -275,6 +276,7 @@ public:
|
|||
static void
|
||||
Destroy (lldb::DebuggerSP &debugger_sp);
|
||||
|
||||
virtual
|
||||
~Debugger ();
|
||||
|
||||
void Clear();
|
||||
|
|
|
@ -351,13 +351,13 @@ public:
|
|||
ExecutionContextScope *
|
||||
GetExecutionContextScope ();
|
||||
|
||||
lldb::TargetSP
|
||||
const lldb::TargetSP &
|
||||
GetTargetSP () const
|
||||
{
|
||||
return m_target_sp;
|
||||
}
|
||||
|
||||
lldb::ProcessSP
|
||||
const lldb::ProcessSP &
|
||||
GetProcessSP () const
|
||||
{
|
||||
return m_process_sp;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
namespace lldb_private {
|
||||
|
||||
class StackFrame :
|
||||
public ReferenceCountedBaseVirtual<StackFrame>,
|
||||
public ExecutionContextScope
|
||||
{
|
||||
public:
|
||||
|
|
|
@ -123,6 +123,7 @@ protected:
|
|||
// Target
|
||||
//----------------------------------------------------------------------
|
||||
class Target :
|
||||
public ReferenceCountedBaseVirtual<Target>,
|
||||
public Broadcaster,
|
||||
public ExecutionContextScope,
|
||||
public TargetInstanceSettings
|
||||
|
|
|
@ -85,6 +85,7 @@ private:
|
|||
};
|
||||
|
||||
class Thread :
|
||||
public ReferenceCountedBaseVirtual<Thread>,
|
||||
public UserID,
|
||||
public ExecutionContextScope,
|
||||
public ThreadInstanceSettings
|
||||
|
|
|
@ -30,10 +30,10 @@ public:
|
|||
virtual ~ThreadPlanTestCondition ();
|
||||
|
||||
ThreadPlanTestCondition (Thread &thread,
|
||||
ExecutionContext &exe_ctx,
|
||||
ClangUserExpression *expression,
|
||||
lldb::BreakpointLocationSP break_loc_sp,
|
||||
bool stop_others);
|
||||
ExecutionContext &exe_ctx,
|
||||
ClangUserExpression *expression,
|
||||
const lldb::BreakpointLocationSP &break_loc_sp,
|
||||
bool stop_others);
|
||||
|
||||
virtual void GetDescription (Stream *s, lldb::DescriptionLevel level);
|
||||
virtual bool ValidatePlan (Stream *error);
|
||||
|
|
|
@ -16,6 +16,20 @@
|
|||
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);
|
||||
}
|
||||
|
||||
class shared_count
|
||||
{
|
||||
|
@ -540,22 +554,16 @@ template <class T>
|
|||
class ReferenceCountedBase
|
||||
{
|
||||
public:
|
||||
explicit ReferenceCountedBase(long refs = 0)
|
||||
: shared_owners_(refs)
|
||||
explicit ReferenceCountedBase()
|
||||
: shared_owners_(-1)
|
||||
{
|
||||
}
|
||||
|
||||
void
|
||||
add_shared()
|
||||
{
|
||||
__sync_add_and_fetch(&shared_owners_, 1);
|
||||
}
|
||||
add_shared();
|
||||
|
||||
void
|
||||
release_shared()
|
||||
{
|
||||
if (__sync_add_and_fetch(&shared_owners_, -1) == -1)
|
||||
delete static_cast<T*>(this);
|
||||
}
|
||||
release_shared();
|
||||
|
||||
long
|
||||
use_count() const
|
||||
|
@ -573,54 +581,20 @@ private:
|
|||
ReferenceCountedBase& operator=(const ReferenceCountedBase&);
|
||||
};
|
||||
|
||||
template <class T>
|
||||
void
|
||||
lldb_private::ReferenceCountedBase<T>::add_shared()
|
||||
{
|
||||
imp::increment(shared_owners_);
|
||||
}
|
||||
|
||||
//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>
|
||||
void
|
||||
lldb_private::ReferenceCountedBase<T>::release_shared()
|
||||
{
|
||||
if (imp::decrement(shared_owners_) == -1)
|
||||
delete static_cast<T*>(this);
|
||||
}
|
||||
|
||||
|
||||
template <class T>
|
||||
|
|
|
@ -23,9 +23,9 @@ namespace lldb {
|
|||
typedef SharedPtr<lldb_private::AddressResolver>::Type AddressResolverSP;
|
||||
typedef SharedPtr<lldb_private::Baton>::Type BatonSP;
|
||||
typedef SharedPtr<lldb_private::Block>::Type BlockSP;
|
||||
typedef SharedPtr<lldb_private::Breakpoint>::Type BreakpointSP;
|
||||
typedef SharedPtr<lldb_private::BreakpointSite>::Type BreakpointSiteSP;
|
||||
typedef SharedPtr<lldb_private::BreakpointLocation>::Type BreakpointLocationSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::Breakpoint>::Type BreakpointSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::BreakpointSite>::Type BreakpointSiteSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::BreakpointLocation>::Type BreakpointLocationSP;
|
||||
typedef SharedPtr<lldb_private::BreakpointResolver>::Type BreakpointResolverSP;
|
||||
typedef SharedPtr<lldb_private::Broadcaster>::Type BroadcasterSP;
|
||||
typedef SharedPtr<lldb_private::ClangExpressionVariable>::Type ClangExpressionVariableSP;
|
||||
|
@ -35,7 +35,7 @@ namespace lldb {
|
|||
typedef SharedPtr<lldb_private::CompileUnit>::Type CompUnitSP;
|
||||
typedef SharedPtr<lldb_private::DataBuffer>::Type DataBufferSP;
|
||||
typedef SharedPtr<lldb_private::DataExtractor>::Type DataExtractorSP;
|
||||
typedef SharedPtr<lldb_private::Debugger>::Type DebuggerSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::Debugger>::Type DebuggerSP;
|
||||
typedef SharedPtr<lldb_private::Disassembler>::Type DisassemblerSP;
|
||||
typedef SharedPtr<lldb_private::DynamicLoader>::Type DynamicLoaderSP;
|
||||
typedef SharedPtr<lldb_private::Event>::Type EventSP;
|
||||
|
@ -59,7 +59,7 @@ namespace lldb {
|
|||
typedef SharedPtr<lldb_private::Section>::Type SectionSP;
|
||||
typedef SharedPtr<lldb_private::SearchFilter>::Type SearchFilterSP;
|
||||
typedef SharedPtr<lldb_private::ScriptSummaryFormat>::Type ScriptFormatSP;
|
||||
typedef SharedPtr<lldb_private::StackFrame>::Type StackFrameSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::StackFrame>::Type StackFrameSP;
|
||||
typedef SharedPtr<lldb_private::StackFrameList>::Type StackFrameListSP;
|
||||
typedef SharedPtr<lldb_private::StopInfo>::Type StopInfoSP;
|
||||
typedef SharedPtr<lldb_private::StoppointLocation>::Type StoppointLocationSP;
|
||||
|
@ -70,8 +70,8 @@ namespace lldb {
|
|||
typedef SharedPtr<lldb_private::SymbolContextSpecifier>::Type SymbolContextSpecifierSP;
|
||||
typedef SharedPtr<lldb_private::SyntheticChildren>::Type SyntheticChildrenSP;
|
||||
typedef SharedPtr<lldb_private::SyntheticChildrenFrontEnd>::Type SyntheticChildrenFrontEndSP;
|
||||
typedef SharedPtr<lldb_private::Target>::Type TargetSP;
|
||||
typedef SharedPtr<lldb_private::Thread>::Type ThreadSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::Target>::Type TargetSP;
|
||||
typedef IntrusiveSharedPtr<lldb_private::Thread>::Type ThreadSP;
|
||||
typedef SharedPtr<lldb_private::ThreadPlan>::Type ThreadPlanSP;
|
||||
typedef SharedPtr<lldb_private::ThreadPlanTracer>::Type ThreadPlanTracerSP;
|
||||
typedef SharedPtr<lldb_private::Type>::Type TypeSP;
|
||||
|
|
|
@ -124,13 +124,6 @@ Breakpoint::GetLocationAtIndex (uint32_t index)
|
|||
return m_locations.GetByIndex(index);
|
||||
}
|
||||
|
||||
BreakpointLocationSP
|
||||
Breakpoint::GetLocationSP (BreakpointLocation *bp_loc_ptr)
|
||||
{
|
||||
return m_locations.FindByID(bp_loc_ptr->GetID());
|
||||
}
|
||||
|
||||
|
||||
// For each of the overall options we need to decide how they propagate to
|
||||
// the location options. This will determine the precedence of options on
|
||||
// the breakpoint vrs. its locations.
|
||||
|
@ -567,5 +560,7 @@ Breakpoint::GetFilterDescription (Stream *s)
|
|||
const BreakpointSP
|
||||
Breakpoint::GetSP ()
|
||||
{
|
||||
return m_target.GetBreakpointList().FindBreakpointByID (GetID());
|
||||
// This object contains an instrusive ref count base class so we can
|
||||
// easily make a shared pointer to this object
|
||||
return BreakpointSP (this);
|
||||
}
|
||||
|
|
|
@ -149,11 +149,11 @@ BreakpointLocation::SetCondition (const char *condition)
|
|||
ThreadPlan *
|
||||
BreakpointLocation::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx, Stream &error)
|
||||
{
|
||||
lldb::BreakpointLocationSP my_sp(m_owner.GetLocationSP(this));
|
||||
lldb::BreakpointLocationSP this_sp(this);
|
||||
if (m_options_ap.get())
|
||||
return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, my_sp, error);
|
||||
return m_options_ap->GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
|
||||
else
|
||||
return m_owner.GetThreadPlanToTestCondition (exe_ctx, my_sp, error);
|
||||
return m_owner.GetThreadPlanToTestCondition (exe_ctx, this_sp, error);
|
||||
}
|
||||
|
||||
const char *
|
||||
|
@ -259,9 +259,9 @@ BreakpointLocation::ResolveBreakpointSite ()
|
|||
if (m_owner.GetTarget().GetSectionLoadList().IsEmpty())
|
||||
return false;
|
||||
|
||||
BreakpointLocationSP myself_sp(m_owner.GetLocationSP (this));
|
||||
BreakpointLocationSP this_sp(this);
|
||||
|
||||
lldb::break_id_t new_id = process->CreateBreakpointSite (myself_sp, false);
|
||||
lldb::break_id_t new_id = process->CreateBreakpointSite (this_sp, false);
|
||||
|
||||
if (new_id == LLDB_INVALID_BREAK_ID)
|
||||
{
|
||||
|
|
|
@ -172,7 +172,7 @@ BreakpointOptions::SetCondition (const char *condition)
|
|||
|
||||
ThreadPlan *
|
||||
BreakpointOptions::GetThreadPlanToTestCondition (ExecutionContext &exe_ctx,
|
||||
lldb::BreakpointLocationSP break_loc_sp,
|
||||
const BreakpointLocationSP &break_loc_sp,
|
||||
Stream &error_stream)
|
||||
{
|
||||
// No condition means we should stop, so return NULL.
|
||||
|
|
|
@ -574,7 +574,7 @@ CommandObjectMultiwordBreakpoint::VerifyBreakpointIDs (Args &args, Target *targe
|
|||
|
||||
if (args.GetArgumentCount() == 0)
|
||||
{
|
||||
if (target->GetLastCreatedBreakpoint() != NULL)
|
||||
if (target->GetLastCreatedBreakpoint())
|
||||
{
|
||||
valid_ids->AddBreakpointID (BreakpointID(target->GetLastCreatedBreakpoint()->GetID(), LLDB_INVALID_BREAK_ID));
|
||||
result.SetStatus (eReturnStatusSuccessFinishNoResult);
|
||||
|
|
|
@ -152,7 +152,7 @@ Debugger::CreateInstance ()
|
|||
}
|
||||
|
||||
void
|
||||
Debugger::Destroy (lldb::DebuggerSP &debugger_sp)
|
||||
Debugger::Destroy (DebuggerSP &debugger_sp)
|
||||
{
|
||||
if (debugger_sp.get() == NULL)
|
||||
return;
|
||||
|
@ -172,29 +172,18 @@ Debugger::Destroy (lldb::DebuggerSP &debugger_sp)
|
|||
}
|
||||
}
|
||||
|
||||
lldb::DebuggerSP
|
||||
DebuggerSP
|
||||
Debugger::GetSP ()
|
||||
{
|
||||
lldb::DebuggerSP debugger_sp;
|
||||
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
for (pos = debugger_list.begin(); pos != end; ++pos)
|
||||
{
|
||||
if ((*pos).get() == this)
|
||||
{
|
||||
debugger_sp = *pos;
|
||||
break;
|
||||
}
|
||||
}
|
||||
return debugger_sp;
|
||||
// This object contains an instrusive ref count base class so we can
|
||||
// easily make a shared pointer to this object
|
||||
return DebuggerSP (this);
|
||||
}
|
||||
|
||||
lldb::DebuggerSP
|
||||
DebuggerSP
|
||||
Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name)
|
||||
{
|
||||
lldb::DebuggerSP debugger_sp;
|
||||
DebuggerSP debugger_sp;
|
||||
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
|
@ -214,7 +203,7 @@ Debugger::FindDebuggerWithInstanceName (const ConstString &instance_name)
|
|||
TargetSP
|
||||
Debugger::FindTargetWithProcessID (lldb::pid_t pid)
|
||||
{
|
||||
lldb::TargetSP target_sp;
|
||||
TargetSP target_sp;
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
DebuggerList::iterator pos, end = debugger_list.end();
|
||||
|
@ -350,7 +339,7 @@ Debugger::GetSelectedExecutionContext ()
|
|||
ExecutionContext exe_ctx;
|
||||
exe_ctx.Clear();
|
||||
|
||||
lldb::TargetSP target_sp = GetSelectedTarget();
|
||||
TargetSP target_sp = GetSelectedTarget();
|
||||
exe_ctx.target = target_sp.get();
|
||||
|
||||
if (target_sp)
|
||||
|
@ -469,7 +458,7 @@ Debugger::NotifyTopInputReader (InputReaderAction notification)
|
|||
}
|
||||
|
||||
bool
|
||||
Debugger::InputReaderIsTopReader (const lldb::InputReaderSP& reader_sp)
|
||||
Debugger::InputReaderIsTopReader (const InputReaderSP& reader_sp)
|
||||
{
|
||||
InputReaderSP top_reader_sp (GetCurrentInputReader());
|
||||
|
||||
|
@ -531,7 +520,7 @@ Debugger::PushInputReader (const InputReaderSP& reader_sp)
|
|||
}
|
||||
|
||||
bool
|
||||
Debugger::PopInputReader (const lldb::InputReaderSP& pop_reader_sp)
|
||||
Debugger::PopInputReader (const InputReaderSP& pop_reader_sp)
|
||||
{
|
||||
bool result = false;
|
||||
|
||||
|
@ -627,7 +616,7 @@ Debugger::GetAsyncErrorStream ()
|
|||
DebuggerSP
|
||||
Debugger::FindDebuggerWithID (lldb::user_id_t id)
|
||||
{
|
||||
lldb::DebuggerSP debugger_sp;
|
||||
DebuggerSP debugger_sp;
|
||||
|
||||
Mutex::Locker locker (GetDebuggerListMutex ());
|
||||
DebuggerList &debugger_list = GetDebuggerList();
|
||||
|
@ -710,7 +699,7 @@ ScanFormatDescriptor (const char* var_name_begin,
|
|||
const char* var_name_end,
|
||||
const char** var_name_final,
|
||||
const char** percent_position,
|
||||
lldb::Format* custom_format,
|
||||
Format* custom_format,
|
||||
ValueObject::ValueObjectRepresentationStyle* val_obj_display)
|
||||
{
|
||||
LogSP log(lldb_private::GetLogIfAllCategoriesSet (LIBLLDB_LOG_TYPES));
|
||||
|
@ -1033,7 +1022,7 @@ Debugger::FormatPrompt
|
|||
|
||||
if (*var_name_begin == 's')
|
||||
{
|
||||
valobj = valobj->GetSyntheticValue(lldb::eUseSyntheticFilter).get();
|
||||
valobj = valobj->GetSyntheticValue(eUseSyntheticFilter).get();
|
||||
var_name_begin++;
|
||||
}
|
||||
|
||||
|
@ -1053,7 +1042,7 @@ Debugger::FormatPrompt
|
|||
options.DontCheckDotVsArrowSyntax().DoAllowBitfieldSyntax().DoAllowFragileIVar().DoAllowSyntheticChildren();
|
||||
ValueObject::ValueObjectRepresentationStyle val_obj_display = ValueObject::eDisplaySummary;
|
||||
ValueObject* target = NULL;
|
||||
lldb::Format custom_format = eFormatInvalid;
|
||||
Format custom_format = eFormatInvalid;
|
||||
const char* var_name_final = NULL;
|
||||
const char* var_name_final_if_array_range = NULL;
|
||||
const char* close_bracket_position = NULL;
|
||||
|
@ -1847,7 +1836,7 @@ Debugger::FormatPrompt
|
|||
//--------------------------------------------------
|
||||
|
||||
Debugger::SettingsController::SettingsController () :
|
||||
UserSettingsController ("", lldb::UserSettingsControllerSP())
|
||||
UserSettingsController ("", UserSettingsControllerSP())
|
||||
{
|
||||
m_default_settings.reset (new DebuggerInstanceSettings (*this, false,
|
||||
InstanceSettings::GetDefaultName().AsCString()));
|
||||
|
@ -1858,12 +1847,12 @@ Debugger::SettingsController::~SettingsController ()
|
|||
}
|
||||
|
||||
|
||||
lldb::InstanceSettingsSP
|
||||
InstanceSettingsSP
|
||||
Debugger::SettingsController::CreateInstanceSettings (const char *instance_name)
|
||||
{
|
||||
DebuggerInstanceSettings *new_settings = new DebuggerInstanceSettings (*GetSettingsController(),
|
||||
false, instance_name);
|
||||
lldb::InstanceSettingsSP new_settings_sp (new_settings);
|
||||
InstanceSettingsSP new_settings_sp (new_settings);
|
||||
return new_settings_sp;
|
||||
}
|
||||
|
||||
|
@ -1900,7 +1889,7 @@ DebuggerInstanceSettings::DebuggerInstanceSettings
|
|||
|
||||
if (live_instance)
|
||||
{
|
||||
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
|
||||
const InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
|
||||
CopyInstanceSettings (pending_settings, false);
|
||||
}
|
||||
}
|
||||
|
@ -1914,7 +1903,7 @@ DebuggerInstanceSettings::DebuggerInstanceSettings (const DebuggerInstanceSettin
|
|||
m_use_external_editor (rhs.m_use_external_editor),
|
||||
m_auto_confirm_on(rhs.m_auto_confirm_on)
|
||||
{
|
||||
const lldb::InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
|
||||
const InstanceSettingsSP &pending_settings = m_owner.FindPendingSettings (m_instance_name);
|
||||
CopyInstanceSettings (pending_settings, false);
|
||||
m_owner.RemovePendingSettings (m_instance_name);
|
||||
}
|
||||
|
@ -2082,7 +2071,7 @@ DebuggerInstanceSettings::GetInstanceSettingsValue (const SettingEntry &entry,
|
|||
}
|
||||
|
||||
void
|
||||
DebuggerInstanceSettings::CopyInstanceSettings (const lldb::InstanceSettingsSP &new_settings,
|
||||
DebuggerInstanceSettings::CopyInstanceSettings (const InstanceSettingsSP &new_settings,
|
||||
bool pending)
|
||||
{
|
||||
if (new_settings.get() == NULL)
|
||||
|
|
|
@ -131,7 +131,7 @@ SearchFilter::Search (Searcher &searcher)
|
|||
{
|
||||
SymbolContext empty_sc;
|
||||
|
||||
if (m_target_sp == NULL)
|
||||
if (!m_target_sp)
|
||||
return;
|
||||
empty_sc.target_sp = m_target_sp;
|
||||
|
||||
|
@ -146,7 +146,7 @@ SearchFilter::SearchInModuleList (Searcher &searcher, ModuleList &modules)
|
|||
{
|
||||
SymbolContext empty_sc;
|
||||
|
||||
if (m_target_sp == NULL)
|
||||
if (!m_target_sp)
|
||||
return;
|
||||
empty_sc.target_sp = m_target_sp;
|
||||
|
||||
|
|
|
@ -75,9 +75,15 @@ ClangExpressionDeclMap::WillParse(ExecutionContext &exe_ctx)
|
|||
else if (exe_ctx.thread)
|
||||
m_parser_vars->m_sym_ctx = exe_ctx.thread->GetStackFrameAtIndex(0)->GetSymbolContext(lldb::eSymbolContextEverything);
|
||||
else if (exe_ctx.process)
|
||||
m_parser_vars->m_sym_ctx = SymbolContext(exe_ctx.target->GetSP(), ModuleSP());
|
||||
{
|
||||
m_parser_vars->m_sym_ctx.Clear();
|
||||
m_parser_vars->m_sym_ctx.target_sp = exe_ctx.target;
|
||||
}
|
||||
else if (exe_ctx.target)
|
||||
m_parser_vars->m_sym_ctx = SymbolContext(exe_ctx.target->GetSP(), ModuleSP());
|
||||
{
|
||||
m_parser_vars->m_sym_ctx.Clear();
|
||||
m_parser_vars->m_sym_ctx.target_sp = exe_ctx.target;
|
||||
}
|
||||
|
||||
if (exe_ctx.target)
|
||||
m_parser_vars->m_persistent_vars = &exe_ctx.target->GetPersistentVariables();
|
||||
|
|
|
@ -886,7 +886,7 @@ Options::HandleOptionArgumentCompletion
|
|||
FileSpec module_spec(module_name, false);
|
||||
lldb::TargetSP target_sp = m_interpreter.GetDebugger().GetSelectedTarget();
|
||||
// Search filters require a target...
|
||||
if (target_sp != NULL)
|
||||
if (target_sp)
|
||||
filter_ap.reset (new SearchFilterByModule (target_sp, module_spec));
|
||||
}
|
||||
break;
|
||||
|
|
|
@ -19,6 +19,7 @@
|
|||
#include <string>
|
||||
|
||||
#include "lldb/API/SBValue.h"
|
||||
#include "lldb/Breakpoint/BreakpointLocation.h"
|
||||
#include "lldb/Breakpoint/StoppointCallbackContext.h"
|
||||
#include "lldb/Core/Debugger.h"
|
||||
#include "lldb/Core/Timer.h"
|
||||
|
|
|
@ -373,7 +373,7 @@ AppleObjCTrampolineHandler::AppleObjCVTables::InitializeVTableSymbols ()
|
|||
if (changed_addr != LLDB_INVALID_ADDRESS)
|
||||
{
|
||||
BreakpointSP trampolines_changed_bp_sp = target.CreateBreakpoint (changed_addr, true);
|
||||
if (trampolines_changed_bp_sp != NULL)
|
||||
if (trampolines_changed_bp_sp)
|
||||
{
|
||||
m_trampolines_changed_bp_id = trampolines_changed_bp_sp->GetID();
|
||||
trampolines_changed_bp_sp->SetCallback (RefreshTrampolines, this, true);
|
||||
|
|
|
@ -1416,22 +1416,22 @@ Process::RemoveBreakpointOpcodesFromBuffer (addr_t bp_addr, size_t size, uint8_t
|
|||
size_t intersect_size;
|
||||
size_t opcode_offset;
|
||||
size_t idx;
|
||||
BreakpointSiteSP bp;
|
||||
BreakpointSiteSP bp_sp;
|
||||
BreakpointSiteList bp_sites_in_range;
|
||||
|
||||
if (m_breakpoint_site_list.FindInRange (bp_addr, bp_addr + size, bp_sites_in_range))
|
||||
{
|
||||
for (idx = 0; (bp = bp_sites_in_range.GetByIndex(idx)) != NULL; ++idx)
|
||||
for (idx = 0; (bp_sp = bp_sites_in_range.GetByIndex(idx)); ++idx)
|
||||
{
|
||||
if (bp->GetType() == BreakpointSite::eSoftware)
|
||||
if (bp_sp->GetType() == BreakpointSite::eSoftware)
|
||||
{
|
||||
if (bp->IntersectsRange(bp_addr, size, &intersect_addr, &intersect_size, &opcode_offset))
|
||||
if (bp_sp->IntersectsRange(bp_addr, size, &intersect_addr, &intersect_size, &opcode_offset))
|
||||
{
|
||||
assert(bp_addr <= intersect_addr && intersect_addr < bp_addr + size);
|
||||
assert(bp_addr < intersect_addr + intersect_size && intersect_addr + intersect_size <= bp_addr + size);
|
||||
assert(opcode_offset + intersect_size <= bp->GetByteSize());
|
||||
assert(opcode_offset + intersect_size <= bp_sp->GetByteSize());
|
||||
size_t buf_offset = intersect_addr - bp_addr;
|
||||
::memcpy(buf + buf_offset, bp->GetSavedOpcodeBytes() + opcode_offset, intersect_size);
|
||||
::memcpy(buf + buf_offset, bp_sp->GetSavedOpcodeBytes() + opcode_offset, intersect_size);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,11 +41,11 @@ using namespace lldb_private;
|
|||
|
||||
StackFrame::StackFrame
|
||||
(
|
||||
lldb::user_id_t frame_idx,
|
||||
lldb::user_id_t unwind_frame_index,
|
||||
user_id_t frame_idx,
|
||||
user_id_t unwind_frame_index,
|
||||
Thread &thread,
|
||||
lldb::addr_t cfa,
|
||||
lldb::addr_t pc,
|
||||
addr_t cfa,
|
||||
addr_t pc,
|
||||
const SymbolContext *sc_ptr
|
||||
) :
|
||||
m_thread (thread),
|
||||
|
@ -71,12 +71,12 @@ StackFrame::StackFrame
|
|||
|
||||
StackFrame::StackFrame
|
||||
(
|
||||
lldb::user_id_t frame_idx,
|
||||
lldb::user_id_t unwind_frame_index,
|
||||
user_id_t frame_idx,
|
||||
user_id_t unwind_frame_index,
|
||||
Thread &thread,
|
||||
const RegisterContextSP ®_context_sp,
|
||||
lldb::addr_t cfa,
|
||||
lldb::addr_t pc,
|
||||
addr_t cfa,
|
||||
addr_t pc,
|
||||
const SymbolContext *sc_ptr
|
||||
) :
|
||||
m_thread (thread),
|
||||
|
@ -108,11 +108,11 @@ StackFrame::StackFrame
|
|||
|
||||
StackFrame::StackFrame
|
||||
(
|
||||
lldb::user_id_t frame_idx,
|
||||
lldb::user_id_t unwind_frame_index,
|
||||
user_id_t frame_idx,
|
||||
user_id_t unwind_frame_index,
|
||||
Thread &thread,
|
||||
const RegisterContextSP ®_context_sp,
|
||||
lldb::addr_t cfa,
|
||||
addr_t cfa,
|
||||
const Address& pc_addr,
|
||||
const SymbolContext *sc_ptr
|
||||
) :
|
||||
|
@ -515,9 +515,9 @@ StackFrame::GetInScopeVariableList (bool get_file_globals)
|
|||
|
||||
ValueObjectSP
|
||||
StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
||||
lldb::DynamicValueType use_dynamic,
|
||||
DynamicValueType use_dynamic,
|
||||
uint32_t options,
|
||||
lldb::VariableSP &var_sp,
|
||||
VariableSP &var_sp,
|
||||
Error &error)
|
||||
{
|
||||
|
||||
|
@ -643,7 +643,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
if (!child_valobj_sp)
|
||||
{
|
||||
if (no_synth_child == false)
|
||||
child_valobj_sp = valobj_sp->GetSyntheticValue(lldb::eUseSyntheticFilter)->GetChildMemberWithName (child_name, true);
|
||||
child_valobj_sp = valobj_sp->GetSyntheticValue(eUseSyntheticFilter)->GetChildMemberWithName (child_name, true);
|
||||
|
||||
if (no_synth_child || !child_valobj_sp)
|
||||
{
|
||||
|
@ -667,7 +667,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
}
|
||||
// Remove the child name from the path
|
||||
var_path.erase(0, child_name.GetLength());
|
||||
if (use_dynamic != lldb::eNoDynamicValues)
|
||||
if (use_dynamic != eNoDynamicValues)
|
||||
{
|
||||
ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
|
||||
if (dynamic_value_sp)
|
||||
|
@ -728,12 +728,12 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
if (no_synth_child == false
|
||||
&&
|
||||
ClangASTType::GetMinimumLanguage(valobj_sp->GetClangAST(),
|
||||
valobj_sp->GetClangType()) == lldb::eLanguageTypeObjC /* is ObjC pointer */
|
||||
valobj_sp->GetClangType()) == eLanguageTypeObjC /* is ObjC pointer */
|
||||
&&
|
||||
ClangASTContext::IsPointerType(ClangASTType::GetPointeeType(valobj_sp->GetClangType())) == false /* is not double-ptr */)
|
||||
{
|
||||
// dereferencing ObjC variables is not valid.. so let's try and recur to synthetic children
|
||||
lldb::ValueObjectSP synthetic = valobj_sp->GetSyntheticValue(lldb::eUseSyntheticFilter);
|
||||
ValueObjectSP synthetic = valobj_sp->GetSyntheticValue(eUseSyntheticFilter);
|
||||
if (synthetic.get() == NULL /* no synthetic */
|
||||
|| synthetic == valobj_sp) /* synthetic is the same as the original object */
|
||||
{
|
||||
|
@ -805,7 +805,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
}
|
||||
else
|
||||
{
|
||||
lldb::ValueObjectSP synthetic = valobj_sp->GetSyntheticValue(lldb::eUseSyntheticFilter);
|
||||
ValueObjectSP synthetic = valobj_sp->GetSyntheticValue(eUseSyntheticFilter);
|
||||
if (no_synth_child /* synthetic is forbidden */ ||
|
||||
synthetic.get() == NULL /* no synthetic */
|
||||
|| synthetic == valobj_sp) /* synthetic is the same as the original object */
|
||||
|
@ -847,7 +847,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
// %i is the array index
|
||||
var_path.erase(0, (end - var_path.c_str()) + 1);
|
||||
separator_idx = var_path.find_first_of(".-[");
|
||||
if (use_dynamic != lldb::eNoDynamicValues)
|
||||
if (use_dynamic != eNoDynamicValues)
|
||||
{
|
||||
ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
|
||||
if (dynamic_value_sp)
|
||||
|
@ -948,7 +948,7 @@ StackFrame::GetValueForVariableExpressionPath (const char *var_expr_cstr,
|
|||
// %i is the index
|
||||
var_path.erase(0, (real_end - var_path.c_str()) + 1);
|
||||
separator_idx = var_path.find_first_of(".-[");
|
||||
if (use_dynamic != lldb::eNoDynamicValues)
|
||||
if (use_dynamic != eNoDynamicValues)
|
||||
{
|
||||
ValueObjectSP dynamic_value_sp(child_valobj_sp->GetDynamicValue(use_dynamic));
|
||||
if (dynamic_value_sp)
|
||||
|
@ -1077,7 +1077,7 @@ StackFrame::HasDebugInformation ()
|
|||
|
||||
|
||||
ValueObjectSP
|
||||
StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
|
||||
StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
|
||||
{
|
||||
ValueObjectSP valobj_sp;
|
||||
VariableList *var_list = GetVariableList (true);
|
||||
|
@ -1098,7 +1098,7 @@ StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, lldb:
|
|||
}
|
||||
}
|
||||
}
|
||||
if (use_dynamic != lldb::eNoDynamicValues && valobj_sp)
|
||||
if (use_dynamic != eNoDynamicValues && valobj_sp)
|
||||
{
|
||||
ValueObjectSP dynamic_sp = valobj_sp->GetDynamicValue (use_dynamic);
|
||||
if (dynamic_sp)
|
||||
|
@ -1108,7 +1108,7 @@ StackFrame::GetValueObjectForFrameVariable (const VariableSP &variable_sp, lldb:
|
|||
}
|
||||
|
||||
ValueObjectSP
|
||||
StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, lldb::DynamicValueType use_dynamic)
|
||||
StackFrame::TrackGlobalVariable (const VariableSP &variable_sp, DynamicValueType use_dynamic)
|
||||
{
|
||||
// Check to make sure we aren't already tracking this variable?
|
||||
ValueObjectSP valobj_sp (GetValueObjectForFrameVariable (variable_sp, use_dynamic));
|
||||
|
@ -1254,10 +1254,12 @@ StackFrame::HasCachedData () const
|
|||
return false;
|
||||
}
|
||||
|
||||
lldb::StackFrameSP
|
||||
StackFrameSP
|
||||
StackFrame::GetSP ()
|
||||
{
|
||||
return m_thread.GetStackFrameSPForStackFramePtr (this);
|
||||
// This object contains an instrusive ref count base class so we can
|
||||
// easily make a shared pointer to this object
|
||||
return StackFrameSP (this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -146,7 +146,9 @@ Target::GetProcessSP () const
|
|||
lldb::TargetSP
|
||||
Target::GetSP()
|
||||
{
|
||||
return m_debugger.GetTargetList().GetTargetSP(this);
|
||||
// This object contains an instrusive ref count base class so we can
|
||||
// easily make a shared pointer to this object
|
||||
return TargetSP(this);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
|
@ -970,7 +970,9 @@ Thread::DumpUsingSettingsFormat (Stream &strm, uint32_t frame_idx)
|
|||
lldb::ThreadSP
|
||||
Thread::GetSP ()
|
||||
{
|
||||
return m_process.GetThreadList().GetThreadSPForThreadPtr(this);
|
||||
// This object contains an instrusive ref count base class so we can
|
||||
// easily make a shared pointer to this object
|
||||
return ThreadSP(this);
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -37,12 +37,11 @@ using namespace lldb_private;
|
|||
// based on the value of \a type.
|
||||
//----------------------------------------------------------------------
|
||||
|
||||
ThreadPlanTestCondition::ThreadPlanTestCondition (
|
||||
Thread& thread,
|
||||
ExecutionContext &exe_ctx,
|
||||
ClangUserExpression *expression,
|
||||
lldb::BreakpointLocationSP break_loc_sp,
|
||||
bool stop_others) :
|
||||
ThreadPlanTestCondition::ThreadPlanTestCondition (Thread& thread,
|
||||
ExecutionContext &exe_ctx,
|
||||
ClangUserExpression *expression,
|
||||
const BreakpointLocationSP &break_loc_sp,
|
||||
bool stop_others) :
|
||||
ThreadPlan (ThreadPlan::eKindTestCondition, "test condition", thread, eVoteNoOpinion, eVoteNoOpinion),
|
||||
m_expression (expression),
|
||||
m_exe_ctx (exe_ctx),
|
||||
|
|
|
@ -14,19 +14,6 @@ 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()
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue