2018-06-19 10:37:27 +00:00
|
|
|
#pragma once
|
|
|
|
#include <string>
|
|
|
|
#include <fnd/List.h>
|
2018-09-06 13:12:15 +00:00
|
|
|
#include <fnd/elf.h>
|
2018-06-19 10:37:27 +00:00
|
|
|
|
|
|
|
class ElfSymbolParser
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
struct sElfSymbol
|
|
|
|
{
|
2018-09-06 13:12:15 +00:00
|
|
|
uint16_t shn_index;
|
|
|
|
byte_t symbol_type;
|
|
|
|
byte_t symbol_binding;
|
2018-06-19 10:37:27 +00:00
|
|
|
std::string name;
|
|
|
|
|
|
|
|
void operator=(const sElfSymbol& other)
|
|
|
|
{
|
|
|
|
shn_index = other.shn_index;
|
|
|
|
symbol_type = other.symbol_type;
|
|
|
|
symbol_binding = other.symbol_binding;
|
|
|
|
name = other.name;
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator==(const sElfSymbol& other) const
|
|
|
|
{
|
|
|
|
return (shn_index == other.shn_index && symbol_type == other.symbol_type && symbol_binding == other.symbol_binding && name == other.name);
|
|
|
|
}
|
|
|
|
|
|
|
|
bool operator!=(const sElfSymbol& other) const
|
|
|
|
{
|
|
|
|
return !(*this == other);
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
ElfSymbolParser();
|
|
|
|
|
2018-06-24 15:01:16 +00:00
|
|
|
void operator=(const ElfSymbolParser& other);
|
2018-06-19 10:37:27 +00:00
|
|
|
bool operator==(const ElfSymbolParser& other) const;
|
|
|
|
bool operator!=(const ElfSymbolParser& other) const;
|
|
|
|
|
|
|
|
void parseData(const byte_t *dyn_sym, size_t dyn_sym_size, const byte_t *dyn_str, size_t dyn_str_size, bool is64Bit);
|
|
|
|
|
|
|
|
const fnd::List<sElfSymbol>& getSymbolList() const;
|
|
|
|
private:
|
2018-09-06 13:12:15 +00:00
|
|
|
const std::string kModuleName = "ElfSymbolParser";
|
2018-06-19 10:37:27 +00:00
|
|
|
|
|
|
|
// data
|
|
|
|
fnd::List<sElfSymbol> mSymbolList;
|
|
|
|
};
|