Last active
September 14, 2018 05:53
-
-
Save grantseltzer/1ccd6cf37dd98c012a089b0f0f00babd to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Open the ELF file | |
elfFile, err := elf.Open(path) | |
if err != nil { | |
log.Fatalf("error while opening ELF file %s: %+s", path, err.Error()) | |
} | |
// Extract the symbol table | |
symbolTable, err := elfFile.Symbols() | |
if err != nil { | |
log.Fatalf("could not extract symbol table: %s", err.Error()) | |
} | |
// Traverse through each symbol in the symbol table | |
for _, symbol := range symbolTable { | |
/* | |
symbol.Info lets us tell if this symbol is a function that we want to disassemble | |
symbol.Value gives us the offset from the start of the .text section | |
symbol.Size lets us calculate the full address range of this symbol in the .text section | |
*/ | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment