]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h
Merge llvm, clang, compiler-rt, libc++, libunwind, lld, lldb and openmp
[FreeBSD/FreeBSD.git] / contrib / llvm-project / lldb / source / Plugins / Process / minidump / RegisterContextMinidump_ARM.h
1 //===-- RegisterContextMinidump_ARM.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 liblldb_RegisterContextMinidump_ARM_h_
10 #define liblldb_RegisterContextMinidump_ARM_h_
11
12 #include "MinidumpTypes.h"
13
14 #include "Plugins/Process/Utility/RegisterInfoInterface.h"
15
16 #include "lldb/Target/RegisterContext.h"
17
18 #include "llvm/ADT/ArrayRef.h"
19 #include "llvm/ADT/BitmaskEnum.h"
20
21 // C includes
22 // C++ includes
23
24 namespace lldb_private {
25
26 namespace minidump {
27
28 LLVM_ENABLE_BITMASK_ENUMS_IN_NAMESPACE();
29
30 class RegisterContextMinidump_ARM : public lldb_private::RegisterContext {
31 public:
32   RegisterContextMinidump_ARM(lldb_private::Thread &thread,
33                               const DataExtractor &data, bool apple);
34
35   ~RegisterContextMinidump_ARM() override = default;
36
37   void InvalidateAllRegisters() override {
38     // Do nothing... registers are always valid...
39   }
40
41   // Used for unit testing.
42   static size_t GetRegisterCountStatic();
43   // Used for unit testing.
44   static const lldb_private::RegisterInfo *
45   GetRegisterInfoAtIndexStatic(size_t reg, bool apple);
46
47   size_t GetRegisterCount() override;
48
49   const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
50
51   size_t GetRegisterSetCount() override;
52
53   const lldb_private::RegisterSet *GetRegisterSet(size_t set) override;
54
55   const char *GetRegisterName(unsigned reg);
56
57   bool ReadRegister(const RegisterInfo *reg_info,
58                     RegisterValue &reg_value) override;
59
60   bool WriteRegister(const RegisterInfo *reg_info,
61                      const RegisterValue &reg_value) override;
62
63   uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
64                                                uint32_t num) override;
65
66   // Reference: see breakpad/crashpad source
67   struct QRegValue {
68     uint64_t lo;
69     uint64_t hi;
70   };
71
72   struct Context {
73     uint32_t context_flags;
74     uint32_t r[16];
75     uint32_t cpsr;
76     uint64_t fpscr;
77     union {
78       uint64_t d[32];
79       uint32_t s[32];
80       QRegValue q[16];
81     };
82     uint32_t extra[8];
83   };
84
85 protected:
86   enum class Flags : uint32_t {
87     ARM_Flag = 0x40000000,
88     Integer = ARM_Flag | 0x00000002,
89     FloatingPoint = ARM_Flag | 0x00000004,
90     LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ FloatingPoint)
91   };
92   Context m_regs;
93   const bool m_apple; // True if this is an Apple ARM where FP is R7
94 };
95
96 } // end namespace minidump
97 } // end namespace lldb_private
98 #endif // liblldb_RegisterContextMinidump_ARM_h_