OLD | NEW |
---|---|
(Empty) | |
1 #!/usr/bin/python2.4 | |
2 # | |
3 # Copyright (c) 2009 The Chromium Authors. All rights reserved. | |
4 # Use of this source code is governed by a BSD-style license that can be | |
5 # found in the LICENSE file. | |
6 # | |
7 # This generates symbol signatures with the same algorithm as | |
8 # src/breakpad/linux/minidump_writer.cc@17081 | |
9 | |
10 import sys | |
11 | |
12 if len(sys.argv) != 2: | |
13 sys.stderr.write("Error, no filename specified.\n") | |
14 sys.exit(1) | |
15 | |
16 bin = open(sys.argv[1]) | |
17 data = bin.read(4096) | |
18 if len(data) != 4096: | |
19 sys.stderr.write("Error, did not read first page of data.\n"); | |
Mark Mentovai
2009/06/12 17:30:10
Don't we want sys.exit(1) here too?
| |
20 bin.close() | |
21 | |
22 signature = [0] * 16 | |
23 for i in range(0, 4096): | |
24 signature[i % 16] ^= ord(data[i]) | |
25 | |
26 out = '' | |
Mark Mentovai
2009/06/12 17:30:10
I have a better recipe for this, and it's endian-n
| |
27 # Assume we're running on little endian | |
28 for i in [3, 2, 1, 0, 5, 4, 7, 6, 8, 9, 10, 11, 12, 13, 14, 15]: | |
29 out += '%02X' % signature[i] | |
30 out += '0' | |
Mark Mentovai
2009/06/12 17:30:10
I know what the 0 means, but will others?
Put a c
| |
31 sys.stdout.write(out) | |
OLD | NEW |