| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 # memcheck_analyze.py | 6 # memcheck_analyze.py |
| 7 | 7 |
| 8 ''' Given a valgrind XML file, parses errors and uniques them.''' | 8 ''' Given a valgrind XML file, parses errors and uniques them.''' |
| 9 | 9 |
| 10 import gdb_helper | 10 import gdb_helper |
| 11 | 11 |
| (...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 key=lambda (k,v): (v,k)): | 599 key=lambda (k,v): (v,k)): |
| 600 logging.info("%7d %s" % (count, name)) | 600 logging.info("%7d %s" % (count, name)) |
| 601 retcode = -3 | 601 retcode = -3 |
| 602 | 602 |
| 603 if retcode != 0: | 603 if retcode != 0: |
| 604 return retcode | 604 return retcode |
| 605 | 605 |
| 606 logging.info("PASS! No errors found!") | 606 logging.info("PASS! No errors found!") |
| 607 return 0 | 607 return 0 |
| 608 | 608 |
| 609 |
| 609 def _main(): | 610 def _main(): |
| 610 '''For testing only. The MemcheckAnalyzer class should be imported instead.''' | 611 '''For testing only. The MemcheckAnalyzer class should be imported instead.''' |
| 611 retcode = 0 | |
| 612 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") | 612 parser = optparse.OptionParser("usage: %prog [options] <files to analyze>") |
| 613 parser.add_option("", "--source_dir", | 613 parser.add_option("", "--source_dir", |
| 614 help="path to top of source tree for this build" | 614 help="path to top of source tree for this build" |
| 615 "(used to normalize source paths in baseline)") | 615 "(used to normalize source paths in baseline)") |
| 616 | 616 |
| 617 (options, args) = parser.parse_args() | 617 (options, args) = parser.parse_args() |
| 618 if len(args) == 0: | 618 if len(args) == 0: |
| 619 parser.error("no filename specified") | 619 parser.error("no filename specified") |
| 620 filenames = args | 620 filenames = args |
| 621 | 621 |
| 622 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) | 622 analyzer = MemcheckAnalyzer(options.source_dir, use_gdb=True) |
| 623 retcode = analyzer.Report(filenames, None) | 623 return analyzer.Report(filenames, None) |
| 624 | 624 |
| 625 sys.exit(retcode) | |
| 626 | 625 |
| 627 if __name__ == "__main__": | 626 if __name__ == "__main__": |
| 628 _main() | 627 sys.exit(_main()) |
| OLD | NEW |