|
|
|||
File indexing completed on 2026-05-10 08:42:44
0001 //===-- Architecture.h ------------------------------------------*- C++ -*-===// 0002 // 0003 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 0004 // See https://llvm.org/LICENSE.txt for license information. 0005 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 0006 // 0007 //===----------------------------------------------------------------------===// 0008 0009 #ifndef LLDB_CORE_ARCHITECTURE_H 0010 #define LLDB_CORE_ARCHITECTURE_H 0011 0012 #include "lldb/Core/PluginInterface.h" 0013 #include "lldb/Target/DynamicRegisterInfo.h" 0014 #include "lldb/Target/MemoryTagManager.h" 0015 0016 namespace lldb_private { 0017 0018 class Architecture : public PluginInterface { 0019 public: 0020 /// This is currently intended to handle cases where a 0021 /// program stops at an instruction that won't get executed and it 0022 /// allows the stop reason, like "breakpoint hit", to be replaced 0023 /// with a different stop reason like "no stop reason". 0024 /// 0025 /// This is specifically used for ARM in Thumb code when we stop in 0026 /// an IT instruction (if/then/else) where the instruction won't get 0027 /// executed and therefore it wouldn't be correct to show the program 0028 /// stopped at the current PC. The code is generic and applies to all 0029 /// ARM CPUs. 0030 virtual void OverrideStopInfo(Thread &thread) const = 0; 0031 0032 /// This method is used to get the number of bytes that should be 0033 /// skipped, from function start address, to reach the first 0034 /// instruction after the prologue. If overrode, it must return 0035 /// non-zero only if the current address matches one of the known 0036 /// function entry points. 0037 /// 0038 /// This method is called only if the standard platform-independent 0039 /// code fails to get the number of bytes to skip, giving the plugin 0040 /// a chance to try to find the missing info. 0041 /// 0042 /// This is specifically used for PPC64, where functions may have 0043 /// more than one entry point, global and local, so both should 0044 /// be compared with current address, in order to find out the 0045 /// number of bytes that should be skipped, in case we are stopped 0046 /// at either function entry point. 0047 virtual size_t GetBytesToSkip(Symbol &func, const Address &curr_addr) const { 0048 return 0; 0049 } 0050 0051 /// Adjust function breakpoint address, if needed. In some cases, 0052 /// the function start address is not the right place to set the 0053 /// breakpoint, specially in functions with multiple entry points. 0054 /// 0055 /// This is specifically used for PPC64, for functions that have 0056 /// both a global and a local entry point. In this case, the 0057 /// breakpoint is adjusted to the first function address reached 0058 /// by both entry points. 0059 virtual void AdjustBreakpointAddress(const Symbol &func, 0060 Address &addr) const {} 0061 0062 0063 /// Get \a load_addr as a callable code load address for this target 0064 /// 0065 /// Take \a load_addr and potentially add any address bits that are 0066 /// needed to make the address callable. For ARM this can set bit 0067 /// zero (if it already isn't) if \a load_addr is a thumb function. 0068 /// If \a addr_class is set to AddressClass::eInvalid, then the address 0069 /// adjustment will always happen. If it is set to an address class 0070 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be 0071 /// returned. 0072 virtual lldb::addr_t GetCallableLoadAddress( 0073 lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { 0074 return addr; 0075 } 0076 0077 /// Get \a load_addr as an opcode for this target. 0078 /// 0079 /// Take \a load_addr and potentially strip any address bits that are 0080 /// needed to make the address point to an opcode. For ARM this can 0081 /// clear bit zero (if it already isn't) if \a load_addr is a 0082 /// thumb function and load_addr is in code. 0083 /// If \a addr_class is set to AddressClass::eInvalid, then the address 0084 /// adjustment will always happen. If it is set to an address class 0085 /// that doesn't have code in it, LLDB_INVALID_ADDRESS will be 0086 /// returned. 0087 0088 virtual lldb::addr_t GetOpcodeLoadAddress( 0089 lldb::addr_t addr, AddressClass addr_class = AddressClass::eInvalid) const { 0090 return addr; 0091 } 0092 0093 // Get load_addr as breakable load address for this target. Take a addr and 0094 // check if for any reason there is a better address than this to put a 0095 // breakpoint on. If there is then return that address. For MIPS, if 0096 // instruction at addr is a delay slot instruction then this method will find 0097 // the address of its previous instruction and return that address. 0098 virtual lldb::addr_t GetBreakableLoadAddress(lldb::addr_t addr, 0099 Target &target) const { 0100 return addr; 0101 } 0102 0103 // Returns a pointer to an object that can manage memory tags for this 0104 // Architecture E.g. masking out tags, unpacking tag streams etc. Returns 0105 // nullptr if the architecture does not have a memory tagging extension. 0106 // 0107 // The return pointer being valid does not mean that the current process has 0108 // memory tagging enabled, just that a tagging technology exists for this 0109 // architecture. 0110 virtual const MemoryTagManager *GetMemoryTagManager() const { 0111 return nullptr; 0112 } 0113 0114 // This returns true if a write to the named register should cause lldb to 0115 // reconfigure its register information. For example on AArch64 writing to vg 0116 // to change the vector length means lldb has to change the size of registers. 0117 virtual bool 0118 RegisterWriteCausesReconfigure(const llvm::StringRef name) const { 0119 return false; 0120 } 0121 0122 // Call this after writing a register for which RegisterWriteCausesReconfigure 0123 // returns true. This method will update the layout of registers according to 0124 // the new state e.g. the new length of scalable vector registers. 0125 // Returns true if anything changed, which means existing register values must 0126 // be invalidated. 0127 virtual bool ReconfigureRegisterInfo(DynamicRegisterInfo ®_info, 0128 DataExtractor ®_data, 0129 RegisterContext ®_context) const { 0130 return false; 0131 } 0132 }; 0133 0134 } // namespace lldb_private 0135 0136 #endif // LLDB_CORE_ARCHITECTURE_H
| [ Source navigation ] | [ Diff markup ] | [ Identifier search ] | [ general search ] |
|
This page was automatically generated by the 2.3.7 LXR engine. The LXR team |
|