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

Method getSymbolIndex

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

Source from the content-addressed store, hash-verified

542}
543
544int ElfView::getSymbolIndex(const char *symbol) const {
545 if (symbol == nullptr) {
546 return {};
547 }
548 ElfInfo info = {};
549 if (getElfInfo(info) != mPointerSize) {
550 return -1;
551 }
552 if (mPointerSize == 4) {
553 // ELF32
554 const Elf32_Sym *sym = nullptr;
555 uint32_t symidx = 0;
556 if (findSymByName32(info, symbol, &sym, &symidx)) {
557 return int(symidx);
558 } else {
559 return -1;
560 }
561 } else if (mPointerSize == 8) {
562 // ELF64
563 const Elf64_Sym *sym = nullptr;
564 uint32_t symidx = 0;
565 if (findSymByName64(info, symbol, &sym, &symidx)) {
566 return int(symidx);
567 } else {
568 return -1;
569 }
570 } else {
571 return -1;
572 }
573}
574
575int ElfView::getSymbolAddress(const char *symbol) const {
576 ElfInfo elfInfo = {};

Callers

nothing calls this directly

Calls 2

findSymByName32Function · 0.85
findSymByName64Function · 0.85

Tested by

no test coverage detected