1 /* 2 * Copyright (c) 2021 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 ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H 17 #define ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H 18 19 #include "base/pt_events.h" 20 #include "base/pt_script.h" 21 22 #include "ecmascript/debugger/js_debugger_interface.h" 23 #include "libpandabase/macros.h" 24 25 namespace panda::ecmascript::tooling { 26 class DebuggerImpl; 27 28 class JSPtHooks : public PtHooks { 29 public: JSPtHooks(DebuggerImpl * debugger)30 explicit JSPtHooks(DebuggerImpl *debugger) : debugger_(debugger) {} 31 ~JSPtHooks() override = default; 32 33 void Breakpoint(const JSPtLocation &location) override; 34 void LoadModule(std::string_view pandaFileName, std::string_view entryPoint) override; 35 void Exception(const JSPtLocation &location) override; 36 bool SingleStep(const JSPtLocation &location) override; 37 void NativeCalling(const void *nativeAddress) override; 38 void PendingJobEntry() override; VmStart()39 void VmStart() override {} VmDeath()40 void VmDeath() override {} 41 42 private: 43 NO_COPY_SEMANTIC(JSPtHooks); 44 NO_MOVE_SEMANTIC(JSPtHooks); 45 46 DebuggerImpl *debugger_ {nullptr}; 47 bool firstTime_ {true}; 48 }; 49 } // namespace panda::ecmascript::tooling 50 #endif // ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H