127 ) : _addr(__addr), _kind(__kind), _binding(__binding), _name(__name)
135 std::cout << std::hex << _addr << std::dec
137 <<
" " << _name << std::endl;
174 R->simple_symbols.push_back(
new SimpleSymbol(addr, kind, binding, name));
181 return R->simple_symbols.size();
188 if (R->sorted ==
false) {
190 std::sort (R->simple_symbols.begin(), R->simple_symbols.end(),
compareAddr);
203 for (
int in = 1; in < nsyms; in++) {
204 if (R->simple_symbols[out]->addr() == R->simple_symbols[in]->addr()) {
207 coalesce_cb(R->simple_symbols[out], R->simple_symbols[in]);
209 R->simple_symbols[++out] = R->simple_symbols[in];
213 if (out < nsyms - 1) {
214 R->simple_symbols.erase(R->simple_symbols.begin() + out + 1,
215 R->simple_symbols.begin() + nsyms);
224 for (
auto it = R->simple_symbols.begin();
225 it != R->simple_symbols.end(); ++it) {
234 if (R->simple_symbols.size() <1)
240 int last = R->simple_symbols.size() - 1;
246 if (vma >= R->simple_symbols[last]->addr()) {
247 return R->simple_symbols[
last];
251 int mid = (first + last + 1) >> 1;
252 if (vma >= R->simple_symbols[mid]->addr()) {
257 if (last - first <= 1) {
258 return R->simple_symbols[first];
273 if (symbol) fnName = symbol->
name();
274 return symbol ? true :
false;
int find(char s1[], char s2[])
SimpleSymbol(uint64_t __addr, SimpleSymbolKind __kind, SimpleSymbolBinding __binding, const char *__name)
std::vector< SimpleSymbol * > simple_symbols
void coalesce(SimpleSymbolsCoalesceCallback coalesce)
void setKind(SimpleSymbolKind __kind)
SimpleSymbol * find(uint64_t vma)
static std::string bindingString(SimpleSymbolBinding _binding)
void add(uint64_t addr, SimpleSymbolKind kind, SimpleSymbolBinding binding, const char *name)
void() SimpleSymbolsCoalesceCallback(SimpleSymbol *left, const SimpleSymbol *right)
SimpleSymbolBinding binding() const
const std::string & name() const
SimpleSymbols(const char *name)
void setName(std::string __name)
SimpleSymbolKind kind() const
static bool compareAddr(SimpleSymbol *s1, SimpleSymbol *s2)
static std::string kindString(SimpleSymbolKind _kind)
void setBinding(SimpleSymbolBinding __binding)
bool findEnclosingFunction(uint64_t vma, std::string &fnName)
const std::string & name()
void chooseHighestBinding(SimpleSymbol *left, const SimpleSymbol *right)