diff options
author | Jim Ingham <jingham@apple.com> | 2010-06-16 02:00:15 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2010-06-16 02:00:15 +0000 |
commit | 1b54c88cc4f8582222644d65dfd61703206430ef (patch) | |
tree | 8f720e2946e32ece13de194e4ccfafffa21d9b3f /lldb/source/Breakpoint/BreakpointLocation.cpp | |
parent | babff2ce5644a5f2af3a9cac323c1a97f39a90a1 (diff) | |
download | bcm5719-llvm-1b54c88cc4f8582222644d65dfd61703206430ef.tar.gz bcm5719-llvm-1b54c88cc4f8582222644d65dfd61703206430ef.zip |
Add a "thread specification" class that specifies thread specific breakpoints by name, index, queue or TID.
Push this through all the breakpoint management code. Allow this to be set when the breakpoint is created.
Fix the Process classes so that a breakpoint hit that is not for a particular thread is not reported as a
breakpoint hit event for that thread.
Added a "breakpoint configure" command to allow you to reset any of the thread
specific options (or the ignore count.)
llvm-svn: 106078
Diffstat (limited to 'lldb/source/Breakpoint/BreakpointLocation.cpp')
-rw-r--r-- | lldb/source/Breakpoint/BreakpointLocation.cpp | 40 |
1 files changed, 24 insertions, 16 deletions
diff --git a/lldb/source/Breakpoint/BreakpointLocation.cpp b/lldb/source/Breakpoint/BreakpointLocation.cpp index 0f82829bdd7..e00afcad750 100644 --- a/lldb/source/Breakpoint/BreakpointLocation.cpp +++ b/lldb/source/Breakpoint/BreakpointLocation.cpp @@ -22,6 +22,7 @@ #include "lldb/Core/StreamString.h" #include "lldb/lldb-private-log.h" #include "lldb/Target/Thread.h" +#include "lldb/Target/ThreadSpec.h" using namespace lldb; using namespace lldb_private; @@ -34,12 +35,13 @@ BreakpointLocation::BreakpointLocation lldb::tid_t tid, bool hardware ) : - StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), tid, hardware), + StoppointLocation (loc_id, addr.GetLoadAddress(owner.GetTarget().GetProcessSP().get()), hardware), m_address (addr), m_owner (owner), m_options_ap (), m_bp_site_sp () { + SetThreadID (tid); } BreakpointLocation::~BreakpointLocation() @@ -93,13 +95,15 @@ BreakpointLocation::SetEnabled (bool enabled) void BreakpointLocation::SetThreadID (lldb::tid_t thread_id) { - GetLocationOptions()->SetThreadID(thread_id); -} - -lldb::tid_t -BreakpointLocation::GetThreadID () -{ - return GetOptionsNoCopy()->GetThreadID(); + if (thread_id != LLDB_INVALID_THREAD_ID) + GetLocationOptions()->SetThreadID(thread_id); + else + { + // If we're resetting this to an invalid thread id, then + // don't make an options pointer just to do that. + if (m_options_ap.get() != NULL) + m_options_ap->SetThreadID (thread_id); + } } bool @@ -150,8 +154,8 @@ BreakpointLocation::SetIgnoreCount (int32_t n) GetLocationOptions()->SetIgnoreCount(n); } -BreakpointOptions * -BreakpointLocation::GetOptionsNoCopy () +const BreakpointOptions * +BreakpointLocation::GetOptionsNoCopy () const { if (m_options_ap.get() != NULL) return m_options_ap.get(); @@ -168,8 +172,16 @@ BreakpointLocation::GetLocationOptions () return m_options_ap.get(); } +bool +BreakpointLocation::ValidForThisThread (Thread *thread) +{ + return thread->MatchesSpec(GetOptionsNoCopy()->GetThreadSpec()); +} + // RETURNS - true if we should stop at this breakpoint, false if we -// should continue. +// should continue. Note, we don't check the thread spec for the breakpoint +// here, since if the breakpoint is not for this thread, then the event won't +// even get reported, so the check is redundant. bool BreakpointLocation::ShouldStop (StoppointCallbackContext *context) @@ -181,10 +193,6 @@ BreakpointLocation::ShouldStop (StoppointCallbackContext *context) if (!IsEnabled()) return false; - if (GetThreadID() != LLDB_INVALID_THREAD_ID - && context->context.thread->GetID() != GetThreadID()) - return false; - if (m_hit_count <= GetIgnoreCount()) return false; @@ -379,7 +387,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(), - m_tid, + GetOptionsNoCopy()->GetThreadSpec()->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", |