xref: /aosp_15_r20/system/unwinding/libunwindstack/include/unwindstack/RegsArm.h (revision eb293b8f56ee8303637c5595cfcdeef8039e85c6)
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 #pragma once
18 
19 #include <stdint.h>
20 
21 #include <functional>
22 
23 #include <unwindstack/Elf.h>
24 #include <unwindstack/Regs.h>
25 
26 namespace unwindstack {
27 
28 // Forward declarations.
29 class Memory;
30 
31 class RegsArm : public RegsImpl<uint32_t> {
32  public:
33   RegsArm();
34   virtual ~RegsArm() = default;
35 
36   ArchEnum Arch() override final;
37 
38   bool SetPcFromReturnAddress(Memory* process_memory) override;
39 
40   bool StepIfSignalHandler(uint64_t elf_offset, Elf* elf, Memory* process_memory) override;
41 
42   void IterateRegisters(std::function<void(const char*, uint64_t)>) override final;
43 
44   uint64_t pc() override;
45   uint64_t sp() override;
46 
47   void set_pc(uint64_t pc) override;
48   void set_sp(uint64_t sp) override;
49 
50   Regs* Clone() override final;
51 
52   static Regs* Read(const void* data);
53 
54   static Regs* CreateFromUcontext(void* ucontext);
55 };
56 
57 }  // namespace unwindstack
58