OLD | NEW |
1 #!/usr/bin/python | 1 #!/usr/bin/env python |
2 # Copyright (c) 2013 The Native Client Authors. All rights reserved. | 2 # Copyright (c) 2013 The Native Client 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 """%prog [option...] superinsructions1.txt superinsructions2.txt... | 5 """%prog [option...] superinsructions1.txt superinsructions2.txt... |
6 | 6 |
7 Regex-based verifier for superinstructions list.""" | 7 Regex-based verifier for superinstructions list.""" |
8 | 8 |
9 from __future__ import print_function | 9 from __future__ import print_function |
10 | 10 |
11 import collections | 11 import collections |
12 import optparse | 12 import optparse |
13 import os | 13 import os |
14 import re | 14 import re |
15 import subprocess | 15 import subprocess |
16 import sys | 16 import sys |
17 import tempfile | 17 import tempfile |
18 import validator | 18 import validator |
19 | 19 |
20 | 20 |
21 ObjdumpLine = collections.namedtuple('ObjdumpLine', | 21 ObjdumpLine = collections.namedtuple('ObjdumpLine', |
22 ['address', 'bytes', 'command']) | 22 ['address', 'bytes', 'command']) |
23 | 23 |
24 | 24 |
25 def SplitObjdumpLine(line): | 25 def SplitObjdumpLine(line): |
26 """Split objdump line. | 26 """Split objdump line. |
27 | 27 |
28 Typical line from objdump output looks like this: | 28 Typical line from objdump output looks like this: |
29 | 29 |
30 " 0:» 48 c7 84 80 78 56 34 » movq $0x12345678,0x12345678(%rax,%rax,
4)" | 30 " 0: 48 c7 84 80 78 56 34 movq $0x12345678,0x12345678(%rax,%rax,
4)" |
31 " 7:» 12 78 56 34 12 " | 31 " 7: 12 78 56 34 12 " |
32 | 32 |
33 There are three columns (separated with tabs): | 33 There are three columns (separated with tabs): |
34 address: offset for a particular line | 34 address: offset for a particular line |
35 bytes: few bytes which encode a given command | 35 bytes: few bytes which encode a given command |
36 command: textual representation of command | 36 command: textual representation of command |
37 | 37 |
38 Third column is optional (as in example above). | 38 Third column is optional (as in example above). |
39 | 39 |
40 Args: | 40 Args: |
41 line: objdump line (a single one). | 41 line: objdump line (a single one). |
(...skipping 325 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
367 options.gas, | 367 options.gas, |
368 options.objdump, | 368 options.objdump, |
369 out_file) | 369 out_file) |
370 finally: | 370 finally: |
371 if out_file is not sys.stdout: | 371 if out_file is not sys.stdout: |
372 out_file.close() | 372 out_file.close() |
373 | 373 |
374 | 374 |
375 if __name__ == '__main__': | 375 if __name__ == '__main__': |
376 main() | 376 main() |
OLD | NEW |