chromium/v8/src/debug/debug.h

// Copyright 2012 the V8 project authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef V8_DEBUG_DEBUG_H_
#define V8_DEBUG_DEBUG_H_

#include <memory>
#include <optional>
#include <unordered_map>
#include <vector>

#include "src/base/enum-set.h"
#include "src/base/platform/elapsed-timer.h"
#include "src/codegen/source-position-table.h"
#include "src/common/globals.h"
#include "src/debug/debug-interface.h"
#include "src/debug/interface-types.h"
#include "src/execution/interrupts-scope.h"
#include "src/execution/isolate.h"
#include "src/handles/handles.h"
#include "src/objects/debug-objects.h"
#include "src/objects/shared-function-info.h"

namespace v8 {
namespace internal {

// Forward declarations.
class AbstractCode;
class DebugScope;
class InterpretedFrame;
class JavaScriptFrame;
class JSGeneratorObject;
class StackFrame;

// Step actions.
enum StepAction : int8_t {};

// Type of exception break. NOTE: These values are in macros.py as well.
enum ExceptionBreakType {};

// Type of debug break. NOTE: The order matters for the predicates
// below inside BreakLocation, so be careful when adding / removing.
enum DebugBreakType {};

enum IgnoreBreakMode {};

class BreakLocation {};

class V8_EXPORT_PRIVATE BreakIterator {};

// Holds all active DebugInfo objects. This is a composite data structure
// consisting of
//
// - an unsorted list-like structure for fast iteration and
//   deletion-during-iteration, and
// - a map-like structure for fast SharedFunctionInfo-DebugInfo lookups.
//
// DebugInfos are held strongly through global handles.
//
// TODO(jgruber): Now that we use an unordered_map as the map-like structure,
// which supports deletion-during-iteration, the list-like part of this data
// structure could be removed.
class DebugInfoCollection final {};

// This class contains the debugger support. The main purpose is to handle
// setting break points in the code.
//
// This class controls the debug info for all functions which currently have
// active breakpoints in them. This debug info is held in the heap root object
// debug_info which is a FixedArray. Each entry in this list is of class
// DebugInfo.
class V8_EXPORT_PRIVATE Debug {};

// This scope is used to load and enter the debug context and create a new
// break state.  Leaving the scope will restore the previous state.
class V8_NODISCARD DebugScope {};

// This scope is used to handle return values in nested debug break points.
// When there are nested debug breaks, we use this to restore the return
// value to the previous state. This is not merged with DebugScope because
// return_value_ will not be cleared when we use DebugScope.
class V8_NODISCARD ReturnValueScope {};

// Stack allocated class for disabling break.
class DisableBreak {};

// Stack allocated class for disabling temporary object tracking.
class DisableTemporaryObjectTracking {};

class SuppressDebug {};

}  // namespace internal
}  // namespace v8

#endif  // V8_DEBUG_DEBUG_H_