#!/usr/bin/python #coding:utf-8 import os import sys def get_files(): files = os.listdir(os.getcwd()) #获取当前目录下的文件 for index in range(len(files)-1,-1,-1): if files[index].endswith('.txt') or files[index].endswith('.py'): files.pop(index) return files def obj_dump(name): print("Start dump %s" % name) cmd_prefix = "objdump -Sl " + name + " > " target = name.split('.') if len(target)-1 >= 1: #有后缀名的文件名去掉后缀名 target.pop() target = '.'.join(target) print target cmd = cmd_prefix + target + '.txt' os.system(cmd) print("Dump %s finished" % name) if __name__=='__main__': file = get_files() for name in file: obj_dump(name)
使用objdump -Sl 命令