1 // Copyright 2017 the V8 project authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 6 #define V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 7 8 #include "src/debug/debug-frames.h" 9 #include "src/debug/debug-interface.h" 10 #include "src/debug/debug-scopes.h" 11 #include "src/frames.h" 12 13 namespace v8 { 14 namespace internal { 15 16 class DebugScopeIterator final : public debug::ScopeIterator { 17 public: 18 DebugScopeIterator(Isolate* isolate, FrameInspector* frame_inspector); 19 DebugScopeIterator(Isolate* isolate, Handle<JSFunction> function); 20 DebugScopeIterator(Isolate* isolate, Handle<JSGeneratorObject> generator); 21 22 bool Done() override; 23 void Advance() override; 24 ScopeType GetType() override; 25 v8::Local<v8::Object> GetObject() override; 26 v8::Local<v8::Value> GetFunctionDebugName() override; 27 int GetScriptId() override; 28 bool HasLocationInfo() override; 29 debug::Location GetStartLocation() override; 30 debug::Location GetEndLocation() override; 31 32 bool SetVariableValue(v8::Local<v8::String> name, 33 v8::Local<v8::Value> value) override; 34 35 private: 36 bool ShouldIgnore(); 37 38 v8::internal::ScopeIterator iterator_; 39 }; 40 41 class DebugWasmScopeIterator final : public debug::ScopeIterator { 42 public: 43 DebugWasmScopeIterator(Isolate* isolate, StandardFrame* frame, 44 int inlined_frame_index); 45 46 bool Done() override; 47 void Advance() override; 48 ScopeType GetType() override; 49 v8::Local<v8::Object> GetObject() override; 50 v8::Local<v8::Value> GetFunctionDebugName() override; 51 int GetScriptId() override; 52 bool HasLocationInfo() override; 53 debug::Location GetStartLocation() override; 54 debug::Location GetEndLocation() override; 55 56 bool SetVariableValue(v8::Local<v8::String> name, 57 v8::Local<v8::Value> value) override; 58 private: 59 Isolate* isolate_; 60 StandardFrame* frame_; 61 int inlined_frame_index_; 62 ScopeType type_; 63 }; 64 } // namespace internal 65 } // namespace v8 66 67 #endif // V8_DEBUG_DEBUG_SCOPE_ITERATOR_H_ 68