1 | //===-- RegisterContextMinidump_ARM64.h -------------------------*- C++ -*-===// |
2 | // |
3 | // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. |
4 | // See https://llvm.org/LICENSE.txt for license information. |
5 | // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception |
6 | // |
7 | //===----------------------------------------------------------------------===// |
8 | |
9 | #ifndef LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_ARM64_H |
10 | #define LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_ARM64_H |
11 | |
12 | #include "MinidumpTypes.h" |
13 | |
14 | #include "Plugins/Process/Utility/RegisterInfoInterface.h" |
15 | #include "lldb/Target/RegisterContext.h" |
16 | |
17 | #include "llvm/ADT/ArrayRef.h" |
18 | #include "llvm/ADT/BitmaskEnum.h" |
19 | |
20 | // C includes |
21 | // C++ includes |
22 | |
23 | namespace lldb_private { |
24 | |
25 | namespace minidump { |
26 | |
27 | LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE(); |
28 | |
29 | class RegisterContextMinidump_ARM64 : public lldb_private::RegisterContext { |
30 | public: |
31 | (lldb_private::Thread &thread, |
32 | const DataExtractor &data); |
33 | |
34 | ~RegisterContextMinidump_ARM64() override = default; |
35 | |
36 | void InvalidateAllRegisters() override { |
37 | // Do nothing... registers are always valid... |
38 | } |
39 | |
40 | size_t GetRegisterCount() override; |
41 | |
42 | const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override; |
43 | |
44 | size_t GetRegisterSetCount() override; |
45 | |
46 | const lldb_private::RegisterSet *GetRegisterSet(size_t set) override; |
47 | |
48 | const char *GetRegisterName(unsigned reg); |
49 | |
50 | bool ReadRegister(const RegisterInfo *reg_info, |
51 | RegisterValue ®_value) override; |
52 | |
53 | bool WriteRegister(const RegisterInfo *reg_info, |
54 | const RegisterValue ®_value) override; |
55 | |
56 | uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind, |
57 | uint32_t num) override; |
58 | |
59 | // Reference: see breakpad/crashpad source |
60 | struct Context { |
61 | uint64_t context_flags; |
62 | uint64_t x[32]; |
63 | uint64_t pc; |
64 | uint32_t cpsr; |
65 | uint32_t fpsr; |
66 | uint32_t fpcr; |
67 | uint8_t v[32 * 16]; // 32 128-bit floating point registers |
68 | }; |
69 | |
70 | enum class Flags : uint32_t { |
71 | ARM64_Flag = 0x80000000, |
72 | Integer = ARM64_Flag | 0x00000002, |
73 | FloatingPoint = ARM64_Flag | 0x00000004, |
74 | LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ FloatingPoint) |
75 | }; |
76 | |
77 | protected: |
78 | Context m_regs; |
79 | }; |
80 | |
81 | } // end namespace minidump |
82 | } // end namespace lldb_private |
83 | #endif // LLDB_SOURCE_PLUGINS_PROCESS_MINIDUMP_REGISTERCONTEXTMINIDUMP_ARM64_H |
84 | |