'Dump the symbol table of an ELF file.
Needs pyelftools (https://github.com/eliben/pyelftools)'

@classmethod
def _dump_elf(cls, buf):

    from elftools.elf.elffile import ELFFile
    from elftools.elf import descriptions
    from io import BytesIO
    f = ELFFile(BytesIO(buf))
    print('ELF    file:')
    for sec in f.iter_sections():
        if (sec['sh_type'] == 'SHT_SYMTAB'):
            symbols = sorted(sec.iter_symbols(), key=(lambda sym: sym.name))
            print('                symbols:')
            for sym in symbols:
                if (not sym.name):
                    continue
                print(('                -    %r:    size=%d,    value=0x%x,    type=%s,    bind=%s' % (sym.name.decode(), sym['st_size'], sym['st_value'], descriptions.describe_symbol_type(sym['st_info']['type']), descriptions.describe_symbol_bind(sym['st_info']['bind']))))
    print()
