Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 #!/usr/bin/env python2 | 1 #!/usr/bin/env python2 |
| 2 | 2 |
| 3 import argparse | 3 import argparse |
| 4 import itertools | 4 import itertools |
| 5 import os | 5 import os |
| 6 import re | 6 import re |
| 7 import subprocess | 7 import subprocess |
| 8 import sys | 8 import sys |
| 9 import tempfile | 9 import tempfile |
| 10 | 10 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 105 cmd += [llfile] | 105 cmd += [llfile] |
| 106 asm_temp = None | 106 asm_temp = None |
| 107 if args.assemble or args.disassemble: | 107 if args.assemble or args.disassemble: |
| 108 # On windows we may need to close the file first before it can be | 108 # On windows we may need to close the file first before it can be |
| 109 # re-opened by the other tools, so don't do delete-on-close, | 109 # re-opened by the other tools, so don't do delete-on-close, |
| 110 # and instead manually delete. | 110 # and instead manually delete. |
| 111 asm_temp = tempfile.NamedTemporaryFile(delete=False) | 111 asm_temp = tempfile.NamedTemporaryFile(delete=False) |
| 112 asm_temp.close() | 112 asm_temp.close() |
| 113 if args.assemble and args.filetype != 'obj': | 113 if args.assemble and args.filetype != 'obj': |
| 114 cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'), | 114 cmd += ['|', os.path.join(llvm_bin_path, 'llvm-mc'), |
| 115 '-triple=i686-none-nacl', | 115 # TODO(stichnot): use i686-nacl? |
|
jvoung (off chromium)
2015/03/03 22:58:02
What are the issues with deciding between i686 or
Jim Stichnoth
2015/03/03 23:18:51
If we are testing low-level aspects of sandboxing,
jvoung (off chromium)
2015/03/03 23:52:53
Yeah I think clarify in the TODO to choose between
Jim Stichnoth
2015/03/04 00:12:58
Done.
| |
| 116 '-triple=i686', | |
| 116 '-filetype=obj', '-o', asm_temp.name] | 117 '-filetype=obj', '-o', asm_temp.name] |
| 117 elif asm_temp: | 118 elif asm_temp: |
| 118 cmd += ['-o', asm_temp.name] | 119 cmd += ['-o', asm_temp.name] |
| 119 if args.disassemble: | 120 if args.disassemble: |
| 120 # Show wide instruction encodings, diassemble, and show relocs. | 121 # Show wide instruction encodings, diassemble, and show relocs. |
| 121 cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] + | 122 cmd += (['&&', os.path.join(binutils_bin_path, 'objdump')] + |
| 122 args.dis_flags + | 123 args.dis_flags + |
| 123 ['-w', '-d', '-r', '-Mintel', asm_temp.name]) | 124 ['-w', '-d', '-r', '-Mintel', asm_temp.name]) |
| 124 | 125 |
| 125 stdout_result = shellcmd(cmd, echo=args.echo_cmd) | 126 stdout_result = shellcmd(cmd, echo=args.echo_cmd) |
| 126 if not args.echo_cmd: | 127 if not args.echo_cmd: |
| 127 sys.stdout.write(stdout_result) | 128 sys.stdout.write(stdout_result) |
| 128 if asm_temp: | 129 if asm_temp: |
| 129 os.remove(asm_temp.name) | 130 os.remove(asm_temp.name) |
| 130 | 131 |
| 131 if __name__ == '__main__': | 132 if __name__ == '__main__': |
| 132 main() | 133 main() |
| OLD | NEW |