Chromium Code Reviews| 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 "base/debug/debugging_flags.h" | 14 #include "base/debug/debugging_flags.h" |
| 15 #include "base/macros.h" | 15 #include "base/macros.h" |
| 16 #include "build/build_config.h" | 16 #include "build/build_config.h" |
| 17 | 17 |
| 18 #if defined(OS_POSIX) | 18 #if defined(OS_POSIX) |
| 19 #include <unistd.h> | 19 #include <unistd.h> |
| 20 #endif | 20 #endif |
| 21 | 21 |
| 22 #if defined(OS_WIN) | 22 #if defined(OS_WIN) |
| 23 struct _EXCEPTION_POINTERS; | 23 struct _EXCEPTION_POINTERS; |
| 24 struct _CONTEXT; | 24 struct _CONTEXT; |
| 25 #endif | 25 #endif |
| 26 | 26 |
| 27 // Fast stack trace capture using frame pointers is only available under POSIX | |
| 28 // platforms, and only for certain architectures, and only when frame pointers | |
| 29 // are enabled in the build. | |
| 30 #if defined(OS_POSIX) | |
| 31 #if BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG) | |
| 32 | |
| 33 #if defined(__i386__) || defined(__x86_64__) | |
| 34 #define HAVE_TRACE_STACK_FRAME_POINTERS 1 | |
| 35 #elif defined(__arm__) && !defined(__thumb__) | |
| 36 #define HAVE_TRACE_STACK_FRAME_POINTERS 1 | |
| 37 #else // defined(__arm__) && !defined(__thumb__) | |
|
Primiano Tucci (use gerrit)
2017/03/30 13:15:03
where did this logic go?
The deal here is that we
erikchen
2017/03/30 22:12:47
The !thumb logic was added here:
https://bugs.chro
| |
| 38 #define HAVE_TRACE_STACK_FRAME_POINTERS 0 | |
| 39 #endif // defined(__arm__) && !defined(__thumb__) | |
| 40 | |
| 41 #else // BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG) | |
| 42 #define HAVE_TRACE_STACK_FRAME_POINTERS 0 | |
| 43 #endif // BUILDFLAG(ENABLE_PROFILING) || !defined(NDEBUG) | |
| 44 | |
| 45 #else // defined(OS_POSIX) | |
| 46 #define HAVE_TRACE_STACK_FRAME_POINTERS 0 | |
| 47 #endif // defined(OS_POSIX) | |
| 48 | |
| 49 namespace base { | 27 namespace base { |
| 50 namespace debug { | 28 namespace debug { |
| 51 | 29 |
| 52 // Enables stack dump to console output on exception and signals. | 30 // Enables stack dump to console output on exception and signals. |
| 53 // When enabled, the process will quit immediately. This is meant to be used in | 31 // When enabled, the process will quit immediately. This is meant to be used in |
| 54 // unit_tests only! This is not thread-safe: only call from main thread. | 32 // unit_tests only! This is not thread-safe: only call from main thread. |
| 55 // In sandboxed processes, this has to be called before the sandbox is turned | 33 // In sandboxed processes, this has to be called before the sandbox is turned |
| 56 // on. | 34 // on. |
| 57 // Calling this function on Linux opens /proc/self/maps and caches its | 35 // Calling this function on Linux opens /proc/self/maps and caches its |
| 58 // contents. In non-official builds, this function also opens the object files | 36 // contents. In non-official builds, this function also opens the object files |
| (...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 204 int base, | 182 int base, |
| 205 size_t padding); | 183 size_t padding); |
| 206 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 184 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
| 207 | 185 |
| 208 } // namespace internal | 186 } // namespace internal |
| 209 | 187 |
| 210 } // namespace debug | 188 } // namespace debug |
| 211 } // namespace base | 189 } // namespace base |
| 212 | 190 |
| 213 #endif // BASE_DEBUG_STACK_TRACE_H_ | 191 #endif // BASE_DEBUG_STACK_TRACE_H_ |
| OLD | NEW |