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 GetSiblingIndex () const;
131 return (lldb::SymbolType)m_type;
135 SetType (lldb::SymbolType type)
137 m_type = (lldb::SymbolType)type;
141 GetTypeAsString () const;
150 SetFlags (uint32_t flags)
156 GetDescription (Stream *s, lldb::DescriptionLevel level, Target *target) const;
161 return m_is_synthetic;
165 SetIsSynthetic (bool b)
172 GetSizeIsSynthesized() const
174 return m_size_is_synthesized;
178 SetSizeIsSynthesized(bool b)
180 m_size_is_synthesized = b;
198 return m_is_external;
208 IsTrampoline () const;
214 GetByteSizeIsValid () const
216 return m_size_is_valid;
220 GetByteSize () const;
223 SetByteSize (lldb::addr_t size)
225 m_size_is_valid = size > 0;
226 m_addr_range.SetByteSize(size);
230 GetSizeIsSibling () const
232 return m_size_is_sibling;
236 SetSizeIsSibling (bool b)
238 m_size_is_sibling = b;
242 // SetValue (Address &value)
244 // m_addr_range.GetBaseAddress() = value;
248 // SetValue (const AddressRange &range)
250 // m_addr_range = range;
254 // SetValue (lldb::addr_t value);
256 // m_addr_range.GetBaseAddress().SetRawAddress(value);
259 // If m_type is "Code" or "Function" then this will return the prologue size
260 // in bytes, else it will return zero.
262 GetPrologueByteSize ();
265 GetDemangledNameIsSynthesized() const
267 return m_demangled_is_synthesized;
270 SetDemangledNameIsSynthesized(bool b)
272 m_demangled_is_synthesized = b;
275 //------------------------------------------------------------------
276 /// @copydoc SymbolContextScope::CalculateSymbolContext(SymbolContext*)
278 /// @see SymbolContextScope
279 //------------------------------------------------------------------
281 CalculateSymbolContext (SymbolContext *sc);
283 virtual lldb::ModuleSP
284 CalculateSymbolContextModule ();
287 CalculateSymbolContextSymbol ();
289 //------------------------------------------------------------------
290 /// @copydoc SymbolContextScope::DumpSymbolContext(Stream*)
292 /// @see SymbolContextScope
293 //------------------------------------------------------------------
295 DumpSymbolContext (Stream *s);
299 uint32_t m_uid; // User ID (usually the original symbol table index)
300 uint16_t m_type_data; // data specific to m_type
301 uint16_t m_type_data_resolved:1, // True if the data in m_type_data has already been calculated
302 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.
303 m_is_debug:1, // non-zero if this symbol is debug information in a symbol
304 m_is_external:1, // non-zero if this symbol is globally visible
305 m_size_is_sibling:1, // m_size contains the index of this symbol's sibling
306 m_size_is_synthesized:1,// non-zero if this symbol's size was calculated using a delta between this symbol and the next
308 m_demangled_is_synthesized:1, // The demangled name was created should not be used for expressions or other lookups
310 Mangled m_mangled; // uniqued symbol name/mangled name pair
311 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)
312 uint32_t m_flags; // A copy of the flags from the original symbol table, the ObjectFile plug-in can interpret these
315 } // namespace lldb_private
317 #endif // liblldb_Symbol_h_