| OLD | NEW |
| 1 /* Copyright (c) 2006, Google Inc. | 1 /* Copyright (c) 2006, Google Inc. |
| 2 * All rights reserved. | 2 * All rights reserved. |
| 3 * | 3 * |
| 4 * Redistribution and use in source and binary forms, with or without | 4 * Redistribution and use in source and binary forms, with or without |
| 5 * modification, are permitted provided that the following conditions are | 5 * modification, are permitted provided that the following conditions are |
| 6 * met: | 6 * met: |
| 7 * | 7 * |
| 8 * * Redistributions of source code must retain the above copyright | 8 * * Redistributions of source code must retain the above copyright |
| 9 * notice, this list of conditions and the following disclaimer. | 9 * notice, this list of conditions and the following disclaimer. |
| 10 * * Redistributions in binary form must reproduce the above | 10 * * Redistributions in binary form must reproduce the above |
| (...skipping 564 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 575 if (VLOG_IS_ON(12)) LogAllLocked(); | 575 if (VLOG_IS_ON(12)) LogAllLocked(); |
| 576 Unlock(); | 576 Unlock(); |
| 577 } | 577 } |
| 578 | 578 |
| 579 void MemoryRegionMap::MmapHook(const void* result, | 579 void MemoryRegionMap::MmapHook(const void* result, |
| 580 const void* start, size_t size, | 580 const void* start, size_t size, |
| 581 int prot, int flags, | 581 int prot, int flags, |
| 582 int fd, off_t offset) { | 582 int fd, off_t offset) { |
| 583 // TODO(maxim): replace all 0x%"PRIxS" by %p when RAW_VLOG uses a safe | 583 // TODO(maxim): replace all 0x%"PRIxS" by %p when RAW_VLOG uses a safe |
| 584 // snprintf reimplementation that does not malloc to pretty-print NULL | 584 // snprintf reimplementation that does not malloc to pretty-print NULL |
| 585 RAW_VLOG(10, "MMap = 0x%"PRIxPTR" of %"PRIuS" at %llu " | 585 RAW_VLOG(10, "MMap = 0x%"PRIxPTR" of %"PRIuS" at %"PRIu64" " |
| 586 "prot %d flags %d fd %d offs %lld", | 586 "prot %d flags %d fd %d offs %"PRId64, |
| 587 reinterpret_cast<uintptr_t>(result), size, | 587 reinterpret_cast<uintptr_t>(result), size, |
| 588 reinterpret_cast<uint64>(start), prot, flags, fd, | 588 reinterpret_cast<uint64>(start), prot, flags, fd, |
| 589 static_cast<int64>(offset)); | 589 static_cast<int64>(offset)); |
| 590 if (result != reinterpret_cast<void*>(MAP_FAILED) && size != 0) { | 590 if (result != reinterpret_cast<void*>(MAP_FAILED) && size != 0) { |
| 591 RecordRegionAddition(result, size); | 591 RecordRegionAddition(result, size); |
| 592 } | 592 } |
| 593 } | 593 } |
| 594 | 594 |
| 595 void MemoryRegionMap::MunmapHook(const void* ptr, size_t size) { | 595 void MemoryRegionMap::MunmapHook(const void* ptr, size_t size) { |
| 596 RAW_VLOG(10, "MUnmap of %p %"PRIuS"", ptr, size); | 596 RAW_VLOG(10, "MUnmap of %p %"PRIuS"", ptr, size); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 639 r != regions_->end(); ++r) { | 639 r != regions_->end(); ++r) { |
| 640 RAW_LOG(INFO, "Memory region 0x%"PRIxPTR"..0x%"PRIxPTR" " | 640 RAW_LOG(INFO, "Memory region 0x%"PRIxPTR"..0x%"PRIxPTR" " |
| 641 "from 0x%"PRIxPTR" stack=%d", | 641 "from 0x%"PRIxPTR" stack=%d", |
| 642 r->start_addr, r->end_addr, r->caller(), r->is_stack); | 642 r->start_addr, r->end_addr, r->caller(), r->is_stack); |
| 643 RAW_CHECK(previous < r->end_addr, "wow, we messed up the set order"); | 643 RAW_CHECK(previous < r->end_addr, "wow, we messed up the set order"); |
| 644 // this must be caused by uncontrolled recursive operations on regions_ | 644 // this must be caused by uncontrolled recursive operations on regions_ |
| 645 previous = r->end_addr; | 645 previous = r->end_addr; |
| 646 } | 646 } |
| 647 RAW_LOG(INFO, "End of regions list"); | 647 RAW_LOG(INFO, "End of regions list"); |
| 648 } | 648 } |
| OLD | NEW |