retdec
macho_symbol.h
Go to the documentation of this file.
1 
7 #ifndef RETDEC_FILEFORMAT_TYPES_SYMBOL_TABLE_MACHO_SYMBOL_H
8 #define RETDEC_FILEFORMAT_TYPES_SYMBOL_TABLE_MACHO_SYMBOL_H
9 
10 #include <string>
11 
12 #include <llvm/Object/MachO.h>
13 
17 
18 namespace retdec {
19 namespace fileformat {
20 
25 {
26  private:
27  // Converted
28  std::string name;
29  std::string altName;
30  unsigned long long value;
31  // Raw values
32  std::int16_t description;
33  std::uint8_t section;
34  std::uint8_t type;
35  // Additional values
36  unsigned index;
37  bool isFunction = false;
38 
43  template<typename T> void setValues(const T &nList, const llvm::StringRef &strTable, unsigned index);
45  public:
48  void makeFunction(FileFormat *fileParser);
49  void setAllValues(const llvm::MachO::nlist &nList, const llvm::StringRef &strTable, unsigned index);
50  void setAllValues(const llvm::MachO::nlist_64 &nList, const llvm::StringRef &strTable, unsigned index);
52 
55  std::unique_ptr<Import> getAsImport() const;
56  Export getAsExport() const;
57  std::shared_ptr<Symbol> getAsSymbol() const;
59 };
60 
61 } // namespace fileformat
62 } // namespace retdec
63 
64 #endif
Definition: export.h:19
Definition: file_format.h:45
Definition: macho_symbol.h:25
Export getAsExport() const
Definition: macho_symbol.cpp:175
Symbol::UsageType getSymbolUsageType() const
Definition: macho_symbol.cpp:89
void setValues(const T &nList, const llvm::StringRef &strTable, unsigned index)
Definition: macho_symbol.cpp:105
void setAllValues(const llvm::MachO::nlist &nList, const llvm::StringRef &strTable, unsigned index)
Definition: macho_symbol.cpp:142
std::unique_ptr< Import > getAsImport() const
Definition: macho_symbol.cpp:162
std::int16_t description
Symbol description and library ordinal.
Definition: macho_symbol.h:32
bool isFunction
true if symbol is function false otherwise
Definition: macho_symbol.h:37
std::string name
Symbol name.
Definition: macho_symbol.h:28
unsigned long long value
Symbol value - various interpetation.
Definition: macho_symbol.h:30
std::string altName
Alternative name for weak symbols.
Definition: macho_symbol.h:29
void makeFunction(FileFormat *fileParser)
Definition: macho_symbol.cpp:21
Symbol::Type getSymbolType() const
Definition: macho_symbol.cpp:45
std::uint8_t type
Type of symbol.
Definition: macho_symbol.h:34
std::uint8_t section
Section index.
Definition: macho_symbol.h:33
std::shared_ptr< Symbol > getAsSymbol() const
Definition: macho_symbol.cpp:195
unsigned index
Index of symbol.
Definition: macho_symbol.h:36
Type
Definition: symbol.h:22
UsageType
Definition: symbol.h:33
Class for one export.
Class for one import.
Class for one symbol.
Definition: archive_wrapper.h:19