| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 #pragma once | 7 #pragma once |
| 8 | 8 |
| 9 #include <iosfwd> | 9 #include <iosfwd> |
| 10 | 10 |
| (...skipping 24 matching lines...) Expand all Loading... |
| 35 | 35 |
| 36 // Copying and assignment are allowed with the default functions. | 36 // Copying and assignment are allowed with the default functions. |
| 37 | 37 |
| 38 ~StackTrace(); | 38 ~StackTrace(); |
| 39 | 39 |
| 40 // Gets an array of instruction pointer values. |*count| will be set to the | 40 // Gets an array of instruction pointer values. |*count| will be set to the |
| 41 // number of elements in the returned array. | 41 // number of elements in the returned array. |
| 42 const void* const* Addresses(size_t* count); | 42 const void* const* Addresses(size_t* count); |
| 43 | 43 |
| 44 // Prints a backtrace to stderr | 44 // Prints a backtrace to stderr |
| 45 void PrintBacktrace(); | 45 void PrintBacktrace() const; |
| 46 | 46 |
| 47 // Resolves backtrace to symbols and write to stream. | 47 // Resolves backtrace to symbols and write to stream. |
| 48 void OutputToStream(std::ostream* os); | 48 void OutputToStream(std::ostream* os) const; |
| 49 | 49 |
| 50 private: | 50 private: |
| 51 // From http://msdn.microsoft.com/en-us/library/bb204633.aspx, | 51 // From http://msdn.microsoft.com/en-us/library/bb204633.aspx, |
| 52 // the sum of FramesToSkip and FramesToCapture must be less than 63, | 52 // the sum of FramesToSkip and FramesToCapture must be less than 63, |
| 53 // so set it to 62. Even if on POSIX it could be a larger value, it usually | 53 // so set it to 62. Even if on POSIX it could be a larger value, it usually |
| 54 // doesn't give much more information. | 54 // doesn't give much more information. |
| 55 static const int kMaxTraces = 62; | 55 static const int kMaxTraces = 62; |
| 56 | 56 |
| 57 void* trace_[kMaxTraces]; | 57 void* trace_[kMaxTraces]; |
| 58 int count_; | 58 int count_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace debug | 61 } // namespace debug |
| 62 } // namespace base | 62 } // namespace base |
| 63 | 63 |
| 64 #endif // BASE_DEBUG_STACK_TRACE_H_ | 64 #endif // BASE_DEBUG_STACK_TRACE_H_ |
| OLD | NEW |