diff options
author | Jim Ingham <jingham@apple.com> | 2012-10-16 00:09:33 +0000 |
---|---|---|
committer | Jim Ingham <jingham@apple.com> | 2012-10-16 00:09:33 +0000 |
commit | 5d88a068eed8625b9668db9f6b254ae5d2a0e187 (patch) | |
tree | 107a171d4e7d5594649bcd7db199c77446dbbe87 /lldb/source/Target/Thread.cpp | |
parent | 244beb42cee42a2ba367772d2d2a8bb04c98991f (diff) | |
download | bcm5719-llvm-5d88a068eed8625b9668db9f6b254ae5d2a0e187.tar.gz bcm5719-llvm-5d88a068eed8625b9668db9f6b254ae5d2a0e187.zip |
Patch from Matt Kopec <matt.kopec@intel.com> to fix the problem that if two breakpoints were set on consecutive addresses, the continue from the
first breakpoint would skip the second.
llvm-svn: 166000
Diffstat (limited to 'lldb/source/Target/Thread.cpp')
-rw-r--r-- | lldb/source/Target/Thread.cpp | 29 |
1 files changed, 25 insertions, 4 deletions
diff --git a/lldb/source/Target/Thread.cpp b/lldb/source/Target/Thread.cpp index 6e505f2119b..39157dd148f 100644 --- a/lldb/source/Target/Thread.cpp +++ b/lldb/source/Target/Thread.cpp @@ -440,9 +440,11 @@ Thread::SetupForResume () // telling the current plan it will resume, since we might change what the current // plan is. - lldb::addr_t pc = GetRegisterContext()->GetPC(); - BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc); - if (bp_site_sp && bp_site_sp->IsEnabled()) + StopReason stop_reason = lldb::eStopReasonInvalid; + StopInfoSP stop_info_sp = GetStopInfo(); + if (stop_info_sp.get()) + stop_reason = stop_info_sp->GetStopReason(); + if (stop_reason == lldb::eStopReasonBreakpoint) { // Note, don't assume there's a ThreadPlanStepOverBreakpoint, the target may not require anything // special to step over a breakpoint. @@ -506,7 +508,7 @@ Thread::WillResume (StateType resume_state) // If the WillResume for the plan says we are faking a resume, then it will have set an appropriate stop info. // In that case, don't reset it here. - if (need_to_resume) + if (need_to_resume && resume_state != eStateSuspended) { m_actual_stop_info_sp.reset(); } @@ -1713,3 +1715,22 @@ Thread::Flush () ClearStackFrames (); m_reg_context_sp.reset(); } + +const bool +Thread::IsStillAtLastBreakpointHit () +{ + // If we are currently stopped at a breakpoint, always return that stopinfo and don't reset it. + // This allows threads to maintain their breakpoint stopinfo, such as when thread-stepping in + // multithreaded programs. + if (m_actual_stop_info_sp) { + StopReason stop_reason = m_actual_stop_info_sp->GetStopReason(); + if (stop_reason == lldb::eStopReasonBreakpoint) { + uint64_t value = m_actual_stop_info_sp->GetValue(); + lldb::addr_t pc = GetRegisterContext()->GetPC(); + BreakpointSiteSP bp_site_sp = GetProcess()->GetBreakpointSiteList().FindByAddress(pc); + if (bp_site_sp && value == bp_site_sp->GetID()) + return true; + } + } + return false; +} |