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 | |
Christopher Ferris | d226a51 | 2017-07-14 10:37:19 -0700 | [diff] [blame] | 22 | #include <unwindstack/Memory.h> |
| 23 | #include <unwindstack/Regs.h> |
| 24 | |
| 25 | namespace unwindstack { |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 26 | |
| 27 | template <typename TypeParam> |
Christopher Ferris | 7b8e467 | 2017-06-01 17:55:25 -0700 | [diff] [blame] | 28 | class RegsFake : public RegsImpl<TypeParam> { |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 29 | public: |
| 30 | RegsFake(uint16_t total_regs, uint16_t sp_reg) |
Christopher Ferris | 7b8e467 | 2017-06-01 17:55:25 -0700 | [diff] [blame] | 31 | : RegsImpl<TypeParam>(total_regs, sp_reg, Regs::Location(Regs::LOCATION_UNKNOWN, 0)) {} |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 32 | virtual ~RegsFake() = default; |
| 33 | |
Josh Gao | 0953ecd | 2017-08-25 13:55:06 -0700 | [diff] [blame] | 34 | uint32_t MachineType() override { return 0; } |
| 35 | |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 36 | uint64_t GetAdjustedPc(uint64_t, Elf*) override { return 0; } |
Christopher Ferris | 2a25c4a | 2017-07-07 16:35:48 -0700 | [diff] [blame] | 37 | void SetFromRaw() override {} |
Christopher Ferris | b9de87f | 2017-09-20 13:37:24 -0700 | [diff] [blame^] | 38 | bool SetPcFromReturnAddress(Memory*) override { return false; } |
Christopher Ferris | eb4a6db | 2017-07-19 12:37:45 -0700 | [diff] [blame] | 39 | bool StepIfSignalHandler(uint64_t, Elf*, Memory*) override { return false; } |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 40 | bool GetReturnAddressFromDefault(Memory*, uint64_t*) { return false; } |
| 41 | }; |
| 42 | |
Christopher Ferris | d226a51 | 2017-07-14 10:37:19 -0700 | [diff] [blame] | 43 | } // namespace unwindstack |
| 44 | |
Christopher Ferris | 53a3c9b | 2017-05-10 18:34:15 -0700 | [diff] [blame] | 45 | #endif // _LIBUNWINDSTACK_TESTS_REGS_FAKE_H |