def test_hw_break_set_delete_multi_thread_linux(self):
self.build()
self.setTearDownCleanup()
- self.break_multi_thread('delete', 'breakpoint')
+ self.break_multi_thread('delete')
# LLDB on linux supports hardware breakpoints for arm and aarch64
# architectures.
def test_hw_break_set_disable_multi_thread_linux(self):
self.build()
self.setTearDownCleanup()
- self.break_multi_thread('disable', 'breakpoint')
+ self.break_multi_thread('disable')
# LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
# i386 architectures.
def test_hw_break_set_delete_multi_thread_macos(self):
self.build()
self.setTearDownCleanup()
- self.break_multi_thread('delete', 'EXC_BREAKPOINT')
+ self.break_multi_thread('delete')
# LLDB on darwin supports hardware breakpoints for arm, aarch64, x86_64 and
# i386 architectures.
def test_hw_break_set_disable_multi_thread_macos(self):
self.build()
self.setTearDownCleanup()
- self.break_multi_thread('disable', 'EXC_BREAKPOINT')
+ self.break_multi_thread('disable')
def setUp(self):
self.first_stop = line_number(
self.source, 'Starting thread creation with hardware breakpoint set')
- def break_multi_thread(self, removal_type, stop_reason):
+ def break_multi_thread(self, removal_type):
"""Test that lldb hardware breakpoints work for multiple threads."""
self.runCmd("file " + self.getBuildArtifact("a.out"),
CURRENT_EXECUTABLE_SET)
# The stop reason of the thread should be breakpoint.
self.expect("thread list", STOPPED_DUE_TO_BREAKPOINT,
substrs=[
- 'stop reason = {}'.format(stop_reason),
+ 'stop reason = breakpoint',
'hw_break_function'])
# Continue the loop and test that we are stopped 4 times.
#include "StopInfoMachException.h"
+#include "lldb/lldb-forward.h"
#if defined(__APPLE__)
// Needed for the EXC_RESOURCE interpretation macros
return m_description.c_str();
}
+static StopInfoSP GetStopInfoForHardwareBP(Thread &thread, Target *target,
+ uint32_t exc_data_count,
+ uint64_t exc_sub_code,
+ uint64_t exc_sub_sub_code) {
+ // Try hardware watchpoint.
+ if (target) {
+ // The exc_sub_code indicates the data break address.
+ lldb::WatchpointSP wp_sp =
+ target->GetWatchpointList().FindByAddress((lldb::addr_t)exc_sub_code);
+ if (wp_sp && wp_sp->IsEnabled()) {
+ // Debugserver may piggyback the hardware index of the fired watchpoint
+ // in the exception data. Set the hardware index if that's the case.
+ if (exc_data_count >= 3)
+ wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+ return StopInfo::CreateStopReasonWithWatchpointID(thread, wp_sp->GetID());
+ }
+ }
+
+ // Try hardware breakpoint.
+ ProcessSP process_sp(thread.GetProcess());
+ if (process_sp) {
+ // The exc_sub_code indicates the data break address.
+ lldb::BreakpointSiteSP bp_sp =
+ process_sp->GetBreakpointSiteList().FindByAddress(
+ (lldb::addr_t)exc_sub_code);
+ if (bp_sp && bp_sp->IsEnabled()) {
+ // Debugserver may piggyback the hardware index of the fired breakpoint
+ // in the exception data. Set the hardware index if that's the case.
+ if (exc_data_count >= 3)
+ bp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
+ return StopInfo::CreateStopReasonWithBreakpointSiteID(thread,
+ bp_sp->GetID());
+ }
+ }
+
+ return nullptr;
+}
+
StopInfoSP StopInfoMachException::CreateStopReasonWithMachException(
Thread &thread, uint32_t exc_type, uint32_t exc_data_count,
uint64_t exc_code, uint64_t exc_sub_code, uint64_t exc_sub_sub_code,
is_actual_breakpoint = true;
is_trace_if_actual_breakpoint_missing = true;
} else {
-
- // It's a watchpoint, then.
- // The exc_sub_code indicates the data break address.
- lldb::WatchpointSP wp_sp;
- if (target)
- wp_sp = target->GetWatchpointList().FindByAddress(
- (lldb::addr_t)exc_sub_code);
- if (wp_sp && wp_sp->IsEnabled()) {
- // Debugserver may piggyback the hardware index of the fired
- // watchpoint in the exception data. Set the hardware index if
- // that's the case.
- if (exc_data_count >= 3)
- wp_sp->SetHardwareIndex((uint32_t)exc_sub_sub_code);
- return StopInfo::CreateStopReasonWithWatchpointID(thread,
- wp_sp->GetID());
- }
+ if (StopInfoSP stop_info =
+ GetStopInfoForHardwareBP(thread, target, exc_data_count,
+ exc_sub_code, exc_sub_sub_code))
+ return stop_info;
}
} else if (exc_code == 2 || // EXC_I386_BPT
exc_code == 3) // EXC_I386_BPTFLT