OLD | NEW |
1 // Copyright 2014 The Crashpad Authors. All rights reserved. | 1 // Copyright 2014 The Crashpad Authors. All rights reserved. |
2 // | 2 // |
3 // Licensed under the Apache License, Version 2.0 (the "License"); | 3 // Licensed under the Apache License, Version 2.0 (the "License"); |
4 // you may not use this file except in compliance with the License. | 4 // you may not use this file except in compliance with the License. |
5 // You may obtain a copy of the License at | 5 // You may obtain a copy of the License at |
6 // | 6 // |
7 // http://www.apache.org/licenses/LICENSE-2.0 | 7 // http://www.apache.org/licenses/LICENSE-2.0 |
8 // | 8 // |
9 // Unless required by applicable law or agreed to in writing, software | 9 // Unless required by applicable law or agreed to in writing, software |
10 // distributed under the License is distributed on an "AS IS" BASIS, | 10 // distributed under the License is distributed on an "AS IS" BASIS, |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 user_size_(user_size) { | 57 user_size_(user_size) { |
58 vm_address_t vm_end = vm_address + vm_size; | 58 vm_address_t vm_end = vm_address + vm_size; |
59 vm_address_t user_address = reinterpret_cast<vm_address_t>(data_); | 59 vm_address_t user_address = reinterpret_cast<vm_address_t>(data_); |
60 vm_address_t user_end = user_address + user_size; | 60 vm_address_t user_end = user_address + user_size; |
61 DCHECK_GE(user_address, vm_address); | 61 DCHECK_GE(user_address, vm_address); |
62 DCHECK_LE(user_address, vm_end); | 62 DCHECK_LE(user_address, vm_end); |
63 DCHECK_GE(user_end, vm_address); | 63 DCHECK_GE(user_end, vm_address); |
64 DCHECK_LE(user_end, vm_end); | 64 DCHECK_LE(user_end, vm_end); |
65 } | 65 } |
66 | 66 |
67 TaskMemory::TaskMemory(mach_port_t task) : task_(task) { | 67 TaskMemory::TaskMemory(task_t task) : task_(task) { |
68 } | 68 } |
69 | 69 |
70 bool TaskMemory::Read(mach_vm_address_t address, size_t size, void* buffer) { | 70 bool TaskMemory::Read(mach_vm_address_t address, size_t size, void* buffer) { |
71 scoped_ptr<MappedMemory> memory = ReadMapped(address, size); | 71 scoped_ptr<MappedMemory> memory = ReadMapped(address, size); |
72 if (!memory) { | 72 if (!memory) { |
73 return false; | 73 return false; |
74 } | 74 } |
75 | 75 |
76 memcpy(buffer, memory->data(), size); | 76 memcpy(buffer, memory->data(), size); |
77 return true; | 77 return true; |
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 size -= read_length; | 149 size -= read_length; |
150 } | 150 } |
151 read_address = mach_vm_trunc_page(read_address + read_length); | 151 read_address = mach_vm_trunc_page(read_address + read_length); |
152 } while ((!has_size || size > 0) && read_address > address); | 152 } while ((!has_size || size > 0) && read_address > address); |
153 | 153 |
154 LOG(WARNING) << base::StringPrintf("unterminated string at 0x%llx", address); | 154 LOG(WARNING) << base::StringPrintf("unterminated string at 0x%llx", address); |
155 return false; | 155 return false; |
156 } | 156 } |
157 | 157 |
158 } // namespace crashpad | 158 } // namespace crashpad |
OLD | NEW |