symbols: add a symbol installation script

This commit is contained in:
Danny Robson 2019-10-31 13:58:56 +11:00
parent 93a4a581b2
commit 8caeef1819
2 changed files with 43 additions and 0 deletions

3
.gitignore vendored
View File

@ -6,3 +6,6 @@
/release
/sanitizer
/tidy
/dumps
/symbols

40
symbols.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python3
"""
Installs a provided symbol file into the symbols repository at the correct
subdirectory for `minidump_stackwalk` to automatically find.
"""
if __name__ == '__main__':
import argparse
import os
import shutil
import sys
def main():
default_dst = os.path.join(
os.path.dirname(
os.path.realpath(__file__)
),
"symbols"
)
parser = argparse.ArgumentParser()
parser.add_argument('--dst', dest='dst', type=str, required=False, default=default_dst)
parser.add_argument('src', type=str)
args = parser.parse_args()
with open(args.src) as f:
header = f.readline()
field, system, arch, id, name = header.strip().split(' ')
print(f"Installing {name}: {id}", file=sys.stderr)
dst_dir = os.path.join(args.dst, name, id)
os.makedirs(dst_dir, exist_ok=True)
dst_path = os.path.join(dst_dir, f"{name}.sym")
shutil.copyfile(args.src, dst_path)
main()