1 //===-- SBSymbol.h ----------------------------------------------*- C++ -*-===// 2 // 3 // Part of the LLVM Project, under the Apache License v2.0 with LLVM Exceptions. 4 // See https://llvm.org/LICENSE.txt for license information. 5 // SPDX-License-Identifier: Apache-2.0 WITH LLVM-exception 6 // 7 //===----------------------------------------------------------------------===// 8 9 #ifndef LLDB_API_SBSYMBOL_H 10 #define LLDB_API_SBSYMBOL_H 11 12 #include "lldb/API/SBAddress.h" 13 #include "lldb/API/SBDefines.h" 14 #include "lldb/API/SBInstructionList.h" 15 #include "lldb/API/SBTarget.h" 16 17 namespace lldb { 18 19 class LLDB_API SBSymbol { 20 public: 21 SBSymbol(); 22 23 ~SBSymbol(); 24 25 SBSymbol(const lldb::SBSymbol &rhs); 26 27 const lldb::SBSymbol &operator=(const lldb::SBSymbol &rhs); 28 29 explicit operator bool() const; 30 31 bool IsValid() const; 32 33 const char *GetName() const; 34 35 const char *GetDisplayName() const; 36 37 const char *GetMangledName() const; 38 39 lldb::SBInstructionList GetInstructions(lldb::SBTarget target); 40 41 lldb::SBInstructionList GetInstructions(lldb::SBTarget target, 42 const char *flavor_string); 43 44 /// Get the start address of this symbol 45 /// 46 /// \returns 47 /// If the symbol's value is not an address, an invalid SBAddress object 48 /// will be returned. If the symbol's value is an address, a valid SBAddress 49 /// object will be returned. 50 SBAddress GetStartAddress(); 51 52 /// Get the end address of this symbol 53 /// 54 /// \returns 55 /// If the symbol's value is not an address, an invalid SBAddress object 56 /// will be returned. If the symbol's value is an address, a valid SBAddress 57 /// object will be returned. 58 SBAddress GetEndAddress(); 59 60 /// Get the raw value of a symbol. 61 /// 62 /// This accessor allows direct access to the symbol's value from the symbol 63 /// table regardless of what the value is. The value can be a file address or 64 /// it can be an integer value that depends on what the symbol's type is. Some 65 /// symbol values are not addresses, but absolute values or integer values 66 /// that can be mean different things. The GetStartAddress() accessor will 67 /// only return a valid SBAddress if the symbol's value is an address, so this 68 /// accessor provides a way to access the symbol's value when the value is 69 /// not an address. 70 /// 71 /// \returns 72 /// Returns the raw integer value of a symbol from the symbol table. 73 uint64_t GetValue(); 74 75 /// Get the size of the symbol. 76 /// 77 /// This accessor allows direct access to the symbol's size from the symbol 78 /// table regardless of what the value is (address or integer value). 79 /// 80 /// \returns 81 /// Returns the size of a symbol from the symbol table. 82 uint64_t GetSize(); 83 84 uint32_t GetPrologueByteSize(); 85 86 SymbolType GetType(); 87 88 bool operator==(const lldb::SBSymbol &rhs) const; 89 90 bool operator!=(const lldb::SBSymbol &rhs) const; 91 92 bool GetDescription(lldb::SBStream &description); 93 94 // Returns true if the symbol is externally visible in the module that it is 95 // defined in 96 bool IsExternal(); 97 98 // Returns true if the symbol was synthetically generated from something 99 // other than the actual symbol table itself in the object file. 100 bool IsSynthetic(); 101 102 protected: 103 lldb_private::Symbol *get(); 104 105 void reset(lldb_private::Symbol *); 106 107 private: 108 friend class SBAddress; 109 friend class SBFrame; 110 friend class SBModule; 111 friend class SBSymbolContext; 112 113 SBSymbol(lldb_private::Symbol *lldb_object_ptr); 114 115 void SetSymbol(lldb_private::Symbol *lldb_object_ptr); 116 117 lldb_private::Symbol *m_opaque_ptr = nullptr; 118 }; 119 120 } // namespace lldb 121 122 #endif // LLDB_API_SBSYMBOL_H 123