MCPcopy Create free account
hub / github.com/GJDuck/e9patch / parseSymbols

Function parseSymbols

src/e9tool/e9frontend.cpp:864–880  ·  view source on GitHub ↗

* Parse a symbol table. */

Source from the content-addressed store, hash-verified

862 * Parse a symbol table.
863 */
864static void parseSymbols(const uint8_t *data, const Elf64_Shdr *shdr_syms,
865 const Elf64_Shdr *shdr_strs, SymbolInfo &syms)
866{
867 const Elf64_Sym *sym_tab =
868 (const Elf64_Sym *)(data + shdr_syms->sh_offset);
869 const char *str_tab = (const char *)(data + shdr_strs->sh_offset);
870 size_t sym_num = shdr_syms->sh_size / sizeof(Elf64_Sym);
871 size_t str_len = shdr_strs->sh_size;
872 for (size_t i = 0; i < sym_num; i++)
873 {
874 const Elf64_Sym *sym = sym_tab + i;
875 const char *name = parseName(str_tab, str_len, sym->st_name);
876 if (name == nullptr)
877 continue;
878 syms.insert({name, sym});
879 }
880}
881
882/*
883 * Parse an ELF file.

Callers 1

parseELFMethod · 0.85

Calls 1

parseNameFunction · 0.85

Tested by

no test coverage detected