MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / AddRegion

Method AddRegion

view/sharedcache/core/SharedCache.cpp:178–210  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

176}
177
178void SharedCache::AddRegion(CacheRegion&& region)
179{
180 // Handle overlapping regions here.
181 const auto regionRange = region.AsAddressRange();
182 // First region at or past the start of the region.
183 const auto begin = m_regions.lower_bound(regionRange.start);
184 if (begin == m_regions.end())
185 {
186 AddNonOverlappingRegion(std::move(region));
187 return;
188 }
189
190 // First region past the end of the region.
191 const auto end = m_regions.lower_bound(regionRange.end);
192
193 for (auto it = begin; it != end; ++it)
194 {
195 const uint64_t newRegionSize = it->second.start - region.start;
196 if (newRegionSize)
197 {
198 CacheRegion newRegion(region);
199 newRegion.size = newRegionSize;
200 AddNonOverlappingRegion(std::move(newRegion));
201 }
202
203 region.start = it->second.start + it->second.size;
204 region.size -= (newRegionSize + it->second.size);
205 }
206
207 // Add remaining region.
208 if (region.size > 0)
209 AddNonOverlappingRegion(std::move(region));
210}
211
212bool SharedCache::AddNonOverlappingRegion(CacheRegion region)
213{

Callers

nothing calls this directly

Calls 2

AsAddressRangeMethod · 0.80
endMethod · 0.45

Tested by

no test coverage detected