tensorflow/core/platform/default/stacktrace_handler.cc
// This function will print stacktrace to STDERR.
// It avoids using malloc, so it makes sure to dump the stack even when the heap
// is corrupted. However, it can dump mangled symbols.
This function will print stacktrace to STDERR.
It avoids using malloc, so it makes sure to dump the stack even when the heap
is corrupted. However, it can dump mangled symbols.
This function will print stacktrace to STDERR . It avoids using malloc so it makes sure to dump the stack even when the heap is corrupted . However it can dump mangled symbols .
inline void SafePrintStackTrace() {
  static const char begin_msg[] = "*** BEGIN MANGLED STACK TRACE ***\n";
  (void)write(STDERR_FILENO, begin_msg, strlen(begin_msg));
  int buffer_size = 128;
  void *trace[128];
  buffer_size = backtrace(trace, buffer_size);
  backtrace_symbols_fd(trace, buffer_size, STDERR_FILENO);
  static const char end_msg[] = "*** END MANGLED STACK TRACE ***\n\n";
  (void)write(STDERR_FILENO, end_msg, strlen(end_msg));
}
inline void SafePrintStackTrace ( ) { static const char begin_msg [ ] = " \n " ; ( void ) write ( STDERR_FILENO , begin_msg , strlen ( begin_msg ) ) ; int buffer_size = 128 ; void * trace [ 128 ] ; buffer_size = backtrace ( trace , buffer_size ) ; backtrace_symbols_fd ( trace , buffer_size , STDERR_FILENO ) ; static const char end_msg [ ] = " \n \n " ; ( void ) write ( STDERR_FILENO , end_msg , strlen ( end_msg ) ) ; }
This function will print stacktrace to STDERR.
This function will print stacktrace to STDERR .
// Run backtrace to get the size of the stacktrace // Print a mangled stacktrace to STDERR as safely as possible.