| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # | 2 # |
| 3 # Copyright 2008 the V8 project authors. All rights reserved. | 3 # Copyright 2008 the V8 project authors. All rights reserved. |
| 4 # Redistribution and use in source and binary forms, with or without | 4 # Redistribution and use in source and binary forms, with or without |
| 5 # modification, are permitted provided that the following conditions are | 5 # modification, are permitted provided that the following conditions are |
| 6 # met: | 6 # met: |
| 7 # | 7 # |
| 8 # * Redistributions of source code must retain the above copyright | 8 # * Redistributions of source code must retain the above copyright |
| 9 # notice, this list of conditions and the following disclaimer. | 9 # notice, this list of conditions and the following disclaimer. |
| 10 # * Redistributions in binary form must reproduce the above | 10 # * Redistributions in binary form must reproduce the above |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 command = 'nm -C -n "%s"; nm -C -n -D "%s"' % (filename, filename) | 40 command = 'nm -C -n "%s"; nm -C -n -D "%s"' % (filename, filename) |
| 41 process = subprocess.Popen(command, shell=True, | 41 process = subprocess.Popen(command, shell=True, |
| 42 stdout=subprocess.PIPE, | 42 stdout=subprocess.PIPE, |
| 43 stderr=subprocess.STDOUT) | 43 stderr=subprocess.STDOUT) |
| 44 pipe = process.stdout | 44 pipe = process.stdout |
| 45 try: | 45 try: |
| 46 for line in pipe: | 46 for line in pipe: |
| 47 row = re.match('^([0-9a-fA-F]{8}) . (.*)$', line) | 47 row = re.match('^([0-9a-fA-F]{8}) . (.*)$', line) |
| 48 if row: | 48 if row: |
| 49 addr = int(row.group(1), 16) | 49 addr = int(row.group(1), 16) |
| 50 name = row.group(2); |
| 50 if addr < start and addr < end - start: | 51 if addr < start and addr < end - start: |
| 51 addr += start | 52 addr += start |
| 52 self.cpp_entries.Insert(addr, tickprocessor.CodeEntry(addr, row.group(
2))) | 53 if not re.match('^\$[a-z]$', name): |
| 54 self.cpp_entries.Insert(addr, tickprocessor.CodeEntry(addr, name)) |
| 53 finally: | 55 finally: |
| 54 pipe.close() | 56 pipe.close() |
| 55 | 57 |
| 56 | 58 |
| 57 class LinuxCmdLineProcessor(tickprocessor.CmdLineProcessor): | 59 class LinuxCmdLineProcessor(tickprocessor.CmdLineProcessor): |
| 58 | 60 |
| 59 def GetRequiredArgsNames(self): | 61 def GetRequiredArgsNames(self): |
| 60 return 'log_file' | 62 return 'log_file' |
| 61 | 63 |
| 62 def ProcessRequiredArgs(self, args): | 64 def ProcessRequiredArgs(self, args): |
| 63 if len(args) != 1: | 65 if len(args) != 1: |
| 64 self.PrintUsageAndExit() | 66 self.PrintUsageAndExit() |
| 65 else: | 67 else: |
| 66 self.log_file = args[0] | 68 self.log_file = args[0] |
| 67 | 69 |
| 68 | 70 |
| 69 def Main(): | 71 def Main(): |
| 70 cmdline_processor = LinuxCmdLineProcessor() | 72 cmdline_processor = LinuxCmdLineProcessor() |
| 71 cmdline_processor.ProcessArguments() | 73 cmdline_processor.ProcessArguments() |
| 72 tick_processor = LinuxTickProcessor() | 74 tick_processor = LinuxTickProcessor() |
| 73 cmdline_processor.RunLogfileProcessing(tick_processor) | 75 cmdline_processor.RunLogfileProcessing(tick_processor) |
| 74 tick_processor.PrintResults() | 76 tick_processor.PrintResults() |
| 75 | 77 |
| 76 | 78 |
| 77 if __name__ == '__main__': | 79 if __name__ == '__main__': |
| 78 Main() | 80 Main() |
| OLD | NEW |