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 namespace lldb_private {
24 public PluginInterface
31 GetRedZoneSize () const = 0;
34 PrepareTrivialCall (Thread &thread,
36 lldb::addr_t functionAddress,
37 lldb::addr_t returnAddress,
38 lldb::addr_t *arg1_ptr = NULL,
39 lldb::addr_t *arg2_ptr = NULL,
40 lldb::addr_t *arg3_ptr = NULL,
41 lldb::addr_t *arg4_ptr = NULL,
42 lldb::addr_t *arg5_ptr = NULL,
43 lldb::addr_t *arg6_ptr = NULL) const = 0;
46 GetArgumentValues (Thread &thread,
47 ValueList &values) const = 0;
50 GetReturnValueObject (Thread &thread,
52 bool persistent = true) const;
54 // Set the Return value object in the current frame as though a function with
56 SetReturnValueObject(lldb::StackFrameSP &frame_sp, lldb::ValueObjectSP &new_value) = 0;
59 // This is the method the ABI will call to actually calculate the return value.
60 // Don't put it in a persistant value object, that will be done by the ABI::GetReturnValueObject.
61 virtual lldb::ValueObjectSP
62 GetReturnValueObjectImpl (Thread &thread,
63 ClangASTType &type) const = 0;
66 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0;
69 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0;
72 RegisterIsVolatile (const RegisterInfo *reg_info) = 0;
74 // Should return true if your ABI uses frames when doing stack backtraces. This
75 // means a frame pointer is used that points to the previous stack frame in some
78 StackUsesFrames () = 0;
80 // Should take a look at a call frame address (CFA) which is just the stack
81 // pointer value upon entry to a function. ABIs usually impose alignment
82 // restrictions (4, 8 or 16 byte aligned), and zero is usually not allowed.
83 // This function should return true if "cfa" is valid call frame address for
84 // the ABI, and false otherwise. This is used by the generic stack frame unwinding
85 // code to help determine when a stack ends.
87 CallFrameAddressIsValid (lldb::addr_t cfa) = 0;
89 // Validates a possible PC value and returns true if an opcode can be at "pc".
91 CodeAddressIsValid (lldb::addr_t pc) = 0;
94 FixCodeAddress (lldb::addr_t pc)
96 // Some targets might use bits in a code address to indicate
97 // a mode switch. ARM uses bit zero to signify a code address is
98 // thumb, so any ARM ABI plug-ins would strip those bits.
102 virtual const RegisterInfo *
103 GetRegisterInfoArray (uint32_t &count) = 0;
105 // Some architectures (e.g. x86) will push the return address on the stack and decrement
106 // the stack pointer when making a function call. This means that every stack frame will
107 // have a unique CFA.
108 // Other architectures (e.g. arm) pass the return address in a register so it is possible
109 // to have a frame on a backtrace that does not push anything on the stack or change the
112 FunctionCallsChangeCFA () = 0;
116 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info);
119 GetRegisterInfoByKind (lldb::RegisterKind reg_kind,
124 FindPlugin (const ArchSpec &arch);
127 //------------------------------------------------------------------
128 // Classes that inherit from ABI can see and modify these
129 //------------------------------------------------------------------
132 DISALLOW_COPY_AND_ASSIGN (ABI);
135 } // namespace lldb_private
137 #endif // liblldb_ABI_h_