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/ThreadPlanStepOut.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/ThreadPlanStepOut.cpp')
-rw-r--r-- | lldb/source/Target/ThreadPlanStepOut.cpp | 27 |
1 files changed, 20 insertions, 7 deletions
diff --git a/lldb/source/Target/ThreadPlanStepOut.cpp b/lldb/source/Target/ThreadPlanStepOut.cpp index db8ab9fb5b6..378de53fafd 100644 --- a/lldb/source/Target/ThreadPlanStepOut.cpp +++ b/lldb/source/Target/ThreadPlanStepOut.cpp @@ -129,7 +129,10 @@ ThreadPlanStepOut::ThreadPlanStepOut( Breakpoint *return_bp = m_thread.CalculateTarget() ->CreateBreakpoint(m_return_addr, true, false) .get(); + if (return_bp != nullptr) { + if (return_bp->IsHardware() && !return_bp->HasResolvedLocations()) + m_could_not_resolve_hw_bp = true; return_bp->SetThreadID(m_thread.GetID()); m_return_bp_id = return_bp->GetID(); return_bp->SetBreakpointKind("step-out"); @@ -223,14 +226,24 @@ void ThreadPlanStepOut::GetDescription(Stream *s, bool ThreadPlanStepOut::ValidatePlan(Stream *error) { if (m_step_out_to_inline_plan_sp) return m_step_out_to_inline_plan_sp->ValidatePlan(error); - else if (m_step_through_inline_plan_sp) + + if (m_step_through_inline_plan_sp) return m_step_through_inline_plan_sp->ValidatePlan(error); - else if (m_return_bp_id == LLDB_INVALID_BREAK_ID) { + + if (m_could_not_resolve_hw_bp) { + if (error) + error->PutCString( + "Could not create hardware breakpoint for thread plan."); + return false; + } + + if (m_return_bp_id == LLDB_INVALID_BREAK_ID) { if (error) error->PutCString("Could not create return address breakpoint."); return false; - } else - return true; + } + + return true; } bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) { @@ -277,7 +290,7 @@ bool ThreadPlanStepOut::DoPlanExplainsStop(Event *event_ptr) { } if (done) { - if (InvokeShouldStopHereCallback(eFrameCompareOlder)) { + if (InvokeShouldStopHereCallback(eFrameCompareOlder, m_status)) { CalculateReturnValue(); SetPlanComplete(); } @@ -339,12 +352,12 @@ bool ThreadPlanStepOut::ShouldStop(Event *event_ptr) { // is consult the ShouldStopHere, and we are done. if (done) { - if (InvokeShouldStopHereCallback(eFrameCompareOlder)) { + if (InvokeShouldStopHereCallback(eFrameCompareOlder, m_status)) { CalculateReturnValue(); SetPlanComplete(); } else { m_step_out_further_plan_sp = - QueueStepOutFromHerePlan(m_flags, eFrameCompareOlder); + QueueStepOutFromHerePlan(m_flags, eFrameCompareOlder, m_status); done = false; } } |