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 // Slightly adapted for inclusion in V8. | 5 // Slightly adapted for inclusion in V8. |
6 // Copyright 2016 the V8 project authors. All rights reserved. | 6 // Copyright 2016 the V8 project authors. All rights reserved. |
7 | 7 |
8 #include "src/base/debug/stack_trace.h" | 8 #include "src/base/debug/stack_trace.h" |
9 | 9 |
10 #include <errno.h> | 10 #include <errno.h> |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
168 handler->HandleOutput(" ["); | 168 handler->HandleOutput(" ["); |
169 OutputPointer(trace[i], handler); | 169 OutputPointer(trace[i], handler); |
170 handler->HandleOutput("]\n"); | 170 handler->HandleOutput("]\n"); |
171 } | 171 } |
172 } | 172 } |
173 } | 173 } |
174 | 174 |
175 void PrintToStderr(const char* output) { | 175 void PrintToStderr(const char* output) { |
176 // NOTE: This code MUST be async-signal safe (it's used by in-process | 176 // NOTE: This code MUST be async-signal safe (it's used by in-process |
177 // stack dumping signal handler). NO malloc or stdio is allowed here. | 177 // stack dumping signal handler). NO malloc or stdio is allowed here. |
178 write(STDERR_FILENO, output, strlen(output)); | 178 ssize_t return_val = write(STDERR_FILENO, output, strlen(output)); |
| 179 USE(return_val); |
179 } | 180 } |
180 | 181 |
181 void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { | 182 void StackDumpSignalHandler(int signal, siginfo_t* info, void* void_context) { |
182 // NOTE: This code MUST be async-signal safe. | 183 // NOTE: This code MUST be async-signal safe. |
183 // NO malloc or stdio is allowed here. | 184 // NO malloc or stdio is allowed here. |
184 | 185 |
185 // Record the fact that we are in the signal handler now, so that the rest | 186 // Record the fact that we are in the signal handler now, so that the rest |
186 // of StackTrace can behave in an async-signal-safe manner. | 187 // of StackTrace can behave in an async-signal-safe manner. |
187 in_signal_handler = 1; | 188 in_signal_handler = 1; |
188 | 189 |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
436 *start++ = ch; | 437 *start++ = ch; |
437 } | 438 } |
438 return buf; | 439 return buf; |
439 } | 440 } |
440 | 441 |
441 } // namespace internal | 442 } // namespace internal |
442 | 443 |
443 } // namespace debug | 444 } // namespace debug |
444 } // namespace base | 445 } // namespace base |
445 } // namespace v8 | 446 } // namespace v8 |
OLD | NEW |