Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [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_REGS_ARM_H |
| 18 | #define _LIBUNWINDSTACK_REGS_ARM_H |
| 19 | |
| 20 | #include <stdint.h> |
| 21 | |
| 22 | #include <functional> |
| 23 | |
| 24 | #include <unwindstack/Elf.h> |
| 25 | #include <unwindstack/Regs.h> |
| 26 | |
| 27 | namespace unwindstack { |
| 28 | |
| 29 | // Forward declarations. |
| 30 | class Memory; |
| 31 | |
| 32 | class RegsArm : public RegsImpl<uint32_t> { |
| 33 | public: |
| 34 | RegsArm(); |
| 35 | virtual ~RegsArm() = default; |
| 36 | |
Yabin Cui | 414df3e | 2018-03-14 18:16:22 -0700 | [diff] [blame] | 37 | ArchEnum Arch() override final; |
Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 38 | |
Christopher Ferris | a2ec50b | 2018-02-21 15:39:07 -0800 | [diff] [blame] | 39 | uint64_t GetPcAdjustment(uint64_t rel_pc, Elf* elf) override; |
Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 40 | |
Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 41 | bool SetPcFromReturnAddress(Memory* process_memory) override; |
| 42 | |
| 43 | bool StepIfSignalHandler(uint64_t rel_pc, Elf* elf, Memory* process_memory) override; |
| 44 | |
Yabin Cui | 414df3e | 2018-03-14 18:16:22 -0700 | [diff] [blame] | 45 | void IterateRegisters(std::function<void(const char*, uint64_t)>) override final; |
| 46 | |
| 47 | uint64_t pc() override; |
| 48 | uint64_t sp() override; |
| 49 | |
| 50 | void set_pc(uint64_t pc) override; |
| 51 | void set_sp(uint64_t sp) override; |
Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 52 | |
Josh Gao | fe39631 | 2018-04-20 11:51:14 -0700 | [diff] [blame] | 53 | Regs* Clone() override final; |
| 54 | |
Christopher Ferris | d06001d | 2017-11-30 18:56:01 -0800 | [diff] [blame] | 55 | static Regs* Read(void* data); |
| 56 | |
| 57 | static Regs* CreateFromUcontext(void* ucontext); |
| 58 | }; |
| 59 | |
| 60 | } // namespace unwindstack |
| 61 | |
| 62 | #endif // _LIBUNWINDSTACK_REGS_ARM_H |