1 /** 2 * Copyright (c) 2022 Huawei Device Co., Ltd. 3 * Licensed under the Apache License, Version 2.0 (the "License"); 4 * you may not use this file except in compliance with the License. 5 * You may obtain a copy of the License at 6 * 7 * http://www.apache.org/licenses/LICENSE-2.0 8 * 9 * Unless required by applicable law or agreed to in writing, software 10 * distributed under the License is distributed on an "AS IS" BASIS, 11 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 * See the License for the specific language governing permissions and 13 * limitations under the License. 14 */ 15 16 #ifndef PANDA_TOOLING_INSPECTOR_TEST_INSTRUCTION_POINTER_H 17 #define PANDA_TOOLING_INSPECTOR_TEST_INSTRUCTION_POINTER_H 18 19 #include "test_frame.h" 20 21 #include "bytecode_instruction.h" 22 #include "macros.h" 23 24 #include <cstddef> 25 #include <string_view> 26 27 namespace panda::tooling::inspector::test { 28 class Client; 29 class TestDebugger; 30 31 class InstructionPointer { 32 public: InstructionPointer(TestFrame & frame,Client & client,TestDebugger & debugger)33 InstructionPointer(TestFrame &frame, Client &client, TestDebugger &debugger) 34 : frame_(frame), client_(client), debugger_(debugger) 35 { 36 } 37 38 NO_COPY_SEMANTIC(InstructionPointer); 39 DEFAULT_MOVE_CTOR(InstructionPointer) 40 NO_MOVE_OPERATOR(InstructionPointer); 41 42 ~InstructionPointer(); 43 GetMethod()44 Method *GetMethod() const 45 { 46 return frame_.GetMethod(); 47 } 48 49 void ContinueTo(std::string_view scriptId, size_t lineNumber); 50 void Finish(); 51 void Resume(); 52 void Step(); 53 void StepInto(); 54 void StepOut(); 55 void StepOver(); 56 57 private: 58 void Reset(); 59 60 TestFrame &frame_; 61 Client &client_; 62 TestDebugger &debugger_; 63 BytecodeInstructionSafe instruction_; 64 bool unset_ {true}; 65 }; 66 } // namespace panda::tooling::inspector::test 67 68 #endif // PANDA_TOOLING_INSPECTOR_TEST_INSTRUCTION_POINTER_H 69