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 13 matching lines...) Expand all Loading... |
24 #include "snapshot/mac/process_reader.h" | 24 #include "snapshot/mac/process_reader.h" |
25 | 25 |
26 namespace crashpad { | 26 namespace crashpad { |
27 namespace process_types { | 27 namespace process_types { |
28 namespace internal { | 28 namespace internal { |
29 | 29 |
30 // Some structure definitions differ in 32-bit and 64-bit environments by having | 30 // Some structure definitions differ in 32-bit and 64-bit environments by having |
31 // additional “reserved” padding fields present only in the 64-bit environment. | 31 // additional “reserved” padding fields present only in the 64-bit environment. |
32 // These Reserved64Only* types allow the process_types system to replicate these | 32 // These Reserved64Only* types allow the process_types system to replicate these |
33 // structures more precisely. | 33 // structures more precisely. |
34 typedef char Reserved64Only32[0]; | 34 using Reserved64Only32 = char[0]; |
35 typedef uint32_t Reserved64Only64; | 35 using Reserved64Only64 = uint32_t; |
36 | 36 |
37 } // namespace internal | 37 } // namespace internal |
38 } // namespace process_types | 38 } // namespace process_types |
39 } // namespace crashpad | 39 } // namespace crashpad |
40 | 40 |
41 #include "snapshot/mac/process_types/traits.h" | 41 #include "snapshot/mac/process_types/traits.h" |
42 | 42 |
43 // Creates the traits type crashpad::process_types::internal::TraitsGeneric. | 43 // Creates the traits type crashpad::process_types::internal::TraitsGeneric. |
44 DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64) | 44 DECLARE_PROCESS_TYPE_TRAITS_CLASS(Generic, 64) |
45 | 45 |
46 #undef DECLARE_PROCESS_TYPE_TRAITS_CLASS | 46 #undef DECLARE_PROCESS_TYPE_TRAITS_CLASS |
47 | 47 |
48 // Declare the crashpad::process_types::struct_name structs. These are the | 48 // Declare the crashpad::process_types::struct_name structs. These are the |
49 // user-visible generic structs that callers will interact with. They read data | 49 // user-visible generic structs that callers will interact with. They read data |
50 // from 32-bit or 64-bit processes by using the specific internal templatized | 50 // from 32-bit or 64-bit processes by using the specific internal templatized |
51 // structs below. | 51 // structs below. |
52 #define PROCESS_TYPE_STRUCT_DECLARE 1 | 52 #define PROCESS_TYPE_STRUCT_DECLARE 1 |
53 | 53 |
54 #define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \ | 54 #define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \ |
55 namespace crashpad { \ | 55 namespace crashpad { \ |
56 namespace process_types { \ | 56 namespace process_types { \ |
57 struct struct_name { \ | 57 struct struct_name { \ |
58 public: \ | 58 public: \ |
59 typedef internal::TraitsGeneric::Long Long; \ | 59 using Long = internal::TraitsGeneric::Long; \ |
60 typedef internal::TraitsGeneric::ULong ULong; \ | 60 using ULong = internal::TraitsGeneric::ULong; \ |
61 typedef internal::TraitsGeneric::Pointer Pointer; \ | 61 using Pointer = internal::TraitsGeneric::Pointer; \ |
62 typedef internal::TraitsGeneric::IntPtr IntPtr; \ | 62 using IntPtr = internal::TraitsGeneric::IntPtr; \ |
63 typedef internal::TraitsGeneric::UIntPtr UIntPtr; \ | 63 using UIntPtr = internal::TraitsGeneric::UIntPtr; \ |
64 typedef internal::TraitsGeneric::Reserved64Only Reserved64Only; \ | 64 using Reserved64Only = internal::TraitsGeneric::Reserved64Only; \ |
65 \ | 65 \ |
66 /* Initializes an object with data read from |process_reader| at \ | 66 /* Initializes an object with data read from |process_reader| at \ |
67 * |address|, properly genericized. */ \ | 67 * |address|, properly genericized. */ \ |
68 bool Read(ProcessReader* process_reader, mach_vm_address_t address) { \ | 68 bool Read(ProcessReader* process_reader, mach_vm_address_t address) { \ |
69 return ReadInto(process_reader, address, this); \ | 69 return ReadInto(process_reader, address, this); \ |
70 } \ | 70 } \ |
71 \ | 71 \ |
72 /* Reads |count| objects from |process_reader| beginning at |address|, and \ | 72 /* Reads |count| objects from |process_reader| beginning at |address|, and \ |
73 * genericizes the objects. The caller must provide storage for |count| \ | 73 * genericizes the objects. The caller must provide storage for |count| \ |
74 * objects in |generic|. */ \ | 74 * objects in |generic|. */ \ |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
129 // remote process into the generic form. | 129 // remote process into the generic form. |
130 #define PROCESS_TYPE_STRUCT_DECLARE_INTERNAL 1 | 130 #define PROCESS_TYPE_STRUCT_DECLARE_INTERNAL 1 |
131 | 131 |
132 #define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \ | 132 #define PROCESS_TYPE_STRUCT_BEGIN(struct_name) \ |
133 namespace crashpad { \ | 133 namespace crashpad { \ |
134 namespace process_types { \ | 134 namespace process_types { \ |
135 namespace internal { \ | 135 namespace internal { \ |
136 template <typename Traits> \ | 136 template <typename Traits> \ |
137 struct struct_name { \ | 137 struct struct_name { \ |
138 public: \ | 138 public: \ |
139 typedef typename Traits::Long Long; \ | 139 using Long = typename Traits::Long; \ |
140 typedef typename Traits::ULong ULong; \ | 140 using ULong = typename Traits::ULong; \ |
141 typedef typename Traits::Pointer Pointer; \ | 141 using Pointer = typename Traits::Pointer; \ |
142 typedef typename Traits::IntPtr IntPtr; \ | 142 using IntPtr = typename Traits::IntPtr; \ |
143 typedef typename Traits::UIntPtr UIntPtr; \ | 143 using UIntPtr = typename Traits::UIntPtr; \ |
144 typedef typename Traits::Reserved64Only Reserved64Only; \ | 144 using Reserved64Only = typename Traits::Reserved64Only; \ |
145 \ | 145 \ |
146 /* Read(), ReadArrayInto(), and Size() are as in the generic user-visible \ | 146 /* Read(), ReadArrayInto(), and Size() are as in the generic user-visible \ |
147 * struct above. */ \ | 147 * struct above. */ \ |
148 bool Read(ProcessReader* process_reader, mach_vm_address_t address) { \ | 148 bool Read(ProcessReader* process_reader, mach_vm_address_t address) { \ |
149 return ReadInto(process_reader, address, this); \ | 149 return ReadInto(process_reader, address, this); \ |
150 } \ | 150 } \ |
151 static bool ReadArrayInto(ProcessReader* process_reader, \ | 151 static bool ReadArrayInto(ProcessReader* process_reader, \ |
152 mach_vm_address_t address, \ | 152 mach_vm_address_t address, \ |
153 size_t count, \ | 153 size_t count, \ |
154 struct_name<Traits>* specific); \ | 154 struct_name<Traits>* specific); \ |
(...skipping 19 matching lines...) Expand all Loading... |
174 } /* namespace crashpad */ | 174 } /* namespace crashpad */ |
175 | 175 |
176 #include "snapshot/mac/process_types/all.proctype" | 176 #include "snapshot/mac/process_types/all.proctype" |
177 | 177 |
178 #undef PROCESS_TYPE_STRUCT_BEGIN | 178 #undef PROCESS_TYPE_STRUCT_BEGIN |
179 #undef PROCESS_TYPE_STRUCT_MEMBER | 179 #undef PROCESS_TYPE_STRUCT_MEMBER |
180 #undef PROCESS_TYPE_STRUCT_END | 180 #undef PROCESS_TYPE_STRUCT_END |
181 #undef PROCESS_TYPE_STRUCT_DECLARE_INTERNAL | 181 #undef PROCESS_TYPE_STRUCT_DECLARE_INTERNAL |
182 | 182 |
183 #endif // CRASHPAD_SNAPSHOT_MAC_PROCESS_TYPES_H_ | 183 #endif // CRASHPAD_SNAPSHOT_MAC_PROCESS_TYPES_H_ |
OLD | NEW |