| 542 | } |
| 543 | |
| 544 | int 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 | |
| 575 | int ElfView::getSymbolAddress(const char *symbol) const { |
| 576 | ElfInfo elfInfo = {}; |
nothing calls this directly
no test coverage detected