1/* 2 * Copyright (c) 2023 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_CLIENT_MANAGER_STACK_MANAGER_H 17#define ECMASCRIPT_TOOLING_CLIENT_MANAGER_STACK_MANAGER_H 18 19#include <map> 20#include <variant> 21 22#include "common/log_wrapper.h" 23#include "tooling/base/pt_json.h" 24#include "tooling/base/pt_types.h" 25 26using PtJson = panda::ecmascript::tooling::PtJson; 27using Result = panda::ecmascript::tooling::Result; 28using CallFrame = panda::ecmascript::tooling::CallFrame; 29using Scope = panda::ecmascript::tooling::Scope; 30namespace OHOS::ArkCompiler::Toolchain { 31class StackManager final { 32public: 33 StackManager(int32_t sessionId) : sessionId_(sessionId) {} 34 35 std::map<int32_t, std::map<int32_t, std::string>> GetScopeChainInfo(); 36 void SetCallFrames(std::map<int32_t, std::unique_ptr<CallFrame>> callFrames); 37 void ClearCallFrame(); 38 void ShowCallFrames(); 39 void PrintScopeChainInfo(const std::map<int32_t, std::map<int32_t, std::string>>& scopeInfos); 40 41private: 42 [[maybe_unused]] int32_t sessionId_; 43 std::map<int32_t, std::unique_ptr<CallFrame>> callFrames_ {}; 44 StackManager(const StackManager&) = delete; 45 StackManager& operator=(const StackManager&) = delete; 46}; 47} // OHOS::ArkCompiler::Toolchain 48#endif