Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 1 | /* |
| 2 | * Copyright (C) 2016 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 | #ifndef _LIBUNWINDSTACK_TESTS_REGS_FAKE_H |
| 18 | #define _LIBUNWINDSTACK_TESTS_REGS_FAKE_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | #include "Regs.h" |
| 23 | |
| 24 | template <typename TypeParam> |
Christopher Ferris | 7b8e467 | 2017-06-01 17:55:25 -0700 | [diff] [blame] | 25 | class RegsFake : public RegsImpl<TypeParam> { |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 26 | public: |
| 27 | RegsFake(uint16_t total_regs, uint16_t sp_reg) |
Christopher Ferris | 7b8e467 | 2017-06-01 17:55:25 -0700 | [diff] [blame] | 28 | : RegsImpl<TypeParam>(total_regs, sp_reg, Regs::Location(Regs::LOCATION_UNKNOWN, 0)) {} |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 29 | virtual ~RegsFake() = default; |
| 30 | |
| 31 | uint64_t GetRelPc(Elf*, const MapInfo*) override { return 0; } |
| 32 | uint64_t GetAdjustedPc(uint64_t, Elf*) override { return 0; } |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame^] | 33 | void SetFromRaw() override {} |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 34 | bool GetReturnAddressFromDefault(Memory*, uint64_t*) { return false; } |
| 35 | }; |
| 36 | |
| 37 | #endif // _LIBUNWINDSTACK_TESTS_REGS_FAKE_H |