MCPcopy Create free account
hub / github.com/cinit/TMoe / getSymbolAddress

Method getSymbolAddress

app/src/main/cpp/utils/elfsym/ElfView.cpp:575–593  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

573}
574
575int ElfView::getSymbolAddress(const char *symbol) const {
576 ElfInfo elfInfo = {};
577 if (getElfInfo(elfInfo) < 0) {
578 return 0;
579 }
580 int index = getSymbolIndex(symbol);
581 if (index < 0) {
582 return 0;
583 }
584 if (getPointerSize() == 8) {
585 const auto *sym = static_cast<const Elf64_Sym *>(elfInfo.symtab);
586 return int(sym[index].st_value);
587 } else if (getPointerSize() == 4) {
588 const auto *sym = static_cast<const Elf32_Sym *>(elfInfo.symtab);
589 return int(sym[index].st_value);
590 } else {
591 return 0;
592 }
593}
594

Callers 1

lookupFileLogLogsEnabledFunction · 0.80

Calls

no outgoing calls

Tested by

no test coverage detected