LLDB mainline
SBSymbol.h
Go to the documentation of this file.
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"
15#include "lldb/API/SBTarget.h"
16
17namespace lldb {
18
20public:
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 const char *GetBaseName() const;
40
42
44 const char *flavor_string);
45
46 /// Get the start address of this symbol
47 ///
48 /// \returns
49 /// If the symbol's value is not an address, an invalid SBAddress object
50 /// will be returned. If the symbol's value is an address, a valid SBAddress
51 /// object will be returned.
53
54 /// Get the end address of this symbol
55 ///
56 /// \returns
57 /// If the symbol's value is not an address, an invalid SBAddress object
58 /// will be returned. If the symbol's value is an address, a valid SBAddress
59 /// object will be returned.
61
62 /// Get the raw value of a symbol.
63 ///
64 /// This accessor allows direct access to the symbol's value from the symbol
65 /// table regardless of what the value is. The value can be a file address or
66 /// it can be an integer value that depends on what the symbol's type is. Some
67 /// symbol values are not addresses, but absolute values or integer values
68 /// that can be mean different things. The GetStartAddress() accessor will
69 /// only return a valid SBAddress if the symbol's value is an address, so this
70 /// accessor provides a way to access the symbol's value when the value is
71 /// not an address.
72 ///
73 /// \returns
74 /// Returns the raw integer value of a symbol from the symbol table.
75 uint64_t GetValue();
76
77 /// Get the size of the symbol.
78 ///
79 /// This accessor allows direct access to the symbol's size from the symbol
80 /// table regardless of what the value is (address or integer value).
81 ///
82 /// \returns
83 /// Returns the size of a symbol from the symbol table.
84 uint64_t GetSize();
85
86 uint32_t GetPrologueByteSize();
87
89
90 /// Get the ID of this symbol, usually the original symbol table index.
91 ///
92 /// \returns
93 /// Returns the ID of this symbol.
94 uint32_t GetID();
95
96 bool operator==(const lldb::SBSymbol &rhs) const;
97
98 bool operator!=(const lldb::SBSymbol &rhs) const;
99
100 bool GetDescription(lldb::SBStream &description);
101
102 // Returns true if the symbol is externally visible in the module that it is
103 // defined in
104 bool IsExternal();
105
106 // Returns true if the symbol was synthetically generated from something
107 // other than the actual symbol table itself in the object file.
108 bool IsSynthetic();
109
110 /// Returns true if the symbol is a debug symbol.
111 bool IsDebug();
112
113 /// Get the string representation of a symbol type.
114 static const char *GetTypeAsString(lldb::SymbolType symbol_type);
115
116 /// Get the symbol type from a string representation.
117 static lldb::SymbolType GetTypeFromString(const char *str);
118
119protected:
121
123
124private:
125 friend class SBAddress;
126 friend class SBFrame;
127 friend class SBModule;
128 friend class SBSymbolContext;
129
130 SBSymbol(lldb_private::Symbol *lldb_object_ptr);
131
132 void SetSymbol(lldb_private::Symbol *lldb_object_ptr);
133
135};
136
137} // namespace lldb
138
139#endif // LLDB_API_SBSYMBOL_H
#define LLDB_API
Definition SBDefines.h:28
static llvm::StringRef GetName(XcodeSDK::Type type)
Definition XcodeSDK.cpp:21
const char * GetBaseName() const
Definition SBSymbol.cpp:82
uint64_t GetValue()
Get the raw value of a symbol.
Definition SBSymbol.cpp:175
SymbolType GetType()
Definition SBSymbol.cpp:197
const char * GetDisplayName() const
Definition SBSymbol.cpp:63
const char * GetMangledName() const
Definition SBSymbol.cpp:73
static lldb::SymbolType GetTypeFromString(const char *str)
Get the symbol type from a string representation.
Definition SBSymbol.cpp:243
uint32_t GetPrologueByteSize()
Definition SBSymbol.cpp:189
bool IsSynthetic()
Definition SBSymbol.cpp:221
void reset(lldb_private::Symbol *)
Definition SBSymbol.cpp:149
friend class SBModule
Definition SBSymbol.h:127
bool GetDescription(lldb::SBStream &description)
Definition SBSymbol.cpp:103
friend class SBSymbolContext
Definition SBSymbol.h:128
SBAddress GetStartAddress()
Get the start address of this symbol.
Definition SBSymbol.cpp:151
friend class SBAddress
Definition SBSymbol.h:125
SBAddress GetEndAddress()
Get the end address of this symbol.
Definition SBSymbol.cpp:161
bool operator==(const lldb::SBSymbol &rhs) const
Definition SBSymbol.cpp:91
lldb_private::Symbol * m_opaque_ptr
Definition SBSymbol.h:134
bool IsDebug()
Returns true if the symbol is a debug symbol.
Definition SBSymbol.cpp:229
bool IsValid() const
Definition SBSymbol.cpp:43
const lldb::SBSymbol & operator=(const lldb::SBSymbol &rhs)
Definition SBSymbol.cpp:30
uint64_t GetSize()
Get the size of the symbol.
Definition SBSymbol.cpp:182
friend class SBFrame
Definition SBSymbol.h:126
static const char * GetTypeAsString(lldb::SymbolType symbol_type)
Get the string representation of a symbol type.
Definition SBSymbol.cpp:237
void SetSymbol(lldb_private::Symbol *lldb_object_ptr)
Definition SBSymbol.cpp:39
lldb::SBInstructionList GetInstructions(lldb::SBTarget target)
Definition SBSymbol.cpp:116
bool IsExternal()
Definition SBSymbol.cpp:213
bool operator!=(const lldb::SBSymbol &rhs) const
Definition SBSymbol.cpp:97
lldb_private::Symbol * get()
Definition SBSymbol.cpp:147
uint32_t GetID()
Get the ID of this symbol, usually the original symbol table index.
Definition SBSymbol.cpp:205
SymbolType
Symbol types.