diff options
author | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-15 01:18:15 +0000 |
---|---|---|
committer | Jonas Devlieghere <jonas@devlieghere.com> | 2018-11-15 01:18:15 +0000 |
commit | e103ae92ef2336854587778bd3ae88a87e409a5e (patch) | |
tree | a474b4d1db388480dd129f0ab61a690a4f504ca5 /lldb/source/Target/ThreadPlanStepOverRange.cpp | |
parent | df14b94243e9e8ade2747e6adb8a3d9d2cfa71ae (diff) | |
download | bcm5719-llvm-e103ae92ef2336854587778bd3ae88a87e409a5e.tar.gz bcm5719-llvm-e103ae92ef2336854587778bd3ae88a87e409a5e.zip |
Add setting to require hardware breakpoints.
When debugging read-only memory we cannot use software breakpoint. We
already have support for hardware breakpoints and users can specify them
with `-H`. However, there's no option to force LLDB to use hardware
breakpoints internally, for example while stepping.
This patch adds a setting target.require-hardware-breakpoint that forces
LLDB to always use hardware breakpoints. Because hardware breakpoints
are a limited resource and can fail to resolve, this patch also extends
error handling in thread plans, where breakpoints are used for stepping.
Differential revision: https://reviews.llvm.org/D54221
llvm-svn: 346920
Diffstat (limited to 'lldb/source/Target/ThreadPlanStepOverRange.cpp')
-rw-r--r-- | lldb/source/Target/ThreadPlanStepOverRange.cpp | 32 |
1 files changed, 21 insertions, 11 deletions
diff --git a/lldb/source/Target/ThreadPlanStepOverRange.cpp b/lldb/source/Target/ThreadPlanStepOverRange.cpp index 2043b96ba9a..a9fff1be124 100644 --- a/lldb/source/Target/ThreadPlanStepOverRange.cpp +++ b/lldb/source/Target/ThreadPlanStepOverRange.cpp @@ -47,10 +47,18 @@ ThreadPlanStepOverRange::~ThreadPlanStepOverRange() = default; void ThreadPlanStepOverRange::GetDescription(Stream *s, lldb::DescriptionLevel level) { + auto PrintFailureIfAny = [&]() { + if (m_status.Success()) + return; + s->Printf(" failed (%s)", m_status.AsCString()); + }; + if (level == lldb::eDescriptionLevelBrief) { s->Printf("step over"); + PrintFailureIfAny(); return; } + s->Printf("Stepping over"); bool printed_line_info = false; if (m_addr_context.line_entry.IsValid()) { @@ -64,6 +72,8 @@ void ThreadPlanStepOverRange::GetDescription(Stream *s, DumpRanges(s); } + PrintFailureIfAny(); + s->PutChar('.'); } @@ -147,8 +157,8 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { // because the trampoline confused the backtracer. As below, we step // through first, and then try to figure out how to get back out again. - new_plan_sp = - m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, stop_others); + new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, + stop_others, m_status); if (new_plan_sp && log) log->Printf( @@ -169,11 +179,11 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { if (IsEquivalentContext(older_context)) { new_plan_sp = m_thread.QueueThreadPlanForStepOutNoShouldStop( false, nullptr, true, stop_others, eVoteNo, eVoteNoOpinion, 0, - true); + m_status, true); break; } else { - new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, - stop_others); + new_plan_sp = m_thread.QueueThreadPlanForStepThrough( + m_stack_id, false, stop_others, m_status); // If we found a way through, then we should stop recursing. if (new_plan_sp) break; @@ -192,8 +202,8 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { // we are in a stub then it's likely going to be hard to get out from // here. It is probably easiest to step into the stub, and then it will // be straight-forward to step out. - new_plan_sp = m_thread.QueueThreadPlanForStepThrough(m_stack_id, false, - stop_others); + new_plan_sp = m_thread.QueueThreadPlanForStepThrough( + m_stack_id, false, stop_others, m_status); } else { // The current clang (at least through 424) doesn't always get the // address range for the DW_TAG_inlined_subroutines right, so that when @@ -283,8 +293,8 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { cur_pc); new_plan_sp = m_thread.QueueThreadPlanForStepOverRange( - abort_other_plans, step_range, sc, - stop_other_threads); + abort_other_plans, step_range, sc, stop_other_threads, + m_status); break; } look_ahead_step++; @@ -305,7 +315,7 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { // If we haven't figured out something to do yet, then ask the ShouldStopHere // callback: if (!new_plan_sp) { - new_plan_sp = CheckShouldStopHereAndQueueStepOut(frame_order); + new_plan_sp = CheckShouldStopHereAndQueueStepOut(frame_order, m_status); } if (!new_plan_sp) @@ -319,7 +329,7 @@ bool ThreadPlanStepOverRange::ShouldStop(Event *event_ptr) { if (!new_plan_sp) { // For efficiencies sake, we know we're done here so we don't have to do // this calculation again in MischiefManaged. - SetPlanComplete(); + SetPlanComplete(m_status.Success()); return true; } else return false; |