Refactor extract_pc
This is meant to make it easy to call the pc extractor from some other python code as well, to call it from generate_eh_elf.py
This commit is contained in:
parent
26d7b2afd5
commit
13ebe46df2
1 changed files with 13 additions and 6 deletions
|
@ -38,6 +38,18 @@ def generate_pc_list(elf, out_path):
|
||||||
out_handle.write(pc_bytes)
|
out_handle.write(pc_bytes)
|
||||||
|
|
||||||
|
|
||||||
|
def generate_all_pc_list(out_dir, elf_list):
|
||||||
|
''' Calls `generate_pc_list` on every object in `elf_list`, saving the
|
||||||
|
result to `out_dir/[file].pc_list`. '''
|
||||||
|
|
||||||
|
for obj in elf_list:
|
||||||
|
basename = os.path.basename(obj)
|
||||||
|
print('> {}…'.format(basename))
|
||||||
|
out_path = os.path.join(out_dir,
|
||||||
|
basename + '.pc_list')
|
||||||
|
generate_pc_list(obj, out_path)
|
||||||
|
|
||||||
|
|
||||||
def process_args():
|
def process_args():
|
||||||
''' Process `sys.argv` arguments '''
|
''' Process `sys.argv` arguments '''
|
||||||
|
|
||||||
|
@ -66,12 +78,7 @@ def main():
|
||||||
for obj in args.object:
|
for obj in args.object:
|
||||||
objs_list += elf_so_deps(obj)
|
objs_list += elf_so_deps(obj)
|
||||||
|
|
||||||
for obj in objs_list:
|
generate_all_pc_list(args.output, objs_list)
|
||||||
basename = os.path.basename(obj)
|
|
||||||
print('> {}…'.format(basename))
|
|
||||||
out_path = os.path.join(args.output,
|
|
||||||
basename + '.pc_list')
|
|
||||||
generate_pc_list(obj, out_path)
|
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|
Loading…
Reference in a new issue