#include <unistd.h>
#endif
+#include "build/build_config.h"
+
#if V8_OS_WIN
struct _EXCEPTION_POINTERS;
struct _CONTEXT;
void InitTrace(const _CONTEXT* context_record);
#endif
+#if BUILDFLAG(IS_TIZEN_TV)
+ static const int kMaxTraces = 250;
+#else
// From http://msdn.microsoft.com/en-us/library/bb204633.aspx,
// the sum of FramesToSkip and FramesToCapture must be less than 63,
// so set it to 62. Even if on POSIX it could be a larger value, it usually
// doesn't give much more information.
static const int kMaxTraces = 62;
-
+#endif
void* trace_[kMaxTraces];
// The number of valid frames in |trace_|.
#include "src/base/logging.h"
#include "src/base/macros.h"
+#include "base/third_party/symbolize/symbolize.h"
+
namespace v8 {
namespace base {
namespace debug {
handler->HandleOutput(buf);
}
+void OutputValue(size_t value, BacktraceOutputHandler* handler) {
+ // Max unsigned 64-bit number in decimal has 20 digits (18446744073709551615).
+ // Hence, 30 digits should be more than enough to represent it in decimal
+ // (including the null-terminator).
+ char buf[30] = {'\0'};
+ internal::itoa_r(static_cast<intptr_t>(value), buf, sizeof(buf), 10, 1);
+ handler->HandleOutput(buf);
+}
+
+#if BUILDFLAG(IS_TIZEN_TV)
+void ProcessBacktraceImpl(void* const* trace,
+ size_t size,
+ BacktraceOutputHandler* handler) {
+ for (size_t i = 0; i < size; ++i) {
+ handler->HandleOutput("#");
+ OutputValue(i, handler);
+
+ handler->HandleOutput(" ");
+ OutputPointer(trace[i], handler);
+ handler->HandleOutput(" ");
+
+ char buf[1024] = {'\0'};
+ const void* address = static_cast<const char*>(trace[i]) - 1;
+ if (google::Symbolize(const_cast<void*>(address), buf, sizeof(buf))) {
+ handler->HandleOutput(buf);
+ } else {
+ handler->HandleOutput("<unknown>");
+ }
+
+ handler->HandleOutput("\n");
+ }
+}
+#endif
+
void ProcessBacktrace(void* const* trace, size_t size,
BacktraceOutputHandler* handler) {
// NOTE: This code MUST be async-signal safe (it's used by in-process
// Below part is async-signal unsafe (uses malloc), so execute it only
// when we are not executing the signal handler.
if (in_signal_handler == 0) {
+#if BUILDFLAG(IS_TIZEN_TV)
+ ProcessBacktraceImpl(trace, size, handler);
+ printed = true;
+#else
std::unique_ptr<char*, FreeDeleter> trace_symbols(
backtrace_symbols(trace, static_cast<int>(size)));
if (trace_symbols.get()) {
printed = true;
}
+#endif
}
if (!printed) {