1 //===-- ABI.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_ABI_h_
11 #define liblldb_ABI_h_
15 // Other libraries and framework includes
17 #include "lldb/Core/Error.h"
18 #include "lldb/Core/PluginInterface.h"
19 #include "lldb/lldb-private.h"
21 #include "llvm/ADT/ArrayRef.h"
23 namespace lldb_private {
26 public PluginInterface
33 GetRedZoneSize () const = 0;
36 PrepareTrivialCall (Thread &thread,
38 lldb::addr_t functionAddress,
39 lldb::addr_t returnAddress,
40 llvm::ArrayRef<lldb::addr_t> args) const = 0;
43 GetArgumentValues (Thread &thread,
44 ValueList &values) const = 0;
47 GetReturnValueObject (Thread &thread,
49 bool persistent = true) const;
51 // Set the Return value object in the current frame as though a function with
53 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
56 // This is the method the ABI will call to actually calculate the return value.
57 // Don't put it in a persistant value object, that will be done by the ABI::GetReturnValueObject.
58 virtual lldb::ValueObjectSP
59 GetReturnValueObjectImpl (Thread &thread,
60 ClangASTType &type) const = 0;
63 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
66 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0;
69 RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
71 // Should return true if your ABI uses frames when doing stack backtraces. This
72 // means a frame pointer is used that points to the previous stack frame in some
75 StackUsesFrames () = 0;
77 // Should take a look at a call frame address (CFA) which is just the stack
78 // pointer value upon entry to a function. ABIs usually impose alignment
79 // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
80 // This function should return true if "cfa" is valid call frame address for
81 // the ABI, and false otherwise. This is used by the generic stack frame unwinding
82 // code to help determine when a stack ends.
84 CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
86 // Validates a possible PC value and returns true if an opcode can be at "pc".
88 CodeAddressIsValid (lldb::addr_t pc) = 0;
91 FixCodeAddress (lldb::addr_t pc)
93 // Some targets might use bits in a code address to indicate
94 // a mode switch. ARM uses bit zero to signify a code address is
95 // thumb, so any ARM ABI plug-ins would strip those bits.
99 virtual const RegisterInfo *
100 GetRegisterInfoArray (uint32_t &count) = 0;
102 // Some architectures (e.g. x86) will push the return address on the stack and decrement
103 // the stack pointer when making a function call. This means that every stack frame will
104 // have a unique CFA.
105 // Other architectures (e.g. arm) pass the return address in a register so it is possible
106 // to have a frame on a backtrace that does not push anything on the stack or change the
109 FunctionCallsChangeCFA () = 0;
113 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
116 GetRegisterInfoByKind (lldb::RegisterKind reg_kind,
121 FindPlugin (const ArchSpec &arch);
124 //------------------------------------------------------------------
125 // Classes that inherit from ABI can see and modify these
126 //------------------------------------------------------------------
129 DISALLOW_COPY_AND_ASSIGN (ABI);
132 } // namespace lldb_private
134 #endif // liblldb_ABI_h_