1 //===-- ABIMacOSX_arm64.h ---------------------------------------*- C++ -*-===//
3 // The LLVM Compiler Infrastructure
5 // This file is distributed under the University of Illinois Open Source
6 // License. See LICENSE.TXT for details.
8 //===----------------------------------------------------------------------===//
10 #ifndef liblldb_ABIMacOSX_arm64_h_
11 #define liblldb_ABIMacOSX_arm64_h_
15 // Other libraries and framework includes
17 #include "lldb/lldb-private.h"
18 #include "lldb/Core/ConstString.h"
19 #include "lldb/Target/ABI.h"
21 class ABIMacOSX_arm64 :
22 public lldb_private::ABI
25 ~ABIMacOSX_arm64() override = default;
28 GetRedZoneSize() const override;
31 PrepareTrivialCall(lldb_private::Thread &thread,
33 lldb::addr_t functionAddress,
34 lldb::addr_t returnAddress,
35 llvm::ArrayRef<lldb::addr_t> args) const override;
38 GetArgumentValues(lldb_private::Thread &thread,
39 lldb_private::ValueList &values) const override;
42 CreateFunctionEntryUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
45 CreateDefaultUnwindPlan(lldb_private::UnwindPlan &unwind_plan) override;
48 RegisterIsVolatile(const lldb_private::RegisterInfo *reg_info) override;
50 // The arm64 ABI requires that stack frames be 16 byte aligned.
51 // When there is a trap handler on the stack, e.g. _sigtramp in userland
52 // code, we've seen that the stack pointer is often not aligned properly
53 // before the handler is invoked. This means that lldb will stop the unwind
54 // early -- before the function which caused the trap.
56 // To work around this, we relax that alignment to be just word-size (8-bytes).
57 // Whitelisting the trap handlers for user space would be easy (_sigtramp) but
58 // in other environments there can be a large number of different functions
59 // involved in async traps.
61 CallFrameAddressIsValid(lldb::addr_t cfa) override
63 // Make sure the stack call frame addresses are are 8 byte aligned
64 if (cfa & (8ull - 1ull))
65 return false; // Not 8 byte aligned
67 return false; // Zero is not a valid stack address
72 CodeAddressIsValid(lldb::addr_t pc) override
74 if (pc & (4ull - 1ull))
75 return false; // Not 4 byte aligned
77 // Anything else if fair game..
81 const lldb_private::RegisterInfo *
82 GetRegisterInfoArray(uint32_t &count) override;
84 //------------------------------------------------------------------
86 //------------------------------------------------------------------
95 CreateInstance (const lldb_private::ArchSpec &arch);
97 //------------------------------------------------------------------
98 // PluginInterface protocol
99 //------------------------------------------------------------------
101 static lldb_private::ConstString
102 GetPluginNameStatic();
104 lldb_private::ConstString
105 GetPluginName() override
107 return GetPluginNameStatic();
111 GetPluginVersion() override;
114 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) override;
118 GetReturnValueObjectImpl (lldb_private::Thread &thread,
119 lldb_private::CompilerType &ast_type) const override;
125 // Call CreateInstance instead.
129 #endif // liblldb_ABIMacOSX_arm64_h_