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