1 /* 2 * Copyright (c) 2025 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 #ifndef UNWIND_ENTRY_PARSER_FACTORY_H 16 #define UNWIND_ENTRY_PARSER_FACTORY_H 17 18 #include <cinttypes> 19 #include <memory> 20 21 #include "dwarf_entry_parser.h" 22 #include "exidx_entry_parser.h" 23 namespace OHOS { 24 namespace HiviewDFX { 25 class UnwindEntryParserFactory { 26 public: CreateUnwindEntryParser(std::shared_ptr<DfxMemory> memory)27 static std::shared_ptr<UnwindEntryParser> CreateUnwindEntryParser(std::shared_ptr<DfxMemory> memory) 28 { 29 std::shared_ptr<UnwindEntryParser> unwindEntryParser = nullptr; 30 #if defined(__arm__) 31 unwindEntryParser = std::make_shared<ExidxEntryParser>(memory); 32 #else 33 unwindEntryParser = std::make_shared<DwarfEntryParser>(memory); 34 #endif 35 return unwindEntryParser; 36 } 37 }; 38 } // nameapace HiviewDFX 39 } // nameapace OHOS 40 #endif 41