chromium/v8/src/base/debug/stack_trace.h

// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

// Slightly adapted for inclusion in V8.
// Copyright 2016 the V8 project authors. All rights reserved.

#ifndef V8_BASE_DEBUG_STACK_TRACE_H_
#define V8_BASE_DEBUG_STACK_TRACE_H_

#include <stddef.h>

#include <iosfwd>
#include <string>

#include "src/base/base-export.h"
#include "src/base/build_config.h"

#if V8_OS_POSIX
#include <unistd.h>
#endif

#if V8_OS_WIN
struct _EXCEPTION_POINTERS;
struct _CONTEXT;
#endif

namespace v8 {
namespace base {
namespace debug {

// Enables stack dump to console output on exception and signals.
// When enabled, the process will quit immediately. This is meant to be used in
// tests only!
V8_BASE_EXPORT bool EnableInProcessStackDumping();
V8_BASE_EXPORT void DisableSignalStackDump();

// A stacktrace can be helpful in debugging. For example, you can include a
// stacktrace member in an object (probably around #ifndef NDEBUG) so that you
// can later see where the given object was created from.
class V8_BASE_EXPORT StackTrace {};

}  // namespace debug
}  // namespace base
}  // namespace v8

#endif  // V8_BASE_DEBUG_STACK_TRACE_H_