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> |
(...skipping 27 matching lines...) Expand all Loading... |
38 // When enabled, the process will quit immediately. This is meant to be used in | 38 // When enabled, the process will quit immediately. This is meant to be used in |
39 // unit_tests only! This is not thread-safe: only call from main thread. | 39 // unit_tests only! This is not thread-safe: only call from main thread. |
40 // In sandboxed processes, this has to be called before the sandbox is turned | 40 // In sandboxed processes, this has to be called before the sandbox is turned |
41 // on. | 41 // on. |
42 // Calling this function on Linux opens /proc/self/maps and caches its | 42 // Calling this function on Linux opens /proc/self/maps and caches its |
43 // contents. In non-official builds, this function also opens the object files | 43 // contents. In non-official builds, this function also opens the object files |
44 // that are loaded in memory and caches their file descriptors (this cannot be | 44 // that are loaded in memory and caches their file descriptors (this cannot be |
45 // done in official builds because it has security implications). | 45 // done in official builds because it has security implications). |
46 BASE_EXPORT bool EnableInProcessStackDumping(); | 46 BASE_EXPORT bool EnableInProcessStackDumping(); |
47 | 47 |
| 48 // Returns end of the stack, or 0 if we couldn't get it. |
| 49 #if HAVE_TRACE_STACK_FRAME_POINTERS |
| 50 BASE_EXPORT uintptr_t GetStackEnd(); |
| 51 #endif |
| 52 |
48 // A stacktrace can be helpful in debugging. For example, you can include a | 53 // A stacktrace can be helpful in debugging. For example, you can include a |
49 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you | 54 // stacktrace member in a object (probably around #ifndef NDEBUG) so that you |
50 // can later see where the given object was created from. | 55 // can later see where the given object was created from. |
51 class BASE_EXPORT StackTrace { | 56 class BASE_EXPORT StackTrace { |
52 public: | 57 public: |
53 // Creates a stacktrace from the current location. | 58 // Creates a stacktrace from the current location. |
54 StackTrace(); | 59 StackTrace(); |
55 | 60 |
56 // Creates a stacktrace from the current location, of up to |count| entries. | 61 // Creates a stacktrace from the current location, of up to |count| entries. |
57 // |count| will be limited to at most |kMaxTraces|. | 62 // |count| will be limited to at most |kMaxTraces|. |
(...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
184 int base, | 189 int base, |
185 size_t padding); | 190 size_t padding); |
186 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) | 191 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
187 | 192 |
188 } // namespace internal | 193 } // namespace internal |
189 | 194 |
190 } // namespace debug | 195 } // namespace debug |
191 } // namespace base | 196 } // namespace base |
192 | 197 |
193 #endif // BASE_DEBUG_STACK_TRACE_H_ | 198 #endif // BASE_DEBUG_STACK_TRACE_H_ |
OLD | NEW |