1 /* 2 * Copyright (C) 2021 The Android Open Source Project 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"); 5 * you may not use this file except in compliance with the License. 6 * You may obtain a copy of the License at 7 * 8 * http://www.apache.org/licenses/LICENSE-2.0 9 * 10 * Unless required by applicable law or agreed to in writing, software 11 * distributed under the License is distributed on an "AS IS" BASIS, 12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13 * See the License for the specific language governing permissions and 14 * limitations under the License. 15 */ 16 17 #pragma once 18 19 #include <memory> 20 21 #include <unwindstack/DwarfSection.h> 22 #include <unwindstack/ElfInterface.h> 23 #include <unwindstack/Memory.h> 24 25 namespace unwindstack { 26 27 template <typename TypeParam> 28 class DwarfSectionImplFake : public DwarfSectionImpl<TypeParam> { 29 public: DwarfSectionImplFake(std::shared_ptr<Memory> & memory)30 DwarfSectionImplFake(std::shared_ptr<Memory>& memory) : DwarfSectionImpl<TypeParam>(memory) {} 31 virtual ~DwarfSectionImplFake() = default; 32 Init(const SectionInfo &)33 bool Init(const SectionInfo&) override { return false; } 34 GetFdes(std::vector<const DwarfFde * > *)35 void GetFdes(std::vector<const DwarfFde*>*) override {} 36 GetFdeFromPc(uint64_t)37 const DwarfFde* GetFdeFromPc(uint64_t) override { return nullptr; } 38 GetCieOffsetFromFde32(uint32_t)39 uint64_t GetCieOffsetFromFde32(uint32_t) { return 0; } 40 GetCieOffsetFromFde64(uint64_t)41 uint64_t GetCieOffsetFromFde64(uint64_t) { return 0; } 42 AdjustPcFromFde(uint64_t)43 uint64_t AdjustPcFromFde(uint64_t) override { return 0; } 44 FakeSetCachedCieLocRegs(uint64_t offset,const DwarfLocations & loc_regs)45 void FakeSetCachedCieLocRegs(uint64_t offset, const DwarfLocations& loc_regs) { 46 this->cie_loc_regs_[offset] = loc_regs; 47 } FakeClearError()48 void FakeClearError() { this->last_error_.code = DWARF_ERROR_NONE; } 49 }; 50 51 } // namespace unwindstack 52