ABI.h revision 22834bef08349978a701d0c91a71990bbd49033f
1//===-- ABI.h ---------------------------------------------------*- C++ -*-===// 2// 3// The LLVM Compiler Infrastructure 4// 5// This file is distributed under the University of Illinois Open Source 6// License. See LICENSE.TXT for details. 7// 8//===----------------------------------------------------------------------===// 9 10#ifndef liblldb_ABI_h_ 11#define liblldb_ABI_h_ 12 13// C Includes 14// C++ Includes 15// Other libraries and framework includes 16// Project includes 17#include "lldb/Core/PluginInterface.h" 18#include "lldb/lldb-private.h" 19 20namespace lldb_private { 21 22class ABI : 23 public PluginInterface 24{ 25public: 26 virtual 27 ~ABI(); 28 29 virtual size_t 30 GetRedZoneSize () const = 0; 31 32 virtual bool 33 PrepareTrivialCall (Thread &thread, 34 lldb::addr_t sp, 35 lldb::addr_t functionAddress, 36 lldb::addr_t returnAddress, 37 lldb::addr_t *arg1_ptr = NULL, 38 lldb::addr_t *arg2_ptr = NULL, 39 lldb::addr_t *arg3_ptr = NULL, 40 lldb::addr_t *arg4_ptr = NULL, 41 lldb::addr_t *arg5_ptr = NULL, 42 lldb::addr_t *arg6_ptr = NULL) const = 0; 43 44 virtual bool 45 GetArgumentValues (Thread &thread, 46 ValueList &values) const = 0; 47 48public: 49 lldb::ValueObjectSP 50 GetReturnValueObject (Thread &thread, 51 ClangASTType &type, 52 bool persistent = true) const; 53 54protected: 55 // This is the method the ABI will call to actually calculate the return value. 56 // Don't put it in a persistant value object, that will be done by the ABI::GetReturnValueObject. 57 virtual lldb::ValueObjectSP 58 GetReturnValueObjectImpl (Thread &thread, 59 ClangASTType &type) const = 0; 60public: 61 virtual bool 62 CreateFunctionEntryUnwindPlan (UnwindPlan &unwind_plan) = 0; 63 64 virtual bool 65 CreateDefaultUnwindPlan (UnwindPlan &unwind_plan) = 0; 66 67 virtual bool 68 RegisterIsVolatile (const RegisterInfo *reg_info) = 0; 69 70 virtual bool 71 StackUsesFrames () = 0; 72 73 virtual bool 74 CallFrameAddressIsValid (lldb::addr_t cfa) = 0; 75 76 virtual bool 77 CodeAddressIsValid (lldb::addr_t pc) = 0; 78 79 virtual lldb::addr_t 80 FixCodeAddress (lldb::addr_t pc) 81 { 82 // Some targets might use bits in a code address to indicate 83 // a mode switch. ARM uses bit zero to signify a code address is 84 // thumb, so any ARM ABI plug-ins would strip those bits. 85 return pc; 86 } 87 88 virtual const RegisterInfo * 89 GetRegisterInfoArray (uint32_t &count) = 0; 90 91 92 93 bool 94 GetRegisterInfoByName (const ConstString &name, RegisterInfo &info); 95 96 bool 97 GetRegisterInfoByKind (lldb::RegisterKind reg_kind, 98 uint32_t reg_num, 99 RegisterInfo &info); 100 101 static lldb::ABISP 102 FindPlugin (const ArchSpec &arch); 103 104protected: 105 //------------------------------------------------------------------ 106 // Classes that inherit from ABI can see and modify these 107 //------------------------------------------------------------------ 108 ABI(); 109private: 110 DISALLOW_COPY_AND_ASSIGN (ABI); 111}; 112 113} // namespace lldb_private 114 115#endif // liblldb_ABI_h_ 116