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
This commit is contained in:
Jim Ingham
2010-06-16 02:00:15 +00:00
parent babff2ce56
commit 1b54c88cc4
29 changed files with 804 additions and 142 deletions

View File

@@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
#include "lldb/lldb-private-log.h"
#include "lldb/Breakpoint/BreakpointLocation.h"
#include "lldb/Core/Log.h"
#include "lldb/Core/Stream.h"
#include "lldb/Core/StreamString.h"
@@ -29,6 +30,7 @@
#include "lldb/Target/ThreadPlanStepOverRange.h"
#include "lldb/Target/ThreadPlanRunToAddress.h"
#include "lldb/Target/ThreadPlanStepUntil.h"
#include "lldb/Target/ThreadSpec.h"
using namespace lldb;
using namespace lldb_private;
@@ -292,14 +294,25 @@ Thread::StopInfo::Dump (Stream *s) const
case eStopReasonBreakpoint:
{
bool no_details = true;
s->PutCString ("breakpoint ");
s->PutCString ("breakpoint");
if (m_thread)
{
BreakpointSiteSP bp_site_sp = m_thread->GetProcess().GetBreakpointSiteList().FindByID(m_details.breakpoint.bp_site_id);
if (bp_site_sp)
{
bp_site_sp->GetDescription(s, lldb::eDescriptionLevelBrief);
no_details = false;
// Only report the breakpoint locations that actually caused this hit - some of them may
// have options that would have caused us not to stop here...
uint32_t num_locations = bp_site_sp->GetNumberOfOwners();
for (uint32_t i = 0; i < num_locations; i++)
{
BreakpointLocationSP bp_loc_sp = bp_site_sp->GetOwnerAtIndex(i);
if (bp_loc_sp->ValidForThisThread(m_thread))
{
s->PutCString(" ");
bp_loc_sp->GetDescription(s, lldb::eDescriptionLevelBrief);
no_details = false;
}
}
}
}
@@ -599,6 +612,27 @@ Thread::ShouldReportRun (Event* event_ptr)
return GetCurrentPlan()->ShouldReportRun (event_ptr);
}
bool
Thread::MatchesSpec (const ThreadSpec *spec)
{
if (spec == NULL)
return true;
if (!spec->TIDMatches(GetID()))
return false;
if (!spec->IndexMatches(GetIndexID()))
return false;
if (!spec->NameMatches (GetName()))
return false;
if (!spec->QueueNameMatches (GetQueueName()))
return false;
return true;
}
void
Thread::PushPlan (ThreadPlanSP &thread_plan_sp)
{
@@ -990,7 +1024,7 @@ void
Thread::DumpThreadPlans (lldb_private::Stream *s) const
{
uint32_t stack_size = m_plan_stack.size();
s->Printf ("Plan Stack: %d elements.\n", stack_size);
s->Printf ("Plan Stack for thread #%u: tid = 0x%4.4x - %d elements.\n", GetIndexID(), GetID(), stack_size);
for (int i = stack_size - 1; i > 0; i--)
{
s->Printf ("Element %d: ", i);