OLD | NEW |
(Empty) | |
| 1 #!/usr/bin/env python |
| 2 # |
| 3 # Copyright 2016 the V8 project authors. All rights reserved. |
| 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are |
| 6 # met: |
| 7 # |
| 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above |
| 11 # copyright notice, this list of conditions and the following |
| 12 # disclaimer in the documentation and/or other materials provided |
| 13 # with the distribution. |
| 14 # * Neither the name of Google Inc. nor the names of its |
| 15 # contributors may be used to endorse or promote products derived |
| 16 # from this software without specific prior written permission. |
| 17 # |
| 18 # THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 19 # "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
| 20 # LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
| 21 # A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
| 22 # OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
| 23 # SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
| 24 # LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
| 25 # DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
| 26 # THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
| 27 # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
| 28 # OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
| 29 |
| 30 # This script executes the tickprocessor, collects all dumped C++ symbols, |
| 31 # and merges them into v8.log. |
| 32 |
| 33 import os |
| 34 import platform |
| 35 import subprocess |
| 36 import sys |
| 37 |
| 38 if __name__ == '__main__': |
| 39 tools_path = os.path.dirname(os.path.realpath(__file__)) |
| 40 log_file = 'v8.log' |
| 41 args = [os.path.join(tools_path, 'linux-tick-processor'), '--dump-cpp'] |
| 42 for i in range(1, len(sys.argv)): |
| 43 args.append(sys.argv[i]) |
| 44 if not sys.argv[i].startswith('-'): |
| 45 log_file = sys.argv[i]; |
| 46 |
| 47 sp = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=None, |
| 48 stdin=subprocess.PIPE) |
| 49 out, _ = sp.communicate() |
| 50 returncode = sp.returncode |
| 51 if returncode != 0: |
| 52 print out |
| 53 exit(-1) |
| 54 |
| 55 if platform.system() == 'Windows' and out: |
| 56 out = re.sub('\r+\n', '\n', out) |
| 57 |
| 58 with open(log_file, 'r') as f: |
| 59 lines = f.readlines() |
| 60 |
| 61 iswritten = False |
| 62 with open(log_file, 'w+') as f: |
| 63 for line in lines: |
| 64 if not iswritten and line.startswith('tick'): |
| 65 f.write(out) |
| 66 iswritten = True |
| 67 f.write(line) |
OLD | NEW |