Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2008 The Android Open Source Project |
| 3 | * |
| 4 | * Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 | * you may not use this file except in compliance with the License. |
| 6 | * You may obtain a copy of the License at |
| 7 | * |
| 8 | * http://www.apache.org/licenses/LICENSE-2.0 |
| 9 | * |
| 10 | * Unless required by applicable law or agreed to in writing, software |
| 11 | * distributed under the License is distributed on an "AS IS" BASIS, |
| 12 | * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 | * See the License for the specific language governing permissions and |
| 14 | * limitations under the License. |
| 15 | */ |
| 16 | |
| 17 | #include "mem_map.h" |
| 18 | |
Ian Rogers | debeb3a | 2014-01-23 16:54:52 -0800 | [diff] [blame] | 19 | #include <inttypes.h> |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 20 | #include <backtrace/BacktraceMap.h> |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 21 | |
Christopher Ferris | caf22ac | 2014-01-27 18:32:14 -0800 | [diff] [blame] | 22 | #include "UniquePtr.h" |
Elliott Hughes | e222ee0 | 2012-12-13 14:41:43 -0800 | [diff] [blame] | 23 | #include "base/stringprintf.h" |
| 24 | #include "ScopedFd.h" |
| 25 | #include "utils.h" |
| 26 | |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 27 | #define USE_ASHMEM 1 |
| 28 | |
| 29 | #ifdef USE_ASHMEM |
| 30 | #include <cutils/ashmem.h> |
| 31 | #endif |
| 32 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 33 | namespace art { |
| 34 | |
Elliott Hughes | 96970cd | 2012-03-13 15:46:31 -0700 | [diff] [blame] | 35 | #if !defined(NDEBUG) |
| 36 | |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 37 | static std::ostream& operator<<( |
| 38 | std::ostream& os, |
| 39 | std::pair<BacktraceMap::const_iterator, BacktraceMap::const_iterator> iters) { |
| 40 | for (BacktraceMap::const_iterator it = iters.first; it != iters.second; ++it) { |
| 41 | os << StringPrintf("0x%08x-0x%08x %c%c%c %s\n", |
| 42 | static_cast<uint32_t>(it->start), |
| 43 | static_cast<uint32_t>(it->end), |
| 44 | (it->flags & PROT_READ) ? 'r' : '-', |
| 45 | (it->flags & PROT_WRITE) ? 'w' : '-', |
| 46 | (it->flags & PROT_EXEC) ? 'x' : '-', it->name.c_str()); |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 47 | } |
| 48 | return os; |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 49 | } |
| 50 | |
Ian Rogers | 10c5b78 | 2013-01-10 10:40:53 -0800 | [diff] [blame] | 51 | static void CheckMapRequest(byte* addr, size_t byte_count) { |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 52 | if (addr == NULL) { |
| 53 | return; |
| 54 | } |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 55 | |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 56 | uintptr_t base = reinterpret_cast<uintptr_t>(addr); |
| 57 | uintptr_t limit = base + byte_count; |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 58 | |
Christopher Ferris | caf22ac | 2014-01-27 18:32:14 -0800 | [diff] [blame] | 59 | UniquePtr<BacktraceMap> map(BacktraceMap::Create(getpid())); |
| 60 | if (!map->Build()) { |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 61 | PLOG(WARNING) << "Failed to build process map"; |
| 62 | return; |
| 63 | } |
Christopher Ferris | caf22ac | 2014-01-27 18:32:14 -0800 | [diff] [blame] | 64 | for (BacktraceMap::const_iterator it = map->begin(); it != map->end(); ++it) { |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 65 | CHECK(!(base >= it->start && base < it->end) // start of new within old |
| 66 | && !(limit > it->start && limit < it->end) // end of new within old |
| 67 | && !(base <= it->start && limit > it->end)) // start/end of new includes all of old |
Ian Rogers | debeb3a | 2014-01-23 16:54:52 -0800 | [diff] [blame] | 68 | << StringPrintf("Requested region 0x%08" PRIxPTR "-0x%08" PRIxPTR " overlaps with " |
| 69 | "existing map 0x%08" PRIxPTR "-0x%08" PRIxPTR " (%s)\n", |
Elliott Hughes | 7bda158 | 2012-06-07 11:00:54 -0700 | [diff] [blame] | 70 | base, limit, |
Ian Rogers | debeb3a | 2014-01-23 16:54:52 -0800 | [diff] [blame] | 71 | static_cast<uintptr_t>(it->start), static_cast<uintptr_t>(it->end), |
Christopher Ferris | 943af7d | 2014-01-16 12:41:46 -0800 | [diff] [blame] | 72 | it->name.c_str()) |
Christopher Ferris | caf22ac | 2014-01-27 18:32:14 -0800 | [diff] [blame] | 73 | << std::make_pair(it, map->end()); |
Elliott Hughes | 96970cd | 2012-03-13 15:46:31 -0700 | [diff] [blame] | 74 | } |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 75 | } |
| 76 | |
Elliott Hughes | 96970cd | 2012-03-13 15:46:31 -0700 | [diff] [blame] | 77 | #else |
Elliott Hughes | 1bac54f | 2012-03-16 12:48:31 -0700 | [diff] [blame] | 78 | static void CheckMapRequest(byte*, size_t) { } |
Elliott Hughes | 96970cd | 2012-03-13 15:46:31 -0700 | [diff] [blame] | 79 | #endif |
| 80 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 81 | MemMap* MemMap::MapAnonymous(const char* name, byte* addr, size_t byte_count, int prot, |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 82 | bool low_4gb, std::string* error_msg) { |
Brian Carlstrom | 9004cb6 | 2013-07-26 15:48:31 -0700 | [diff] [blame] | 83 | if (byte_count == 0) { |
| 84 | return new MemMap(name, NULL, 0, NULL, 0, prot); |
| 85 | } |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 86 | size_t page_aligned_byte_count = RoundUp(byte_count, kPageSize); |
| 87 | CheckMapRequest(addr, page_aligned_byte_count); |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 88 | |
| 89 | #ifdef USE_ASHMEM |
Ian Rogers | a40307e | 2013-02-22 11:32:44 -0800 | [diff] [blame] | 90 | // android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are |
| 91 | // prefixed "dalvik-". |
| 92 | std::string debug_friendly_name("dalvik-"); |
| 93 | debug_friendly_name += name; |
| 94 | ScopedFd fd(ashmem_create_region(debug_friendly_name.c_str(), page_aligned_byte_count)); |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 95 | int flags = MAP_PRIVATE; |
| 96 | if (fd.get() == -1) { |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 97 | *error_msg = StringPrintf("ashmem_create_region failed for '%s': %s", name, strerror(errno)); |
| 98 | return nullptr; |
Elliott Hughes | 6c9c06d | 2011-11-07 16:43:47 -0800 | [diff] [blame] | 99 | } |
| 100 | #else |
| 101 | ScopedFd fd(-1); |
| 102 | int flags = MAP_PRIVATE | MAP_ANONYMOUS; |
| 103 | #endif |
Ian Rogers | ef7d42f | 2014-01-06 12:55:46 -0800 | [diff] [blame] | 104 | #ifdef __LP64__ |
| 105 | if (low_4gb) { |
| 106 | flags |= MAP_32BIT; |
| 107 | } |
| 108 | #endif |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 109 | byte* actual = reinterpret_cast<byte*>(mmap(addr, page_aligned_byte_count, prot, flags, fd.get(), 0)); |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 110 | if (actual == MAP_FAILED) { |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 111 | std::string maps; |
| 112 | ReadFileToString("/proc/self/maps", &maps); |
Mathieu Chartier | c7cb190 | 2014-03-05 14:41:03 -0800 | [diff] [blame^] | 113 | *error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed\n%s", |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 114 | addr, page_aligned_byte_count, prot, flags, fd.get(), |
| 115 | maps.c_str()); |
| 116 | return nullptr; |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 117 | } |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 118 | return new MemMap(name, actual, byte_count, actual, page_aligned_byte_count, prot); |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 119 | } |
| 120 | |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 121 | MemMap* MemMap::MapFileAtAddress(byte* addr, size_t byte_count, int prot, int flags, int fd, |
| 122 | off_t start, bool reuse, const char* filename, |
| 123 | std::string* error_msg) { |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 124 | CHECK_NE(0, prot); |
| 125 | CHECK_NE(0, flags & (MAP_SHARED | MAP_PRIVATE)); |
Brian Carlstrom | 9004cb6 | 2013-07-26 15:48:31 -0700 | [diff] [blame] | 126 | if (byte_count == 0) { |
Brian Carlstrom | 0d6adac | 2014-02-05 17:39:16 -0800 | [diff] [blame] | 127 | return new MemMap(filename, NULL, 0, NULL, 0, prot); |
Brian Carlstrom | 9004cb6 | 2013-07-26 15:48:31 -0700 | [diff] [blame] | 128 | } |
Ian Rogers | f8adc60 | 2013-04-18 17:06:19 -0700 | [diff] [blame] | 129 | // Adjust 'offset' to be page-aligned as required by mmap. |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 130 | int page_offset = start % kPageSize; |
| 131 | off_t page_aligned_offset = start - page_offset; |
Ian Rogers | f8adc60 | 2013-04-18 17:06:19 -0700 | [diff] [blame] | 132 | // Adjust 'byte_count' to be page-aligned as we will map this anyway. |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 133 | size_t page_aligned_byte_count = RoundUp(byte_count + page_offset, kPageSize); |
Ian Rogers | f8adc60 | 2013-04-18 17:06:19 -0700 | [diff] [blame] | 134 | // The 'addr' is modified (if specified, ie non-null) to be page aligned to the file but not |
| 135 | // necessarily to virtual memory. mmap will page align 'addr' for us. |
| 136 | byte* page_aligned_addr = (addr == NULL) ? NULL : (addr - page_offset); |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 137 | if (!reuse) { |
| 138 | // reuse means it is okay that it overlaps an existing page mapping. |
| 139 | // Only use this if you actually made the page reservation yourself. |
| 140 | CheckMapRequest(page_aligned_addr, page_aligned_byte_count); |
Ian Rogers | f8adc60 | 2013-04-18 17:06:19 -0700 | [diff] [blame] | 141 | } else { |
| 142 | CHECK(addr != NULL); |
Brian Carlstrom | 700c8d3 | 2012-11-05 10:42:02 -0800 | [diff] [blame] | 143 | } |
| 144 | byte* actual = reinterpret_cast<byte*>(mmap(page_aligned_addr, |
Elliott Hughes | ecd3a6f | 2012-06-06 18:16:37 -0700 | [diff] [blame] | 145 | page_aligned_byte_count, |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 146 | prot, |
| 147 | flags, |
| 148 | fd, |
| 149 | page_aligned_offset)); |
| 150 | if (actual == MAP_FAILED) { |
Mathieu Chartier | 3b6f0fa | 2013-11-13 13:26:07 -0800 | [diff] [blame] | 151 | std::string strerr(strerror(errno)); |
jeffhao | 8161c03 | 2012-10-31 15:50:00 -0700 | [diff] [blame] | 152 | std::string maps; |
| 153 | ReadFileToString("/proc/self/maps", &maps); |
Mathieu Chartier | c7cb190 | 2014-03-05 14:41:03 -0800 | [diff] [blame^] | 154 | *error_msg = StringPrintf("mmap(%p, %zd, 0x%x, 0x%x, %d, %" PRId64 |
| 155 | ") of file '%s' failed: %s\n%s", |
Ian Rogers | 8d31bbd | 2013-10-13 10:44:14 -0700 | [diff] [blame] | 156 | page_aligned_addr, page_aligned_byte_count, prot, flags, fd, |
Mathieu Chartier | 3b6f0fa | 2013-11-13 13:26:07 -0800 | [diff] [blame] | 157 | static_cast<int64_t>(page_aligned_offset), filename, strerr.c_str(), |
| 158 | maps.c_str()); |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 159 | return NULL; |
| 160 | } |
Brian Carlstrom | 0d6adac | 2014-02-05 17:39:16 -0800 | [diff] [blame] | 161 | return new MemMap(filename, actual + page_offset, byte_count, actual, page_aligned_byte_count, |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 162 | prot); |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 163 | } |
| 164 | |
| 165 | MemMap::~MemMap() { |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame] | 166 | if (base_begin_ == NULL && base_size_ == 0) { |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 167 | return; |
| 168 | } |
Ian Rogers | 30fab40 | 2012-01-23 15:43:46 -0800 | [diff] [blame] | 169 | int result = munmap(base_begin_, base_size_); |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 170 | if (result == -1) { |
| 171 | PLOG(FATAL) << "munmap failed"; |
| 172 | } |
| 173 | } |
| 174 | |
Mathieu Chartier | 1c23e1e | 2012-10-12 14:14:11 -0700 | [diff] [blame] | 175 | MemMap::MemMap(const std::string& name, byte* begin, size_t size, void* base_begin, |
| 176 | size_t base_size, int prot) |
| 177 | : name_(name), begin_(begin), size_(size), base_begin_(base_begin), base_size_(base_size), |
| 178 | prot_(prot) { |
Brian Carlstrom | 9004cb6 | 2013-07-26 15:48:31 -0700 | [diff] [blame] | 179 | if (size_ == 0) { |
| 180 | CHECK(begin_ == NULL); |
| 181 | CHECK(base_begin_ == NULL); |
| 182 | CHECK_EQ(base_size_, 0U); |
| 183 | } else { |
| 184 | CHECK(begin_ != NULL); |
| 185 | CHECK(base_begin_ != NULL); |
| 186 | CHECK_NE(base_size_, 0U); |
| 187 | } |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 188 | }; |
| 189 | |
Hiroshi Yamauchi | fd7e7f1 | 2013-10-22 14:17:48 -0700 | [diff] [blame] | 190 | MemMap* MemMap::RemapAtEnd(byte* new_end, const char* tail_name, int tail_prot, |
| 191 | std::string* error_msg) { |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 192 | DCHECK_GE(new_end, Begin()); |
| 193 | DCHECK_LE(new_end, End()); |
Hiroshi Yamauchi | fd7e7f1 | 2013-10-22 14:17:48 -0700 | [diff] [blame] | 194 | DCHECK_LE(begin_ + size_, reinterpret_cast<byte*>(base_begin_) + base_size_); |
| 195 | DCHECK(IsAligned<kPageSize>(begin_)); |
| 196 | DCHECK(IsAligned<kPageSize>(base_begin_)); |
| 197 | DCHECK(IsAligned<kPageSize>(reinterpret_cast<byte*>(base_begin_) + base_size_)); |
| 198 | DCHECK(IsAligned<kPageSize>(new_end)); |
| 199 | byte* old_end = begin_ + size_; |
| 200 | byte* old_base_end = reinterpret_cast<byte*>(base_begin_) + base_size_; |
| 201 | byte* new_base_end = new_end; |
| 202 | DCHECK_LE(new_base_end, old_base_end); |
| 203 | if (new_base_end == old_base_end) { |
| 204 | return new MemMap(tail_name, NULL, 0, NULL, 0, tail_prot); |
| 205 | } |
| 206 | size_ = new_end - reinterpret_cast<byte*>(begin_); |
| 207 | base_size_ = new_base_end - reinterpret_cast<byte*>(base_begin_); |
| 208 | DCHECK_LE(begin_ + size_, reinterpret_cast<byte*>(base_begin_) + base_size_); |
| 209 | size_t tail_size = old_end - new_end; |
| 210 | byte* tail_base_begin = new_base_end; |
| 211 | size_t tail_base_size = old_base_end - new_base_end; |
| 212 | DCHECK_EQ(tail_base_begin + tail_base_size, old_base_end); |
| 213 | DCHECK(IsAligned<kPageSize>(tail_base_size)); |
| 214 | |
| 215 | #ifdef USE_ASHMEM |
| 216 | // android_os_Debug.cpp read_mapinfo assumes all ashmem regions associated with the VM are |
| 217 | // prefixed "dalvik-". |
| 218 | std::string debug_friendly_name("dalvik-"); |
| 219 | debug_friendly_name += tail_name; |
| 220 | ScopedFd fd(ashmem_create_region(debug_friendly_name.c_str(), tail_base_size)); |
| 221 | int flags = MAP_PRIVATE; |
| 222 | if (fd.get() == -1) { |
| 223 | *error_msg = StringPrintf("ashmem_create_region failed for '%s': %s", |
| 224 | tail_name, strerror(errno)); |
| 225 | return nullptr; |
| 226 | } |
| 227 | #else |
| 228 | ScopedFd fd(-1); |
| 229 | int flags = MAP_PRIVATE | MAP_ANONYMOUS; |
| 230 | #endif |
| 231 | |
| 232 | // Unmap/map the tail region. |
| 233 | int result = munmap(tail_base_begin, tail_base_size); |
| 234 | if (result == -1) { |
| 235 | std::string maps; |
| 236 | ReadFileToString("/proc/self/maps", &maps); |
| 237 | *error_msg = StringPrintf("munmap(%p, %zd) failed for '%s'\n%s", |
| 238 | tail_base_begin, tail_base_size, name_.c_str(), |
| 239 | maps.c_str()); |
| 240 | return nullptr; |
| 241 | } |
| 242 | // Don't cause memory allocation between the munmap and the mmap |
| 243 | // calls. Otherwise, libc (or something else) might take this memory |
| 244 | // region. Note this isn't perfect as there's no way to prevent |
| 245 | // other threads to try to take this memory region here. |
| 246 | byte* actual = reinterpret_cast<byte*>(mmap(tail_base_begin, tail_base_size, tail_prot, |
| 247 | flags, fd.get(), 0)); |
| 248 | if (actual == MAP_FAILED) { |
| 249 | std::string maps; |
| 250 | ReadFileToString("/proc/self/maps", &maps); |
Mathieu Chartier | c7cb190 | 2014-03-05 14:41:03 -0800 | [diff] [blame^] | 251 | *error_msg = StringPrintf("anonymous mmap(%p, %zd, 0x%x, 0x%x, %d, 0) failed\n%s", |
Hiroshi Yamauchi | fd7e7f1 | 2013-10-22 14:17:48 -0700 | [diff] [blame] | 252 | tail_base_begin, tail_base_size, tail_prot, flags, fd.get(), |
| 253 | maps.c_str()); |
| 254 | return nullptr; |
| 255 | } |
| 256 | return new MemMap(tail_name, actual, tail_size, actual, tail_base_size, tail_prot); |
Mathieu Chartier | cc236d7 | 2012-07-20 10:29:05 -0700 | [diff] [blame] | 257 | } |
Logan Chien | d88fa26 | 2012-06-06 15:23:32 +0800 | [diff] [blame] | 258 | |
| 259 | bool MemMap::Protect(int prot) { |
| 260 | if (base_begin_ == NULL && base_size_ == 0) { |
Ian Rogers | 1c849e5 | 2012-06-28 14:00:33 -0700 | [diff] [blame] | 261 | prot_ = prot; |
Logan Chien | d88fa26 | 2012-06-06 15:23:32 +0800 | [diff] [blame] | 262 | return true; |
| 263 | } |
| 264 | |
| 265 | if (mprotect(base_begin_, base_size_, prot) == 0) { |
Ian Rogers | 1c849e5 | 2012-06-28 14:00:33 -0700 | [diff] [blame] | 266 | prot_ = prot; |
Logan Chien | d88fa26 | 2012-06-06 15:23:32 +0800 | [diff] [blame] | 267 | return true; |
| 268 | } |
| 269 | |
Shih-wei Liao | a060ed9 | 2012-06-07 09:25:28 -0700 | [diff] [blame] | 270 | PLOG(ERROR) << "mprotect(" << reinterpret_cast<void*>(base_begin_) << ", " << base_size_ << ", " |
| 271 | << prot << ") failed"; |
Logan Chien | d88fa26 | 2012-06-06 15:23:32 +0800 | [diff] [blame] | 272 | return false; |
| 273 | } |
| 274 | |
Brian Carlstrom | 0d6adac | 2014-02-05 17:39:16 -0800 | [diff] [blame] | 275 | std::ostream& operator<<(std::ostream& os, const MemMap& mem_map) { |
Mathieu Chartier | c7cb190 | 2014-03-05 14:41:03 -0800 | [diff] [blame^] | 276 | os << StringPrintf("[MemMap: %s prot=0x%x %p-%p]", |
Brian Carlstrom | 0d6adac | 2014-02-05 17:39:16 -0800 | [diff] [blame] | 277 | mem_map.GetName().c_str(), mem_map.GetProtect(), |
| 278 | mem_map.BaseBegin(), mem_map.BaseEnd()); |
| 279 | return os; |
| 280 | } |
| 281 | |
Brian Carlstrom | 27ec961 | 2011-09-19 20:20:38 -0700 | [diff] [blame] | 282 | } // namespace art |