Make an explicit GetThreadSpecNoCreate accessor so you don't have to get the const-ness right to ensure you are not making a copy of the owning breakpoint's ThreadSpec in a breakpoint location. Also change the name from NoCopy to NoCreate since that's clearer.

llvm-svn: 106578
This commit is contained in:
Jim Ingham 2010-06-22 21:12:54 +00:00
parent 6250bd9e3c
commit 05407f6b25
6 changed files with 18 additions and 15 deletions

View File

@ -251,14 +251,16 @@ public:
GetLocationOptions ();
//------------------------------------------------------------------
/// Use this to access location specific breakpoint options.
/// Use this to access breakpoint options from this breakpoint location.
/// This will point to the owning breakpoint's options unless options have
/// been set specifically on this location.
///
/// @return
/// A pointer to the containing breakpoint's options if this
/// location doesn't have its own copy.
//------------------------------------------------------------------
const BreakpointOptions *
GetOptionsNoCopy () const;
GetOptionsNoCreate () const;
bool
ValidForThisThread (Thread *thread);

View File

@ -125,13 +125,14 @@ public:
//------------------------------------------------------------------
//------------------------------------------------------------------
/// Return the current thread spec. This is used to pass to Thread::MatchesSpec.
/// Return the current thread spec for this option. This will return NULL if the no thread
/// specifications have been set for this Option yet.
/// @return
/// The thread specification pointer for this option, or NULL if none has
/// been set yet.
//------------------------------------------------------------------
const ThreadSpec *
GetThreadSpec () const;
GetThreadSpecNoCreate () const;
//------------------------------------------------------------------
/// Returns a pointer to the ThreadSpec for this option, creating it.

View File

@ -104,7 +104,7 @@ SBBreakpointLocation::GetThreadID ()
{
tid_t sb_thread_id = (lldb::tid_t) LLDB_INVALID_THREAD_ID;
if (m_break_loc_sp)
sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpec()->GetTID();
sb_thread_id = m_break_loc_sp->GetLocationOptions()->GetThreadSpecNoCreate()->GetTID();
return sb_thread_id;
}
@ -121,7 +121,7 @@ SBBreakpointLocation::GetThreadIndex() const
{
if (m_break_loc_sp)
{
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return 0;
else
@ -143,7 +143,7 @@ SBBreakpointLocation::GetThreadName () const
{
if (m_break_loc_sp)
{
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else
@ -164,7 +164,7 @@ SBBreakpointLocation::GetQueueName () const
{
if (m_break_loc_sp)
{
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCopy()->GetThreadSpec();
const ThreadSpec *thread_spec = m_break_loc_sp->GetOptionsNoCreate()->GetThreadSpecNoCreate();
if (thread_spec == NULL)
return NULL;
else

View File

@ -140,7 +140,7 @@ BreakpointLocation::ClearCallback ()
int32_t
BreakpointLocation::GetIgnoreCount ()
{
return GetOptionsNoCopy()->GetIgnoreCount();
return GetOptionsNoCreate()->GetIgnoreCount();
}
void
@ -150,7 +150,7 @@ BreakpointLocation::SetIgnoreCount (int32_t n)
}
const BreakpointOptions *
BreakpointLocation::GetOptionsNoCopy () const
BreakpointLocation::GetOptionsNoCreate () const
{
if (m_options_ap.get() != NULL)
return m_options_ap.get();
@ -173,7 +173,7 @@ BreakpointLocation::GetLocationOptions ()
bool
BreakpointLocation::ValidForThisThread (Thread *thread)
{
return thread->MatchesSpec(GetOptionsNoCopy()->GetThreadSpec());
return thread->MatchesSpec(GetOptionsNoCreate()->GetThreadSpecNoCreate());
}
// RETURNS - true if we should stop at this breakpoint, false if we
@ -383,7 +383,7 @@ BreakpointLocation::Dump(Stream *s) const
s->Printf("BreakpointLocation %u: tid = %4.4x load addr = 0x%8.8llx state = %s type = %s breakpoint "
"hw_index = %i hit_count = %-4u ignore_count = %-4u",
GetID(),
GetOptionsNoCopy()->GetThreadSpec()->GetTID(),
GetOptionsNoCreate()->GetThreadSpecNoCreate()->GetTID(),
(uint64_t) m_address.GetLoadAddress(m_owner.GetTarget().GetProcessSP().get()),
(m_options_ap.get() ? m_options_ap->IsEnabled() : m_owner.IsEnabled()) ? "enabled " : "disabled",
IsHardware() ? "hardware" : "software",

View File

@ -173,7 +173,7 @@ BreakpointOptions::SetIgnoreCount (int32_t n)
}
const ThreadSpec *
BreakpointOptions::GetThreadSpec () const
BreakpointOptions::GetThreadSpecNoCreate () const
{
return m_thread_spec_ap.get();
}
@ -200,7 +200,7 @@ BreakpointOptions::GetDescription (Stream *s, lldb::DescriptionLevel level) cons
// Figure out if there are any options not at their default value, and only print
// anything if there are:
if (m_ignore_count != 0 || !m_enabled || (GetThreadSpec() != NULL && GetThreadSpec()->HasSpecification ()))
if (m_ignore_count != 0 || !m_enabled || (GetThreadSpecNoCreate() != NULL && GetThreadSpecNoCreate()->HasSpecification ()))
{
if (level == lldb::eDescriptionLevelVerbose)
{

View File

@ -536,7 +536,7 @@ CommandObjectBreakpointCommandList::Execute (Args& command,
{
BreakpointLocationSP bp_loc_sp(bp->FindLocationByID (cur_bp_id.GetLocationID()));
if (bp_loc_sp)
bp_options = bp_loc_sp->GetOptionsNoCopy();
bp_options = bp_loc_sp->GetOptionsNoCreate();
else
{
result.AppendErrorWithFormat("Invalid breakpoint ID: %u.%u.\n",