| 573 | } |
| 574 | |
| 575 | int 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 |
no outgoing calls
no test coverage detected