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, |
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 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 15 #ifndef CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
16 #define CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 16 #define CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
17 | 17 |
18 #include <stdint.h> | 18 #include <stdint.h> |
19 | 19 |
| 20 #include "base/compiler_specific.h" |
20 #include "snapshot/cpu_context.h" | 21 #include "snapshot/cpu_context.h" |
21 #include "util/numeric/int128.h" | 22 #include "util/numeric/int128.h" |
22 | 23 |
23 namespace crashpad { | 24 namespace crashpad { |
24 | 25 |
25 //! \brief Architecture-independent flags for `context_flags` fields in Minidump | 26 //! \brief Architecture-independent flags for `context_flags` fields in Minidump |
26 //! context structures. | 27 //! context structures. |
27 // | 28 // |
28 // http://zachsaw.blogspot.com/2010/11/wow64-bug-getthreadcontext-may-return.htm
l#c5639760895973344002 | 29 // http://zachsaw.blogspot.com/2010/11/wow64-bug-getthreadcontext-may-return.htm
l#c5639760895973344002 |
29 enum MinidumpContextFlags : uint32_t { | 30 enum MinidumpContextFlags : uint32_t { |
(...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
180 uint32_t cs; | 181 uint32_t cs; |
181 uint32_t eflags; | 182 uint32_t eflags; |
182 uint32_t esp; | 183 uint32_t esp; |
183 uint32_t ss; | 184 uint32_t ss; |
184 | 185 |
185 // CPUContextX86::Fxsave has identical layout to what the x86 CONTEXT | 186 // CPUContextX86::Fxsave has identical layout to what the x86 CONTEXT |
186 // structure places here. | 187 // structure places here. |
187 CPUContextX86::Fxsave fxsave; | 188 CPUContextX86::Fxsave fxsave; |
188 }; | 189 }; |
189 | 190 |
190 //! \brief x86_64-specifc flags for MinidumpContextAMD64::context_flags. | 191 //! \brief x86_64-specific flags for MinidumpContextAMD64::context_flags. |
191 enum MinidumpContextAMD64Flags : uint32_t { | 192 enum MinidumpContextAMD64Flags : uint32_t { |
192 //! \brief Identifies the context structure as x86_64. This is the same as | 193 //! \brief Identifies the context structure as x86_64. This is the same as |
193 //! `CONTEXT_AMD64` on Windows for this architecture. | 194 //! `CONTEXT_AMD64` on Windows for this architecture. |
194 kMinidumpContextAMD64 = 0x00100000, | 195 kMinidumpContextAMD64 = 0x00100000, |
195 | 196 |
196 //! \brief Indicates the validity of control registers (`CONTEXT_CONTROL`). | 197 //! \brief Indicates the validity of control registers (`CONTEXT_CONTROL`). |
197 //! | 198 //! |
198 //! The `cs`, `ss`, `eflags`, `rsp`, and `rip` fields are valid. | 199 //! The `cs`, `ss`, `eflags`, `rsp`, and `rip` fields are valid. |
199 kMinidumpContextAMD64Control = kMinidumpContextAMD64 | 0x00000001, | 200 kMinidumpContextAMD64Control = kMinidumpContextAMD64 | 0x00000001, |
200 | 201 |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
246 //! file. | 247 //! file. |
247 //! | 248 //! |
248 //! This is analogous to the `CONTEXT` structure on Windows when targeting | 249 //! This is analogous to the `CONTEXT` structure on Windows when targeting |
249 //! x86_64. This structure is used instead of `CONTEXT` to make it available | 250 //! x86_64. This structure is used instead of `CONTEXT` to make it available |
250 //! when targeting other architectures. | 251 //! when targeting other architectures. |
251 //! | 252 //! |
252 //! \note This structure doesn’t carry `dr4` or `dr5`, which are obsolete and | 253 //! \note This structure doesn’t carry `dr4` or `dr5`, which are obsolete and |
253 //! normally alias `dr6` and `dr7`, respectively. See Intel Software | 254 //! normally alias `dr6` and `dr7`, respectively. See Intel Software |
254 //! Developer’s Manual, Volume 3B: System Programming, Part 2 (253669-052), | 255 //! Developer’s Manual, Volume 3B: System Programming, Part 2 (253669-052), |
255 //! 17.2.2 “Debug Registers DR4 and DR5”. | 256 //! 17.2.2 “Debug Registers DR4 and DR5”. |
256 struct __attribute__((aligned(16))) MinidumpContextAMD64 { | 257 struct ALIGNAS(16) MinidumpContextAMD64 { |
257 //! \brief Register parameter home address. | 258 //! \brief Register parameter home address. |
258 //! | 259 //! |
259 //! On Windows, this field may contain the “home” address (on-stack, in the | 260 //! On Windows, this field may contain the “home” address (on-stack, in the |
260 //! shadow area) of a parameter passed by register. This field is present for | 261 //! shadow area) of a parameter passed by register. This field is present for |
261 //! convenience but is not necessarily populated, even if a corresponding | 262 //! convenience but is not necessarily populated, even if a corresponding |
262 //! parameter was passed by register. | 263 //! parameter was passed by register. |
263 //! | 264 //! |
264 //! \{ | 265 //! \{ |
265 uint64_t p1_home; | 266 uint64_t p1_home; |
266 uint64_t p2_home; | 267 uint64_t p2_home; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 uint64_t last_branch_to_rip; | 335 uint64_t last_branch_to_rip; |
335 uint64_t last_branch_from_rip; | 336 uint64_t last_branch_from_rip; |
336 uint64_t last_exception_to_rip; | 337 uint64_t last_exception_to_rip; |
337 uint64_t last_exception_from_rip; | 338 uint64_t last_exception_from_rip; |
338 //! \} | 339 //! \} |
339 }; | 340 }; |
340 | 341 |
341 } // namespace crashpad | 342 } // namespace crashpad |
342 | 343 |
343 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ | 344 #endif // CRASHPAD_MINIDUMP_MINIDUMP_CONTEXT_H_ |
OLD | NEW |