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/ThreadPlanStepThrough.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/ThreadPlanStepThrough.cpp')
-rw-r--r-- | lldb/source/Target/ThreadPlanStepThrough.cpp | 25 |
1 files changed, 24 insertions, 1 deletions
diff --git a/lldb/source/Target/ThreadPlanStepThrough.cpp b/lldb/source/Target/ThreadPlanStepThrough.cpp index b373edbf8f3..d1f3c2219f6 100644 --- a/lldb/source/Target/ThreadPlanStepThrough.cpp +++ b/lldb/source/Target/ThreadPlanStepThrough.cpp @@ -58,7 +58,10 @@ ThreadPlanStepThrough::ThreadPlanStepThrough(Thread &thread, ->GetTarget() .CreateBreakpoint(m_backstop_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_backstop_bkpt_id = return_bp->GetID(); return_bp->SetBreakpointKind("step-through-backstop"); @@ -135,7 +138,26 @@ void ThreadPlanStepThrough::GetDescription(Stream *s, } bool ThreadPlanStepThrough::ValidatePlan(Stream *error) { - return m_sub_plan_sp.get() != nullptr; + if (m_could_not_resolve_hw_bp) { + if (error) + error->PutCString( + "Could not create hardware breakpoint for thread plan."); + return false; + } + + if (m_backstop_bkpt_id == LLDB_INVALID_BREAK_ID) { + if (error) + error->PutCString("Could not create backstop breakpoint."); + return false; + } + + if (!m_sub_plan_sp.get()) { + if (error) + error->PutCString("Does not have a subplan."); + return false; + } + + return true; } bool ThreadPlanStepThrough::DoPlanExplainsStop(Event *event_ptr) { @@ -211,6 +233,7 @@ void ThreadPlanStepThrough::ClearBackstopBreakpoint() { if (m_backstop_bkpt_id != LLDB_INVALID_BREAK_ID) { m_thread.GetProcess()->GetTarget().RemoveBreakpointByID(m_backstop_bkpt_id); m_backstop_bkpt_id = LLDB_INVALID_BREAK_ID; + m_could_not_resolve_hw_bp = false; } } |