mirror of
https://github.com/intel/llvm.git
synced 2026-01-16 21:55:39 +08:00
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
This commit is contained in:
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user