| OLD | NEW |
| 1 #!/usr/bin/python | 1 #!/usr/bin/python |
| 2 # | 2 # |
| 3 # Copyright 2009 The Native Client Authors. All rights reserved. | 3 # Copyright (c) 2011 The Native Client Authors. All rights reserved. |
| 4 # Use of this source code is governed by a BSD-style license that can | 4 # Use of this source code is governed by a BSD-style license that can be |
| 5 # be found in the LICENSE file. | 5 # found in the LICENSE file. |
| 6 # Copyright 2009, Google Inc. | |
| 7 # | 6 # |
| 8 | 7 |
| 9 | 8 |
| 10 import sys | 9 import sys |
| 11 import textwrap | 10 import textwrap |
| 12 from subprocess import Popen, PIPE | 11 from subprocess import Popen, PIPE |
| 13 | 12 |
| 14 _OBJDUMP = 'arm-none-linux-gnueabi-objdump' | 13 _OBJDUMP = 'arm-none-linux-gnueabi-objdump' |
| 15 | 14 |
| 16 def _objdump(binary, vaddr, ctx_before, ctx_after): | 15 def _objdump(binary, vaddr, ctx_before, ctx_after): |
| (...skipping 24 matching lines...) Expand all Loading... |
| 41 'part of an instruction sequence that must be executed in full, ' | 40 'part of an instruction sequence that must be executed in full, ' |
| 42 'or is inline data', | 41 'or is inline data', |
| 43 0, 0], | 42 0, 0], |
| 44 'kProblemPatternCrossesBundle': ['This instruction is part of a ' | 43 'kProblemPatternCrossesBundle': ['This instruction is part of a ' |
| 45 'sequence that must execute in full, but it spans a bundle edge ' | 44 'sequence that must execute in full, but it spans a bundle edge ' |
| 46 '-- so an indirect branch may target it', | 45 '-- so an indirect branch may target it', |
| 47 1, 1], | 46 1, 1], |
| 48 'kProblemBranchInvalidDest': ['This branch targets a location that is ' | 47 'kProblemBranchInvalidDest': ['This branch targets a location that is ' |
| 49 'outside of the application\'s executable code, and is not a valid ' | 48 'outside of the application\'s executable code, and is not a valid ' |
| 50 'trampoline entry point', 0, 0], | 49 'trampoline entry point', 0, 0], |
| 51 'kProblemUnsafeStore': ['This store instruction is not preceded by a ' | 50 'kProblemUnsafeLoadStore': ['This store instruction is not preceded by ' |
| 52 'valid address mask instruction', 1, 0], | 51 'a valid address mask instruction', 1, 0], |
| 53 'kProblemUnsafeBranch': ['This indirect branch instruction is not ' | 52 'kProblemUnsafeBranch': ['This indirect branch instruction is not ' |
| 54 'preceded by a valid address mask instruction', 1, 0], | 53 'preceded by a valid address mask instruction', 1, 0], |
| 55 'kProblemUnsafeDataWrite': ['This instruction affects a register that ' | 54 'kProblemUnsafeDataWrite': ['This instruction affects a register that ' |
| 56 'must contain a valid data-region address, but is not followed by ' | 55 'must contain a valid data-region address, but is not followed by ' |
| 57 'a valid address mask instruction', 0, 1], | 56 'a valid address mask instruction', 0, 1], |
| 58 'kProblemReadOnlyRegister': ['This instruction changes the contents of ' | 57 'kProblemReadOnlyRegister': ['This instruction changes the contents of ' |
| 59 'a read-only register', 0, 0], | 58 'a read-only register', 0, 0], |
| 60 'kProblemMisalignedCall': ['This linking branch instruction is not in ' | 59 'kProblemMisalignedCall': ['This linking branch instruction is not in ' |
| 61 'the last slot of its bundle, so when its LR result is masked, the ' | 60 'the last slot of its bundle, so when its LR result is masked, the ' |
| 62 'caller will not return to the next instruction', 0, 0], | 61 'caller will not return to the next instruction', 0, 0], |
| (...skipping 24 matching lines...) Expand all Loading... |
| 87 | 86 |
| 88 def _parse_report(line): | 87 def _parse_report(line): |
| 89 vaddr_hex, safety, code, ref_vaddr_hex = line.split() | 88 vaddr_hex, safety, code, ref_vaddr_hex = line.split() |
| 90 return (int(vaddr_hex, 16), int(safety), code, int(ref_vaddr_hex, 16)) | 89 return (int(vaddr_hex, 16), int(safety), code, int(ref_vaddr_hex, 16)) |
| 91 | 90 |
| 92 | 91 |
| 93 for line in sys.stdin: | 92 for line in sys.stdin: |
| 94 if line.startswith('ncval: '): | 93 if line.startswith('ncval: '): |
| 95 line = line[7:].strip() | 94 line = line[7:].strip() |
| 96 _explain_problem(sys.argv[1], *_parse_report(line)) | 95 _explain_problem(sys.argv[1], *_parse_report(line)) |
| OLD | NEW |