• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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 "libpandabase/macros.h"
20 #include "ecmascript/tooling/backend/js_pt_extractor.h"
21 #include "ecmascript/tooling/base/pt_events.h"
22 #include "ecmascript/tooling/base/pt_script.h"
23 #include "ecmascript/tooling/backend/js_debugger_interface.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) override;
35     void Exception(const JSPtLocation &location) override;
36     bool SingleStep(const JSPtLocation &location) override;
37     void PendingJobEntry() override;
VmStart()38     void VmStart() override {}
VmDeath()39     void VmDeath() override {}
40 
41 private:
42     NO_COPY_SEMANTIC(JSPtHooks);
43     NO_MOVE_SEMANTIC(JSPtHooks);
44 
45     DebuggerImpl *debugger_ {nullptr};
46     bool firstTime_ {true};
47 };
48 }  // namespace panda::ecmascript::tooling
49 #endif  // ECMASCRIPT_TOOLING_BACKEND_JS_PT_HOOKS_H