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 <iosfwd> | 8 #include <iosfwd> |
9 #include <string> | 9 #include <string> |
10 | 10 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
66 // so set it to 62. Even if on POSIX it could be a larger value, it usually | 66 // so set it to 62. Even if on POSIX it could be a larger value, it usually |
67 // doesn't give much more information. | 67 // doesn't give much more information. |
68 static const int kMaxTraces = 62; | 68 static const int kMaxTraces = 62; |
69 | 69 |
70 void* trace_[kMaxTraces]; | 70 void* trace_[kMaxTraces]; |
71 | 71 |
72 // The number of valid frames in |trace_|. | 72 // The number of valid frames in |trace_|. |
73 size_t count_; | 73 size_t count_; |
74 }; | 74 }; |
75 | 75 |
| 76 namespace internal { |
| 77 |
| 78 #if defined(OS_POSIX) && !defined(OS_ANDROID) |
| 79 // POSIX doesn't define any async-signal safe function for converting |
| 80 // an integer to ASCII. We'll have to define our own version. |
| 81 // itoa_r() converts a (signed) integer to ASCII. It returns "buf", if the |
| 82 // conversion was successful or NULL otherwise. It never writes more than "sz" |
| 83 // bytes. Output will be truncated as needed, and a NUL character is always |
| 84 // appended. |
| 85 BASE_EXPORT char *itoa_r(intptr_t i, char *buf, size_t sz, int base); |
| 86 #endif // defined(OS_POSIX) && !defined(OS_ANDROID) |
| 87 |
| 88 } // namespace internal |
| 89 |
76 } // namespace debug | 90 } // namespace debug |
77 } // namespace base | 91 } // namespace base |
78 | 92 |
79 #endif // BASE_DEBUG_STACK_TRACE_H_ | 93 #endif // BASE_DEBUG_STACK_TRACE_H_ |
OLD | NEW |