Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(11)

Side by Side Diff: snapshot/cpu_context_mac.h

Issue 666483002: Create snapshot/mac and move some files from snapshot and util to there (Closed) Base URL: https://chromium.googlesource.com/crashpad/crashpad/+/master
Patch Set: Move process_reader, process_types, and mach_o_image*_reader from util/mac to snapshot/mac Created 6 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | snapshot/cpu_context_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 // Copyright 2014 The Crashpad Authors. All rights reserved.
2 //
3 // Licensed under the Apache License, Version 2.0 (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
6 //
7 // http://www.apache.org/licenses/LICENSE-2.0
8 //
9 // Unless required by applicable law or agreed to in writing, software
10 // distributed under the License is distributed on an "AS IS" BASIS,
11 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 // See the License for the specific language governing permissions and
13 // limitations under the License.
14
15 #ifndef CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_MAC_H_
16 #define CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_MAC_H_
17
18 #include <mach/mach.h>
19
20 #include "build/build_config.h"
21 #include "snapshot/cpu_context.h"
22
23 namespace crashpad {
24 namespace internal {
25
26 #if defined(ARCH_CPU_X86_FAMILY) || DOXYGEN
27
28 //! \brief Initializes a CPUContextX86 structure from native context structures
29 //! on Mac OS X.
30 //!
31 //! \a flavor, \a state, and \a state_count may be supplied by exception
32 //! handlers in order for the \a context parameter to be initialized by the
33 //! thread state received by the exception handler to the extent possible. In
34 //! that case, whatever thread state specified by these three parameters will
35 //! supersede \a x86_thread_state32, \a x86_float_state32, or \a
36 //! x86_debug_state32. If thread state in this format is not available, \a
37 //! flavor may be set to `THREAD_STATE_NONE`, and all of \a x86_thread_state32,
38 //! \a x86_float_state32, and \a x86_debug_state32 will be honored.
39 //!
40 //! If \a flavor, \a state, and \a state_count are provided but do not contain
41 //! valid values, a message will be logged and their values will be ignored as
42 //! though \a flavor were specified as `THREAD_STATE_NONE`.
43 //!
44 //! \param[out] context The CPUContextX86 structure to initialize.
45 //! \param[in] flavor The native thread state flavor of \a state. This may be
46 //! `x86_THREAD_STATE32`, `x86_FLOAT_STATE32`, `x86_DEBUG_STATE32`,
47 //! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
48 //! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
49 //! \param[in] state The native thread state, which may be a casted pointer to
50 //! `x86_thread_state32_t`, `x86_float_state32_t`, `x86_debug_state32_t`,
51 //! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
52 //! parameter may be `nullptr` to not supply this data, in which case \a
53 //! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
54 //! it must carry 32-bit state data of the correct type.
55 //! \param[in] state_count The number of `natural_t`-sized (`int`-sized) units
56 //! in \a state. This may be 0 if \a state is `nullptr`.
57 //! \param[in] x86_thread_state32 The state of the thread’s integer registers.
58 //! \param[in] x86_float_state32 The state of the thread’s floating-point
59 //! registers.
60 //! \param[in] x86_debug_state32 The state of the thread’s debug registers.
61 void InitializeCPUContextX86(CPUContextX86* context,
62 thread_state_flavor_t flavor,
63 const natural_t* state,
64 mach_msg_type_number_t state_count,
65 const x86_thread_state32_t* x86_thread_state32,
66 const x86_float_state32_t* x86_float_state32,
67 const x86_debug_state32_t* x86_debug_state32);
68
69 //! \brief Initializes a CPUContextX86_64 structure from native context
70 //! structures on Mac OS X.
71 //!
72 //! \a flavor, \a state, and \a state_count may be supplied by exception
73 //! handlers in order for the \a context parameter to be initialized by the
74 //! thread state received by the exception handler to the extent possible. In
75 //! that case, whatever thread state specified by these three parameters will
76 //! supersede \a x86_thread_state64, \a x86_float_state64, or \a
77 //! x86_debug_state64. If thread state in this format is not available, \a
78 //! flavor may be set to `THREAD_STATE_NONE`, and all of \a x86_thread_state64,
79 //! \a x86_float_state64, and \a x86_debug_state64 will be honored.
80 //!
81 //! If \a flavor, \a state, and \a state_count are provided but do not contain
82 //! valid values, a message will be logged and their values will be ignored as
83 //! though \a flavor were specified as `THREAD_STATE_NONE`.
84 //!
85 //! \param[out] context The CPUContextX86_64 structure to initialize.
86 //! \param[in] flavor The native thread state flavor of \a state. This may be
87 //! `x86_THREAD_STATE64`, `x86_FLOAT_STATE64`, `x86_DEBUG_STATE64`,
88 //! `x86_THREAD_STATE`, `x86_FLOAT_STATE`, or `x86_DEBUG_STATE`. It may also
89 //! be `THREAD_STATE_NONE` if \a state is not supplied (and is `nullptr`).
90 //! \param[in] state The native thread state, which may be a casted pointer to
91 //! `x86_thread_state64_t`, `x86_float_state64_t`, `x86_debug_state64_t`,
92 //! `x86_thread_state`, `x86_float_state`, or `x86_debug_state`. This
93 //! parameter may be `nullptr` to not supply this data, in which case \a
94 //! flavor must be `THREAD_STATE_NONE`. If a “universal” structure is used,
95 //! it must carry 64-bit state data of the correct type.
96 //! \param[in] state_count The number of `int`-sized units in \a state. This may
97 //! be 0 if \a state is `nullptr`.
98 //! \param[in] x86_thread_state64 The state of the thread’s integer registers.
99 //! \param[in] x86_float_state64 The state of the thread’s floating-point
100 //! registers.
101 //! \param[in] x86_debug_state64 The state of the thread’s debug registers.
102 void InitializeCPUContextX86_64(CPUContextX86_64* context,
103 thread_state_flavor_t flavor,
104 const natural_t* state,
105 mach_msg_type_number_t state_count,
106 const x86_thread_state64_t* x86_thread_state64,
107 const x86_float_state64_t* x86_float_state64,
108 const x86_debug_state64_t* x86_debug_state64);
109
110 #endif
111
112 } // namespace internal
113 } // namespace crashpad
114
115 #endif // CRASHPAD_SNAPSHOT_SNAPSHOT_CPU_CONTEXT_MAC_H_
OLDNEW
« no previous file with comments | « no previous file | snapshot/cpu_context_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698