Chromium Code Reviews| Index: tools/symsrc/pdb_fingerprint_from_img.py |
| diff --git a/tools/symsrc/pdb_fingerprint_from_img.py b/tools/symsrc/pdb_fingerprint_from_img.py |
| old mode 100644 |
| new mode 100755 |
| index c7dae5033a2867a66ec4ae315307dcf5a4a8cf8a..95fcc1c26858c7b09931bc33462ea8aa2d6883bc |
| --- a/tools/symsrc/pdb_fingerprint_from_img.py |
| +++ b/tools/symsrc/pdb_fingerprint_from_img.py |
| @@ -1,6 +1,5 @@ |
| #!/usr/bin/env python |
| - |
| -# Copyright (c) 2008 The Chromium Authors. All rights reserved. |
| +# Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| @@ -16,12 +15,14 @@ DLL's reference to the PDB, and use that to retrieve the information.""" |
| import sys |
| import pefile |
| + |
| __CV_INFO_PDB70_format__ = ('CV_INFO_PDB70', |
| ('4s,CvSignature', '16s,Signature', 'L,Age')) |
| __GUID_format__ = ('GUID', |
| ('L,Data1', 'H,Data2', 'H,Data3', '8s,Data4')) |
| + |
| def GetPDBInfoFromImg(filename): |
| """Returns the PDB fingerprint and the pdb filename given an image file""" |
| @@ -48,10 +49,16 @@ def GetPDBInfoFromImg(filename): |
| break |
| -if __name__ == '__main__': |
| + |
| +def main(): |
| if len(sys.argv) != 2: |
| print "usage: file.dll" |
| - sys.exit(1) |
| + return 1 |
| + |
| + (fingerprint, filename) = GetPDBInfoFromImg(sys.argv[1]) |
| + print "%s %s" % (fingerprint, filename) |
| + return 0 |
| - (fingerprint, file) = GetPDBInfoFromImg(sys.argv[1]) |
| - print "%s %s" % (fingerprint, file) |
| + |
| +if __name__ == '__main__': |
| + sys.main(main()) |
|
Alexander Potapenko
2011/11/28 10:29:35
That's sys.exit()
|