| 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 #include "base/debug/stack_trace.h" | 5 #include "base/debug/stack_trace.h" |
| 6 | 6 |
| 7 #include <errno.h> | 7 #include <errno.h> |
| 8 #include <execinfo.h> | 8 #include <execinfo.h> |
| 9 #include <fcntl.h> | 9 #include <fcntl.h> |
| 10 #include <signal.h> | 10 #include <signal.h> |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 241 // stack dumping signal handler). NO malloc or stdio is allowed here. | 241 // stack dumping signal handler). NO malloc or stdio is allowed here. |
| 242 ignore_result(HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)))); | 242 ignore_result(HANDLE_EINTR(write(STDERR_FILENO, output, strlen(output)))); |
| 243 } | 243 } |
| 244 | 244 |
| 245 private: | 245 private: |
| 246 DISALLOW_COPY_AND_ASSIGN(PrintBacktraceOutputHandler); | 246 DISALLOW_COPY_AND_ASSIGN(PrintBacktraceOutputHandler); |
| 247 }; | 247 }; |
| 248 | 248 |
| 249 class StreamBacktraceOutputHandler : public BacktraceOutputHandler { | 249 class StreamBacktraceOutputHandler : public BacktraceOutputHandler { |
| 250 public: | 250 public: |
| 251 StreamBacktraceOutputHandler(std::ostream* os) : os_(os) { | 251 explicit StreamBacktraceOutputHandler(std::ostream* os) : os_(os) { |
| 252 } | 252 } |
| 253 | 253 |
| 254 virtual void HandleOutput(const char* output) { | 254 virtual void HandleOutput(const char* output) { |
| 255 (*os_) << output; | 255 (*os_) << output; |
| 256 } | 256 } |
| 257 | 257 |
| 258 private: | 258 private: |
| 259 std::ostream* os_; | 259 std::ostream* os_; |
| 260 | 260 |
| 261 DISALLOW_COPY_AND_ASSIGN(StreamBacktraceOutputHandler); | 261 DISALLOW_COPY_AND_ASSIGN(StreamBacktraceOutputHandler); |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 401 *ptr = *start; | 401 *ptr = *start; |
| 402 *start++ = ch; | 402 *start++ = ch; |
| 403 } | 403 } |
| 404 return buf; | 404 return buf; |
| 405 } | 405 } |
| 406 | 406 |
| 407 } // namespace internal | 407 } // namespace internal |
| 408 | 408 |
| 409 } // namespace debug | 409 } // namespace debug |
| 410 } // namespace base | 410 } // namespace base |
| OLD | NEW |