OLD | NEW |
1 // Copyright 2015 The Crashpad Authors. All rights reserved. | 1 // Copyright 2015 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, |
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | 11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
12 // See the License for the specific language governing permissions and | 12 // See the License for the specific language governing permissions and |
13 // limitations under the License. | 13 // limitations under the License. |
14 | 14 |
15 #include "util/numeric/checked_address_range.h" | 15 #include "util/numeric/checked_address_range.h" |
16 | 16 |
| 17 #include "base/strings/stringprintf.h" |
| 18 |
17 #if defined(OS_MACOSX) | 19 #if defined(OS_MACOSX) |
18 #include <mach/mach.h> | 20 #include <mach/mach.h> |
19 #elif defined(OS_WIN) | 21 #elif defined(OS_WIN) |
20 #include "util/win/address_types.h" | 22 #include "util/win/address_types.h" |
21 #endif // OS_MACOSX | 23 #endif // OS_MACOSX |
22 | 24 |
23 namespace crashpad { | 25 namespace crashpad { |
24 namespace internal { | 26 namespace internal { |
25 | 27 |
26 template <class ValueType, class SizeType> | 28 template <class ValueType, class SizeType> |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
102 bool CheckedAddressRangeGeneric<ValueType, SizeType>::ContainsRange( | 104 bool CheckedAddressRangeGeneric<ValueType, SizeType>::ContainsRange( |
103 const CheckedAddressRangeGeneric& that) const { | 105 const CheckedAddressRangeGeneric& that) const { |
104 DCHECK_EQ(is_64_bit_, that.is_64_bit_); | 106 DCHECK_EQ(is_64_bit_, that.is_64_bit_); |
105 DCHECK(range_ok_); | 107 DCHECK(range_ok_); |
106 DCHECK(that.range_ok_); | 108 DCHECK(that.range_ok_); |
107 | 109 |
108 return is_64_bit_ ? range_64_.ContainsRange(that.range_64_) | 110 return is_64_bit_ ? range_64_.ContainsRange(that.range_64_) |
109 : range_32_.ContainsRange(that.range_32_); | 111 : range_32_.ContainsRange(that.range_32_); |
110 } | 112 } |
111 | 113 |
| 114 template <class ValueType, class SizeType> |
| 115 std::string CheckedAddressRangeGeneric<ValueType, SizeType>::AsString() const { |
| 116 return base::StringPrintf( |
| 117 "0x%llx + 0x%llx (%s)", Base(), Size(), Is64Bit() ? "64" : "32"); |
| 118 } |
| 119 |
112 // Explicit instantiations for the cases we use. | 120 // Explicit instantiations for the cases we use. |
113 #if defined(OS_MACOSX) | 121 #if defined(OS_MACOSX) |
114 template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>; | 122 template class CheckedAddressRangeGeneric<mach_vm_address_t, mach_vm_size_t>; |
115 #elif defined(OS_WIN) | 123 #elif defined(OS_WIN) |
116 template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>; | 124 template class CheckedAddressRangeGeneric<WinVMAddress, WinVMSize>; |
117 #endif // OS_MACOSX | 125 #endif // OS_MACOSX |
118 | 126 |
119 } // namespace internal | 127 } // namespace internal |
120 } // namespace crashpad | 128 } // namespace crashpad |
OLD | NEW |