11cb0ef41Sopenharmony_ci// Copyright 2017 the V8 project authors. All rights reserved.
21cb0ef41Sopenharmony_ci// Use of this source code is governed by a BSD-style license that can be
31cb0ef41Sopenharmony_ci// found in the LICENSE file.
41cb0ef41Sopenharmony_ci
51cb0ef41Sopenharmony_ci#ifndef V8_DEBUG_DEBUG_STACK_TRACE_ITERATOR_H_
61cb0ef41Sopenharmony_ci#define V8_DEBUG_DEBUG_STACK_TRACE_ITERATOR_H_
71cb0ef41Sopenharmony_ci
81cb0ef41Sopenharmony_ci#include <memory>
91cb0ef41Sopenharmony_ci
101cb0ef41Sopenharmony_ci#include "src/debug/debug-frames.h"
111cb0ef41Sopenharmony_ci#include "src/debug/debug-interface.h"
121cb0ef41Sopenharmony_ci#include "src/execution/frames.h"
131cb0ef41Sopenharmony_ci
141cb0ef41Sopenharmony_cinamespace v8 {
151cb0ef41Sopenharmony_cinamespace internal {
161cb0ef41Sopenharmony_ci
171cb0ef41Sopenharmony_ciclass DebugStackTraceIterator final : public debug::StackTraceIterator {
181cb0ef41Sopenharmony_ci public:
191cb0ef41Sopenharmony_ci  DebugStackTraceIterator(Isolate* isolate, int index);
201cb0ef41Sopenharmony_ci  ~DebugStackTraceIterator() override;
211cb0ef41Sopenharmony_ci
221cb0ef41Sopenharmony_ci  bool Done() const override;
231cb0ef41Sopenharmony_ci  void Advance() override;
241cb0ef41Sopenharmony_ci
251cb0ef41Sopenharmony_ci  int GetContextId() const override;
261cb0ef41Sopenharmony_ci  v8::MaybeLocal<v8::Value> GetReceiver() const override;
271cb0ef41Sopenharmony_ci  v8::Local<v8::Value> GetReturnValue() const override;
281cb0ef41Sopenharmony_ci  v8::Local<v8::String> GetFunctionDebugName() const override;
291cb0ef41Sopenharmony_ci  v8::Local<v8::debug::Script> GetScript() const override;
301cb0ef41Sopenharmony_ci  debug::Location GetSourceLocation() const override;
311cb0ef41Sopenharmony_ci  v8::Local<v8::Function> GetFunction() const override;
321cb0ef41Sopenharmony_ci  std::unique_ptr<v8::debug::ScopeIterator> GetScopeIterator() const override;
331cb0ef41Sopenharmony_ci
341cb0ef41Sopenharmony_ci  v8::MaybeLocal<v8::Value> Evaluate(v8::Local<v8::String> source,
351cb0ef41Sopenharmony_ci                                     bool throw_on_side_effect) override;
361cb0ef41Sopenharmony_ci
371cb0ef41Sopenharmony_ci private:
381cb0ef41Sopenharmony_ci  Isolate* isolate_;
391cb0ef41Sopenharmony_ci  StackTraceFrameIterator iterator_;
401cb0ef41Sopenharmony_ci  std::unique_ptr<FrameInspector> frame_inspector_;
411cb0ef41Sopenharmony_ci  int inlined_frame_index_;
421cb0ef41Sopenharmony_ci  bool is_top_frame_;
431cb0ef41Sopenharmony_ci};
441cb0ef41Sopenharmony_ci}  // namespace internal
451cb0ef41Sopenharmony_ci}  // namespace v8
461cb0ef41Sopenharmony_ci
471cb0ef41Sopenharmony_ci#endif  // V8_DEBUG_DEBUG_STACK_TRACE_ITERATOR_H_
48