23std::vector<WatchpointResourceSP>
25 addr_t addr,
size_t size,
bool read,
bool write,
26 WatchpointHardwareFeature supported_features,
ArchSpec &arch) {
28 std::vector<Region> entries;
30 if (supported_features & eWatchpointHardwareArmMASK) {
47 LLDB_LOGV(log,
"AtomizeWatchpointRequest user request addr {0:x} size {1}",
49 std::vector<WatchpointResourceSP> resources;
50 for (
Region &ent : entries) {
51 LLDB_LOGV(log,
"AtomizeWatchpointRequest creating resource {0:x} size {1}",
54 std::make_shared<WatchpointResource>(ent.addr, ent.size, read, write);
55 resources.push_back(wp_res_sp);
65 if (input <= 1 || llvm::popcount(input) == 1)
68 return 1ULL << (64 - llvm::countl_zero(input));
84std::vector<WatchpointAlgorithms::Region>
88 uint32_t address_byte_size) {
92 "AtomizeWatchpointRequest user request addr {0:x} size {1} "
93 "min_byte_size {2}, max_byte_size {3}, address_byte_size {4}",
94 user_addr, user_size, min_byte_size, max_byte_size,
101 size_t aligned_size = std::max(user_size, min_byte_size);
105 aligned_size =
bit_ceil(aligned_size);
107 addr_t aligned_start = user_addr & ~(aligned_size - 1);
111 if (aligned_size <= max_byte_size &&
112 aligned_start + aligned_size >= user_addr + user_size)
113 return {{aligned_start, aligned_size}};
128 if (max_byte_size >= (aligned_size << 1)) {
130 aligned_start = user_addr & ~(aligned_size - 1);
131 if (aligned_size <= max_byte_size &&
132 aligned_start + aligned_size >= user_addr + user_size)
133 return {{aligned_start, aligned_size}};
143 aligned_size = std::min(aligned_size, max_byte_size);
144 aligned_start = user_addr & ~(aligned_size - 1);
146 std::vector<Region> result;
147 addr_t current_address = aligned_start;
148 const addr_t user_end_address = user_addr + user_size;
149 while (current_address + aligned_size < user_end_address) {
150 result.push_back({current_address, aligned_size});
151 current_address += aligned_size;
154 if (current_address < user_end_address)
155 result.push_back({current_address, aligned_size});
#define LLDB_LOGV(log,...)
static uint64_t bit_ceil(uint64_t input)
An architecture specification class.
uint32_t GetAddressByteSize() const
Returns the size in bytes of an address of the current architecture.
static std::vector< Region > PowerOf2Watchpoints(lldb::addr_t user_addr, size_t user_size, size_t min_byte_size, size_t max_byte_size, uint32_t address_byte_size)
Convert a user's watchpoint request into an array of Regions, each of which can be watched by a singl...
static std::vector< lldb::WatchpointResourceSP > AtomizeWatchpointRequest(lldb::addr_t addr, size_t size, bool read, bool write, WatchpointHardwareFeature supported_features, ArchSpec &arch)
Convert a user's watchpoint request into an array of memory regions, each region watched by one hardw...
A class that represents a running process on the host machine.
Log * GetLog(Cat mask)
Retrieve the Log object for the channel associated with the given log enum.
std::shared_ptr< lldb_private::WatchpointResource > WatchpointResourceSP