1 //===-- Symbol.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_Symbol_h_
11 #define liblldb_Symbol_h_
13 #include "lldb/lldb-private.h"
14 #include "lldb/Core/AddressRange.h"
15 #include "lldb/Core/Mangled.h"
16 #include "lldb/Core/UserID.h"
17 #include "lldb/Symbol/SymbolContextScope.h"
19 namespace lldb_private {
22 public SymbolContextScope
25 // ObjectFile readers can classify their symbol table entries and searches can be made
26 // on specific types where the symbol values will have drastically different meanings
27 // and sorting requirements.
30 Symbol (uint32_t symID,
33 lldb::SymbolType type,
38 const lldb::SectionSP §ion_sp,
44 Symbol (uint32_t symID,
47 lldb::SymbolType type,
52 const AddressRange &range,
56 Symbol (const Symbol& rhs);
59 operator= (const Symbol& rhs);
65 Compare (const ConstString& name, lldb::SymbolType type) const;
68 Dump (Stream *s, Target *target, uint32_t index) const;
71 ValueIsAddress() const;
73 //------------------------------------------------------------------
74 // Access the address value. Do NOT hand out the AddressRange as an
75 // object as the byte size of the address range may not be filled in
76 // and it should be accessed via GetByteSize().
77 //------------------------------------------------------------------
81 return m_addr_range.GetBaseAddress();
84 //------------------------------------------------------------------
85 // Access the address value. Do NOT hand out the AddressRange as an
86 // object as the byte size of the address range may not be filled in
87 // and it should be accessed via GetByteSize().
88 //------------------------------------------------------------------
92 return m_addr_range.GetBaseAddress();
98 return m_mangled.GetName();
126 GetReExportedSymbolName() const;
129 GetReExportedSymbolSharedLibrary () const;
132 SetReExportedSymbolName(const ConstString &name);
135 SetReExportedSymbolSharedLibrary (const FileSpec &fspec);
138 ResolveReExportedSymbol (Target &target);
141 GetSiblingIndex () const;
146 return (lldb::SymbolType)m_type;
150 SetType (lldb::SymbolType type)
152 m_type = (lldb::SymbolType)type;
156 GetTypeAsString () const;
165 SetFlags (uint32_t flags)
171 GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
176 return m_is_synthetic;
180 SetIsSynthetic (bool b)
187 GetSizeIsSynthesized() const
189 return m_size_is_synthesized;
193 SetSizeIsSynthesized(bool b)
195 m_size_is_synthesized = b;
213 return m_is_external;
223 IsTrampoline () const;
229 GetByteSizeIsValid () const
231 return m_size_is_valid;
235 GetByteSize () const;
238 SetByteSize (lldb::addr_t size)
240 m_size_is_valid = size > 0;
241 m_addr_range.SetByteSize(size);
245 GetSizeIsSibling () const
247 return m_size_is_sibling;
251 SetSizeIsSibling (bool b)
253 m_size_is_sibling = b;
256 // If m_type is "Code" or "Function" then this will return the prologue size
257 // in bytes, else it will return zero.
259 GetPrologueByteSize ();
262 GetDemangledNameIsSynthesized() const
264 return m_demangled_is_synthesized;
267 SetDemangledNameIsSynthesized(bool b)
269 m_demangled_is_synthesized = b;
272 //------------------------------------------------------------------
273 /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
275 /// @see SymbolContextScope
276 //------------------------------------------------------------------
278 CalculateSymbolContext (SymbolContext *sc);
280 virtual lldb::ModuleSP
281 CalculateSymbolContextModule ();
284 CalculateSymbolContextSymbol ();
286 //------------------------------------------------------------------
287 /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
289 /// @see SymbolContextScope
290 //------------------------------------------------------------------
292 DumpSymbolContext (Stream *s);
295 GetInstructions (const ExecutionContext &exe_ctx,
297 bool prefer_file_cache);
300 GetDisassembly (const ExecutionContext &exe_ctx,
302 bool prefer_file_cache,
307 uint32_t m_uid; // User ID (usually the original symbol table index)
308 uint16_t m_type_data; // data specific to m_type
309 uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated
310 m_is_synthetic:1, // non-zero if this symbol is not actually in the symbol table, but synthesized from other info in the object file.
311 m_is_debug:1, // non-zero if this symbol is debug information in a symbol
312 m_is_external:1, // non-zero if this symbol is globally visible
313 m_size_is_sibling:1, // m_size contains the index of this symbol's sibling
314 m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next
316 m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
318 Mangled m_mangled; // uniqued symbol name/mangled name pair
319 AddressRange m_addr_range; // Contains the value, or the section offset address when the value is an address in a section, and the size (if any)
320 uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
323 } // namespace lldb_private
325 #endif // liblldb_Symbol_h_