]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/blob - contrib/llvm-project/lldb/source/Plugins/Process/minidump/RegisterContextMinidump_ARM.h
MFC r355940:
[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   size_t GetRegisterCount() override;
42
43   const lldb_private::RegisterInfo *GetRegisterInfoAtIndex(size_t reg) override;
44
45   size_t GetRegisterSetCount() override;
46
47   const lldb_private::RegisterSet *GetRegisterSet(size_t set) override;
48
49   const char *GetRegisterName(unsigned reg);
50
51   bool ReadRegister(const RegisterInfo *reg_info,
52                     RegisterValue &reg_value) override;
53
54   bool WriteRegister(const RegisterInfo *reg_info,
55                      const RegisterValue &reg_value) override;
56
57   uint32_t ConvertRegisterKindToRegisterNumber(lldb::RegisterKind kind,
58                                                uint32_t num) override;
59
60   // Reference: see breakpad/crashpad source
61   struct QRegValue {
62     uint64_t lo;
63     uint64_t hi;
64   };
65
66   struct Context {
67     uint32_t context_flags;
68     uint32_t r[16];
69     uint32_t cpsr;
70     uint64_t fpscr;
71     union {
72       uint64_t d[32];
73       uint32_t s[32];
74       QRegValue q[16];
75     };
76     uint32_t extra[8];
77   };
78
79 protected:
80   enum class Flags : uint32_t {
81     ARM_Flag = 0x40000000,
82     Integer = ARM_Flag | 0x00000002,
83     FloatingPoint = ARM_Flag | 0x00000004,
84     LLVM_MARK_AS_BITMASK_ENUM(/* LargestValue = */ FloatingPoint)
85   };
86   Context m_regs;
87   const bool m_apple; // True if this is an Apple ARM where FP is R7
88 };
89
90 } // end namespace minidump
91 } // end namespace lldb_private
92 #endif // liblldb_RegisterContextMinidump_ARM_h_