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

Side by Side Diff: third_party/breakpad/src/google_breakpad/processor/stack_frame_cpu.h

Issue 624713003: Keep only base/extractor.[cc|h]. (Closed) Base URL: https://chromium.googlesource.com/external/omaha.git@master
Patch Set: 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
OLDNEW
(Empty)
1 // -*- mode: c++ -*-
2
3 // Copyright (c) 2010 Google Inc.
4 // All rights reserved.
5 //
6 // Redistribution and use in source and binary forms, with or without
7 // modification, are permitted provided that the following conditions are
8 // met:
9 //
10 // * Redistributions of source code must retain the above copyright
11 // notice, this list of conditions and the following disclaimer.
12 // * Redistributions in binary form must reproduce the above
13 // copyright notice, this list of conditions and the following disclaimer
14 // in the documentation and/or other materials provided with the
15 // distribution.
16 // * Neither the name of Google Inc. nor the names of its
17 // contributors may be used to endorse or promote products derived from
18 // this software without specific prior written permission.
19 //
20 // THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
21 // "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
22 // LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
23 // A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
24 // OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
25 // SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
26 // LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
27 // DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
28 // THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
29 // (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
30 // OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
31
32 // stack_frame_cpu.h: CPU-specific StackFrame extensions.
33 //
34 // These types extend the StackFrame structure to carry CPU-specific register
35 // state. They are defined in this header instead of stack_frame.h to
36 // avoid the need to include minidump_format.h when only the generic
37 // StackFrame type is needed.
38 //
39 // Author: Mark Mentovai
40
41 #ifndef GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
42 #define GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
43
44 #include "google_breakpad/common/minidump_format.h"
45 #include "google_breakpad/processor/stack_frame.h"
46
47 namespace google_breakpad {
48
49 struct WindowsFrameInfo;
50 struct CFIFrameInfo;
51
52 struct StackFrameX86 : public StackFrame {
53 // ContextValidity has one entry for each relevant hardware pointer
54 // register (%eip and %esp) and one entry for each general-purpose
55 // register. It's worthwhile having validity flags for caller-saves
56 // registers: they are valid in the youngest frame, and such a frame
57 // might save a callee-saves register in a caller-saves register, but
58 // SimpleCFIWalker won't touch registers unless they're marked as valid.
59 enum ContextValidity {
60 CONTEXT_VALID_NONE = 0,
61 CONTEXT_VALID_EIP = 1 << 0,
62 CONTEXT_VALID_ESP = 1 << 1,
63 CONTEXT_VALID_EBP = 1 << 2,
64 CONTEXT_VALID_EAX = 1 << 3,
65 CONTEXT_VALID_EBX = 1 << 4,
66 CONTEXT_VALID_ECX = 1 << 5,
67 CONTEXT_VALID_EDX = 1 << 6,
68 CONTEXT_VALID_ESI = 1 << 7,
69 CONTEXT_VALID_EDI = 1 << 8,
70 CONTEXT_VALID_ALL = -1
71 };
72
73 StackFrameX86()
74 : context(),
75 context_validity(CONTEXT_VALID_NONE),
76 windows_frame_info(NULL),
77 cfi_frame_info(NULL) {}
78 ~StackFrameX86();
79
80 // Register state. This is only fully valid for the topmost frame in a
81 // stack. In other frames, the values of nonvolatile registers may be
82 // present, given sufficient debugging information. Refer to
83 // context_validity.
84 MDRawContextX86 context;
85
86 // context_validity is actually ContextValidity, but int is used because
87 // the OR operator doesn't work well with enumerated types. This indicates
88 // which fields in context are valid.
89 int context_validity;
90
91 // Any stack walking information we found describing this.instruction.
92 // These may be NULL if there is no such information for that address.
93 WindowsFrameInfo *windows_frame_info;
94 CFIFrameInfo *cfi_frame_info;
95 };
96
97 struct StackFramePPC : public StackFrame {
98 // ContextValidity should eventually contain entries for the validity of
99 // other nonvolatile (callee-save) registers as in
100 // StackFrameX86::ContextValidity, but the ppc stackwalker doesn't currently
101 // locate registers other than the ones listed here.
102 enum ContextValidity {
103 CONTEXT_VALID_NONE = 0,
104 CONTEXT_VALID_SRR0 = 1 << 0,
105 CONTEXT_VALID_GPR1 = 1 << 1,
106 CONTEXT_VALID_ALL = -1
107 };
108
109 StackFramePPC() : context(), context_validity(CONTEXT_VALID_NONE) {}
110
111 // Register state. This is only fully valid for the topmost frame in a
112 // stack. In other frames, the values of nonvolatile registers may be
113 // present, given sufficient debugging information. Refer to
114 // context_validity.
115 MDRawContextPPC context;
116
117 // context_validity is actually ContextValidity, but int is used because
118 // the OR operator doesn't work well with enumerated types. This indicates
119 // which fields in context are valid.
120 int context_validity;
121 };
122
123 struct StackFrameAMD64 : public StackFrame {
124 // ContextValidity has one entry for each register that we might be able
125 // to recover.
126 enum ContextValidity {
127 CONTEXT_VALID_NONE = 0,
128 CONTEXT_VALID_RAX = 1 << 0,
129 CONTEXT_VALID_RDX = 1 << 1,
130 CONTEXT_VALID_RCX = 1 << 2,
131 CONTEXT_VALID_RBX = 1 << 3,
132 CONTEXT_VALID_RSI = 1 << 4,
133 CONTEXT_VALID_RDI = 1 << 5,
134 CONTEXT_VALID_RBP = 1 << 6,
135 CONTEXT_VALID_RSP = 1 << 7,
136 CONTEXT_VALID_R8 = 1 << 8,
137 CONTEXT_VALID_R9 = 1 << 9,
138 CONTEXT_VALID_R10 = 1 << 10,
139 CONTEXT_VALID_R11 = 1 << 11,
140 CONTEXT_VALID_R12 = 1 << 12,
141 CONTEXT_VALID_R13 = 1 << 13,
142 CONTEXT_VALID_R14 = 1 << 14,
143 CONTEXT_VALID_R15 = 1 << 15,
144 CONTEXT_VALID_RIP = 1 << 16,
145 CONTEXT_VALID_ALL = -1
146 };
147
148 StackFrameAMD64() : context(), context_validity(CONTEXT_VALID_NONE) {}
149
150 // Register state. This is only fully valid for the topmost frame in a
151 // stack. In other frames, which registers are present depends on what
152 // debugging information we had available. Refer to context_validity.
153 MDRawContextAMD64 context;
154
155 // For each register in context whose value has been recovered, we set
156 // the corresponding CONTEXT_VALID_ bit in context_validity.
157 //
158 // context_validity's type should actually be ContextValidity, but
159 // we use int instead because the bitwise inclusive or operator
160 // yields an int when applied to enum values, and C++ doesn't
161 // silently convert from ints to enums.
162 int context_validity;
163 };
164
165 struct StackFrameSPARC : public StackFrame {
166 // to be confirmed
167 enum ContextValidity {
168 CONTEXT_VALID_NONE = 0,
169 CONTEXT_VALID_PC = 1 << 0,
170 CONTEXT_VALID_SP = 1 << 1,
171 CONTEXT_VALID_FP = 1 << 2,
172 CONTEXT_VALID_ALL = -1
173 };
174
175 StackFrameSPARC() : context(), context_validity(CONTEXT_VALID_NONE) {}
176
177 // Register state. This is only fully valid for the topmost frame in a
178 // stack. In other frames, the values of nonvolatile registers may be
179 // present, given sufficient debugging information. Refer to
180 // context_validity.
181 MDRawContextSPARC context;
182
183 // context_validity is actually ContextValidity, but int is used because
184 // the OR operator doesn't work well with enumerated types. This indicates
185 // which fields in context are valid.
186 int context_validity;
187 };
188
189 struct StackFrameARM : public StackFrame {
190 // A flag for each register we might know.
191 enum ContextValidity {
192 CONTEXT_VALID_NONE = 0,
193 CONTEXT_VALID_R0 = 1 << 0,
194 CONTEXT_VALID_R1 = 1 << 1,
195 CONTEXT_VALID_R2 = 1 << 2,
196 CONTEXT_VALID_R3 = 1 << 3,
197 CONTEXT_VALID_R4 = 1 << 4,
198 CONTEXT_VALID_R5 = 1 << 5,
199 CONTEXT_VALID_R6 = 1 << 6,
200 CONTEXT_VALID_R7 = 1 << 7,
201 CONTEXT_VALID_R8 = 1 << 8,
202 CONTEXT_VALID_R9 = 1 << 9,
203 CONTEXT_VALID_R10 = 1 << 10,
204 CONTEXT_VALID_R11 = 1 << 11,
205 CONTEXT_VALID_R12 = 1 << 12,
206 CONTEXT_VALID_R13 = 1 << 13,
207 CONTEXT_VALID_R14 = 1 << 14,
208 CONTEXT_VALID_R15 = 1 << 15,
209 CONTEXT_VALID_ALL = ~CONTEXT_VALID_NONE,
210
211 // Aliases for registers with dedicated or conventional roles.
212 CONTEXT_VALID_FP = CONTEXT_VALID_R11,
213 CONTEXT_VALID_SP = CONTEXT_VALID_R13,
214 CONTEXT_VALID_LR = CONTEXT_VALID_R14,
215 CONTEXT_VALID_PC = CONTEXT_VALID_R15
216 };
217
218 StackFrameARM() : context(), context_validity(CONTEXT_VALID_NONE) {}
219
220 // Return the ContextValidity flag for register rN.
221 static ContextValidity RegisterValidFlag(int n) {
222 return ContextValidity(1 << n);
223 }
224
225 // Register state. This is only fully valid for the topmost frame in a
226 // stack. In other frames, the values of nonvolatile registers may be
227 // present, given sufficient debugging information. Refer to
228 // context_validity.
229 MDRawContextARM context;
230
231 // For each register in context whose value has been recovered, we set
232 // the corresponding CONTEXT_VALID_ bit in context_validity.
233 //
234 // context_validity's type should actually be ContextValidity, but
235 // we use int instead because the bitwise inclusive or operator
236 // yields an int when applied to enum values, and C++ doesn't
237 // silently convert from ints to enums.
238 int context_validity;
239 };
240
241 } // namespace google_breakpad
242
243 #endif // GOOGLE_BREAKPAD_PROCESSOR_STACK_FRAME_CPU_H__
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698