OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2006 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
(...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
60 // to get usable symbols on Linux. This is copied from V8. Chromium has a more | 60 // to get usable symbols on Linux. This is copied from V8. Chromium has a more |
61 // advanced stace trace system; also more difficult to copy. | 61 // advanced stace trace system; also more difficult to copy. |
62 void DumpBacktrace() { | 62 void DumpBacktrace() { |
63 #if defined(__GLIBCXX__) && !defined(__UCLIBC__) | 63 #if defined(__GLIBCXX__) && !defined(__UCLIBC__) |
64 void* trace[100]; | 64 void* trace[100]; |
65 int size = backtrace(trace, sizeof(trace) / sizeof(*trace)); | 65 int size = backtrace(trace, sizeof(trace) / sizeof(*trace)); |
66 char** symbols = backtrace_symbols(trace, size); | 66 char** symbols = backtrace_symbols(trace, size); |
67 PrintError("\n==== C stack trace ===============================\n\n"); | 67 PrintError("\n==== C stack trace ===============================\n\n"); |
68 if (size == 0) { | 68 if (size == 0) { |
69 PrintError("(empty)\n"); | 69 PrintError("(empty)\n"); |
70 } else if (symbols == NULL) { | 70 } else if (symbols == nullptr) { |
71 PrintError("(no symbols)\n"); | 71 PrintError("(no symbols)\n"); |
72 } else { | 72 } else { |
73 for (int i = 1; i < size; ++i) { | 73 for (int i = 1; i < size; ++i) { |
74 char mangled[201]; | 74 char mangled[201]; |
75 if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT | 75 if (sscanf(symbols[i], "%*[^(]%*[(]%200[^)+]", mangled) == 1) { // NOLINT |
76 PrintError("%2d: ", i); | 76 PrintError("%2d: ", i); |
77 int status; | 77 int status; |
78 size_t length; | 78 size_t length; |
79 char* demangled = abi::__cxa_demangle(mangled, NULL, &length, &status); | 79 char* demangled = |
80 PrintError("%s\n", demangled != NULL ? demangled : mangled); | 80 abi::__cxa_demangle(mangled, nullptr, &length, &status); |
| 81 PrintError("%s\n", demangled != nullptr ? demangled : mangled); |
81 free(demangled); | 82 free(demangled); |
82 } else { | 83 } else { |
83 // If parsing failed, at least print the unparsed symbol. | 84 // If parsing failed, at least print the unparsed symbol. |
84 PrintError("%s\n", symbols[i]); | 85 PrintError("%s\n", symbols[i]); |
85 } | 86 } |
86 } | 87 } |
87 } | 88 } |
88 free(symbols); | 89 free(symbols); |
89 #endif | 90 #endif |
90 } | 91 } |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 template std::string* MakeCheckOpString<std::string, std::string>( | 132 template std::string* MakeCheckOpString<std::string, std::string>( |
132 const std::string&, const std::string&, const char* name); | 133 const std::string&, const std::string&, const char* name); |
133 #endif | 134 #endif |
134 | 135 |
135 } // namespace rtc | 136 } // namespace rtc |
136 | 137 |
137 // Function to call from the C version of the RTC_CHECK and RTC_DCHECK macros. | 138 // Function to call from the C version of the RTC_CHECK and RTC_DCHECK macros. |
138 NO_RETURN void rtc_FatalMessage(const char* file, int line, const char* msg) { | 139 NO_RETURN void rtc_FatalMessage(const char* file, int line, const char* msg) { |
139 rtc::FatalMessage(file, line).stream() << msg; | 140 rtc::FatalMessage(file, line).stream() << msg; |
140 } | 141 } |
OLD | NEW |