Lines Matching refs:region

188   // Make sure we don't overflow the memory in region stacks:
303 RegionSet::iterator region = regions_->lower_bound(sample);
304 if (region != regions_->end()) {
305 RAW_CHECK(addr <= region->end_addr, "");
306 if (region->start_addr <= addr && addr < region->end_addr) {
307 return &(*region);
316 const Region* region = DoFindRegionLocked(addr);
317 if (region != NULL) *result = *region; // create it as an independent copy
319 return region != NULL;
325 const Region* region = DoFindRegionLocked(stack_top);
326 if (region != NULL) {
327 RAW_VLOG(10, "Stack at %p is inside region %p..%p",
329 reinterpret_cast<void*>(region->start_addr),
330 reinterpret_cast<void*>(region->end_addr));
331 const_cast<Region*>(region)->set_is_stack(); // now we know
333 *result = *region; // create *result as an independent copy
336 return region != NULL;
351 inline void MemoryRegionMap::DoInsertRegionLocked(const Region& region) {
352 RAW_VLOG(12, "Inserting region %p..%p from %p",
353 reinterpret_cast<void*>(region.start_addr),
354 reinterpret_cast<void*>(region.end_addr),
355 reinterpret_cast<void*>(region.caller()));
356 RegionSet::const_iterator i = regions_->lower_bound(region);
357 if (i != regions_->end() && i->start_addr <= region.start_addr) {
358 RAW_DCHECK(region.end_addr <= i->end_addr, ""); // lower_bound ensures this
359 return; // 'region' is a subset of an already recorded region; do nothing
364 RAW_CHECK(i == regions_->end() || !region.Overlaps(*i),
367 sample.SetRegionSetKey(region.start_addr);
369 RAW_CHECK(i == regions_->end() || !region.Overlaps(*i),
372 region.AssertIsConsistent(); // just making sure
373 // This inserts and allocates permanent storage for region
375 regions_->insert(region);
376 RAW_VLOG(12, "Inserted region %p..%p :",
377 reinterpret_cast<void*>(region.start_addr),
378 reinterpret_cast<void*>(region.end_addr));
386 // Number of unprocessed region inserts.
396 void (*insert_func)(const Region& region)) {
398 // Making a local-var copy of the region argument to insert_func
407 inline void MemoryRegionMap::InsertRegionLocked(const Region& region) {
412 // region insertion information is recorded in saved_regions[],
416 RAW_VLOG(12, "Saving recursive insert of region %p..%p from %p",
417 reinterpret_cast<void*>(region.start_addr),
418 reinterpret_cast<void*>(region.end_addr),
419 reinterpret_cast<void*>(region.caller()));
421 // Copy 'region' to saved_regions[saved_regions_count]
424 saved_regions[saved_regions_count++] = region;
427 RAW_VLOG(12, "Initializing region set");
436 DoInsertRegionLocked(region);
451 // Record start/end info about this memory acquisition call in a new region:
452 Region region;
453 region.Create(start, size);
454 // First get the call stack info into the local varible 'region':
457 ? MallocHook::GetCallerStackTrace(const_cast<void**>(region.call_stack),
460 region.set_call_stack_depth(depth); // record stack info fully
461 RAW_VLOG(10, "New global region %p..%p from %p",
462 reinterpret_cast<void*>(region.start_addr),
463 reinterpret_cast<void*>(region.end_addr),
464 reinterpret_cast<void*>(region.caller()));
468 InsertRegionLocked(region);
470 // from region.call_stack_data_ that is pointed by region.call_stack().
477 // First remove the removed region from saved_regions, if it's
491 RAW_VLOG(10, ("Insta-Removing saved region %p..%p; "
515 RAW_VLOG(10, "Removing global region %p..%p; have %"PRIuS" regions",
522 for (RegionSet::iterator region = regions_->lower_bound(sample);
523 region != regions_->end() && region->start_addr < end_addr;
525 RAW_VLOG(13, "Looking at region %p..%p",
526 reinterpret_cast<void*>(region->start_addr),
527 reinterpret_cast<void*>(region->end_addr));
528 if (start_addr <= region->start_addr &&
529 region->end_addr <= end_addr) { // full deletion
530 RAW_VLOG(12, "Deleting region %p..%p",
531 reinterpret_cast<void*>(region->start_addr),
532 reinterpret_cast<void*>(region->end_addr));
533 RegionSet::iterator d = region;
534 ++region;
537 } else if (region->start_addr < start_addr &&
538 end_addr < region->end_addr) { // cutting-out split
539 RAW_VLOG(12, "Splitting region %p..%p in two",
540 reinterpret_cast<void*>(region->start_addr),
541 reinterpret_cast<void*>(region->end_addr));
542 // Make another region for the start portion:
543 // The new region has to be the start portion because we can't
544 // just modify region->end_addr as it's the sorting key.
545 Region r = *region;
548 // cut *region from start:
549 const_cast<Region&>(*region).set_start_addr(end_addr);
550 } else if (end_addr > region->start_addr &&
551 start_addr <= region->start_addr) { // cut from start
552 RAW_VLOG(12, "Start-chopping region %p..%p",
553 reinterpret_cast<void*>(region->start_addr),
554 reinterpret_cast<void*>(region->end_addr));
555 const_cast<Region&>(*region).set_start_addr(end_addr);
556 } else if (start_addr > region->start_addr &&
557 start_addr < region->end_addr) { // cut from end
558 RAW_VLOG(12, "End-chopping region %p..%p",
559 reinterpret_cast<void*>(region->start_addr),
560 reinterpret_cast<void*>(region->end_addr));
561 // Can't just modify region->end_addr (it's the sorting key):
562 Region r = *region;
564 RegionSet::iterator d = region;
565 ++region;
572 ++region;
574 RAW_VLOG(12, "Removed region %p..%p; have %"PRIuS" regions",
644 RAW_LOG(INFO, "Memory region 0x%"PRIxPTR"..0x%"PRIxPTR" "