MCPcopy Create free account
hub / github.com/Vector35/binaryninja-api / ParseSymbolTableEntry

Method ParseSymbolTableEntry

view/elf/elfview.cpp:341–409  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

339
340
341bool ElfView::ParseSymbolTableEntry(BinaryReader& reader, ElfSymbolTableEntry& entry, uint64_t sym,
342 const Elf64SectionHeader& symbolTable, const Elf64SectionHeader& stringTable, bool dynamic)
343{
344 try
345 {
346 entry.dynamic = dynamic;
347 if (m_elf32)
348 {
349 reader.Seek(symbolTable.offset + (sym * 16));
350 entry.nameOffset = reader.Read32();
351 entry.value = reader.Read32();
352 entry.size = reader.Read32();
353 uint8_t info = reader.Read8();
354 entry.type = ELF_ST_TYPE(info);
355 entry.binding = TranslateELFBindingType(ELF_ST_BIND(info));
356 entry.other = reader.Read8();
357 entry.section = reader.Read16();
358 }
359 else
360 {
361 reader.Seek(symbolTable.offset + (sym * 24));
362 entry.nameOffset = reader.Read32();
363 uint8_t info = reader.Read8();
364 entry.type = ELF_ST_TYPE(info);
365 entry.binding = TranslateELFBindingType(ELF_ST_BIND(info));
366 entry.other = reader.Read8();
367 entry.section = reader.Read16();
368 entry.value = reader.Read64();
369 entry.size = reader.Read64();
370 }
371
372 if (entry.type == ELF_STT_SECTION)
373 {
374 if (entry.section < m_elfSections.size())
375 {
376 entry.name = ReadStringTable(reader, m_sectionStringTable, m_elfSections[entry.section].name);
377 }
378 }
379 else
380 {
381 entry.name = ReadStringTable(reader, stringTable, entry.nameOffset);
382 }
383 }
384 catch (ReadException&)
385 {
386 return false;
387 }
388
389 m_logger->LogDebug(
390 "Symbol: %d - symbolSection.offset: %lx - stringSection.offset: %lx\n"
391 "\tnameOffset = %#08lx\n"
392 "\ttype = %#02x\n"
393 "\tbinding = %#02x\n"
394 "\tother = %#02x\n"
395 "\tsection = %#04x\n"
396 "\tvalue = %#012lx\n"
397 "\tsize = %#012lx\n"
398 "\tname = %#s",

Callers

nothing calls this directly

Calls 9

TranslateELFBindingTypeFunction · 0.85
LogDebugMethod · 0.80
c_strMethod · 0.80
SeekMethod · 0.45
Read32Method · 0.45
Read8Method · 0.45
Read16Method · 0.45
Read64Method · 0.45
sizeMethod · 0.45

Tested by

no test coverage detected