tor-browser

The Tor Browser
git clone https://git.dasho.dev/tor-browser.git
Log | Files | Refs | README | LICENSE

dump_app_syms.py (858B)


      1 # Copyright 2015 The Chromium Authors
      2 # Use of this source code is governed by a BSD-style license that can be
      3 # found in the LICENSE file.
      4 
      5 # Helper script to run dump_syms on Chrome Linux executables and strip
      6 # them if needed.
      7 
      8 
      9 import os
     10 import subprocess
     11 import sys
     12 
     13 if len(sys.argv) != 5:
     14  print("dump_app_syms.py <dump_syms_exe> <strip_binary>")
     15  print("                 <binary_with_symbols> <symbols_output>")
     16  sys.exit(1)
     17 
     18 dumpsyms = sys.argv[1]
     19 strip_binary = sys.argv[2]
     20 infile = sys.argv[3]
     21 outfile = sys.argv[4]
     22 
     23 # Dump only when the output file is out-of-date.
     24 if not os.path.isfile(outfile) or \
     25   os.stat(outfile).st_mtime < os.stat(infile).st_mtime:
     26  with open(outfile, 'w') as outfileobj:
     27    subprocess.check_call([dumpsyms, '-m', '-d', infile], stdout=outfileobj)
     28 
     29 if strip_binary != '0':
     30  subprocess.check_call(['strip', infile])