1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #include "src/base/debug/stack_trace.h" 6 7 #include <iomanip> 8 #include <ostream> 9 10 #include "src/base/platform/platform.h" 11 12 namespace v8 { 13 namespace base { 14 namespace debug { 15 EnableInProcessStackDumping()16bool EnableInProcessStackDumping() { 17 // The system crashlogger captures and prints backtraces which are then 18 // symbolized by a host-side script that runs addr2line. Because symbols are 19 // not available on device, there's not much use in implementing in-process 20 // capture. 21 return false; 22 } 23 DisableSignalStackDump()24void DisableSignalStackDump() {} 25 StackTrace()26StackTrace::StackTrace() {} 27 Print() const28void StackTrace::Print() const { 29 std::string backtrace = ToString(); 30 OS::Print("%s\n", backtrace.c_str()); 31 } 32 OutputToStream(std::ostream * os) const33void StackTrace::OutputToStream(std::ostream* os) const { 34 for (size_t i = 0; i < count_; ++i) { 35 *os << "#" << std::setw(2) << i << trace_[i] << "\n"; 36 } 37 } 38 39 } // namespace debug 40 } // namespace base 41 } // namespace v8 42