OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef BASE_DEBUG_STACK_TRACE_H_ | 5 #ifndef BASE_DEBUG_STACK_TRACE_H_ |
6 #define BASE_DEBUG_STACK_TRACE_H_ | 6 #define BASE_DEBUG_STACK_TRACE_H_ |
7 | 7 |
8 #include <stddef.h> | 8 #include <stddef.h> |
9 | 9 |
10 #include <iosfwd> | 10 #include <iosfwd> |
11 #include <string> | 11 #include <string> |
12 | 12 |
13 #include "base/base_export.h" | 13 #include "base/base_export.h" |
14 #include "build/build_config.h" | 14 #include "build/build_config.h" |
15 | 15 |
16 #if defined(OS_POSIX) | 16 #if defined(OS_POSIX) |
17 #include <unistd.h> | 17 #include <unistd.h> |
18 #endif | 18 #endif |
19 | 19 |
20 #if defined(OS_WIN) | 20 #if defined(OS_WIN) |
21 struct _EXCEPTION_POINTERS; | 21 struct _EXCEPTION_POINTERS; |
22 struct _CONTEXT; | 22 struct _CONTEXT; |
23 #endif | 23 #endif |
24 | 24 |
25 #if defined(OS_POSIX) && ( \ | 25 #if defined(OS_POSIX) && ( \ |
26 defined(__i386__) || defined(__x86_64__) || \ | 26 defined(__i386__) || defined(__x86_64__) || \ |
27 (defined(__arm__) && !defined(__thumb__))) | 27 (defined(__arm__) && ( \ |
| 28 /* We don't normally support thumb mode... */ \ |
| 29 !defined(__thumb__) || \ |
| 30 /* ...unless we're building non-component build with Clang. \ |
| 31 Clang properly sets up fp register, so we can walk stack frames, \ |
| 32 but it pushes arbitrary number of registers between fp (r7) and \ |
| 33 lr (r14). However in non-component build, where all code is \ |
| 34 inside a single mapped region, it's possible to guess lr by \ |
| 35 probing up to 7 locations on the stack. */ \ |
| 36 (defined(__clang__) && !defined(COMPONENT_BUILD) && \ |
| 37 defined(OS_ANDROID))))) |
28 #define HAVE_TRACE_STACK_FRAME_POINTERS 1 | 38 #define HAVE_TRACE_STACK_FRAME_POINTERS 1 |
29 #else | 39 #else |
30 #define HAVE_TRACE_STACK_FRAME_POINTERS 0 | 40 #define HAVE_TRACE_STACK_FRAME_POINTERS 0 |
31 #endif | 41 #endif |
32 | 42 |
33 namespace base { | 43 namespace base { |
34 namespace debug { | 44 namespace debug { |
35 | 45 |
36 // Enables stack dump to console output on exception and signals. | 46 // Enables stack dump to console output on exception and signals. |
37 // When enabled, the process will quit immediately. This is meant to be used in | 47 // When enabled, the process will quit immediately. This is meant to be used in |
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
130 int base, | 140 int base, |
131 size_t padding); | 141 size_t padding); |
132 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 142 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
133 | 143 |
134 } // namespace internal | 144 } // namespace internal |
135 | 145 |
136 } // namespace debug | 146 } // namespace debug |
137 } // namespace base | 147 } // namespace base |
138 | 148 |
139 #endif // BASE_DEBUG_STACK_TRACE_H_ | 149 #endif // BASE_DEBUG_STACK_TRACE_H_ |
OLD | NEW |