diff options
Diffstat (limited to 'lldb/utils/test')
-rwxr-xr-x | lldb/utils/test/disasm.py | 18 | ||||
-rwxr-xr-x | lldb/utils/test/lldb-disasm.py | 44 | ||||
-rwxr-xr-x | lldb/utils/test/llvm-mc-shell.py | 6 | ||||
-rwxr-xr-x | lldb/utils/test/ras.py | 4 | ||||
-rwxr-xr-x | lldb/utils/test/run-dis.py | 12 | ||||
-rwxr-xr-x | lldb/utils/test/run-until-faulted.py | 10 |
6 files changed, 53 insertions, 41 deletions
diff --git a/lldb/utils/test/disasm.py b/lldb/utils/test/disasm.py index e75c070e011..fc1db1acd73 100755 --- a/lldb/utils/test/disasm.py +++ b/lldb/utils/test/disasm.py @@ -6,6 +6,8 @@ and display the disassembly result. """ +from __future__ import print_function + import os import sys from optparse import OptionParser @@ -107,7 +109,7 @@ def do_llvm_mc_disassembly( os.linesep)[-1].partition('>:')[2].strip() # print "\nbytes:", memory_dump disasm_str = prev_line.partition('>:')[2] - print >> mc_input, '%s # %s' % (memory_dump, disasm_str) + print('%s # %s' % (memory_dump, disasm_str), file=mc_input) # We're done with the processing. Assign the current line to be # prev_line. @@ -123,7 +125,7 @@ def do_llvm_mc_disassembly( f.write(mc_input.getvalue()) mc_cmd = '%s -disassemble %s disasm-input.txt' % (mc, mc_options) - print "\nExecuting command:", mc_cmd + print("\nExecuting command:", mc_cmd) os.system(mc_cmd) # And invoke llvm-mc with the just recorded file. @@ -217,12 +219,12 @@ Usage: %prog [options] llvm_mc_options = opts.llvm_mc_options # We have parsed the options. - print "gdb commands:", gdb_commands - print "gdb options:", gdb_options - print "executable:", executable - print "function:", function - print "llvm-mc:", llvm_mc - print "llvm-mc options:", llvm_mc_options + print("gdb commands:", gdb_commands) + print("gdb options:", gdb_options) + print("executable:", executable) + print("function:", function) + print("llvm-mc:", llvm_mc) + print("llvm-mc options:", llvm_mc_options) do_llvm_mc_disassembly( gdb_commands, diff --git a/lldb/utils/test/lldb-disasm.py b/lldb/utils/test/lldb-disasm.py index 1069bf477af..339e8e7caba 100755 --- a/lldb/utils/test/lldb-disasm.py +++ b/lldb/utils/test/lldb-disasm.py @@ -5,6 +5,8 @@ Run lldb to disassemble all the available functions for an executable image. """ +from __future__ import print_function + import os import re import sys @@ -18,7 +20,7 @@ def setupSysPath(): # Get the directory containing the current script. scriptPath = sys.path[0] if not scriptPath.endswith(os.path.join('utils', 'test')): - print "This script expects to reside in lldb's utils/test directory." + print("This script expects to reside in lldb's utils/test directory.") sys.exit(-1) # This is our base name component. @@ -63,8 +65,8 @@ def setupSysPath(): lldbPath = baiPath2 if not lldbPath: - print 'This script requires lldb.py to be in either ' + dbgPath + ',', - print relPath + ', or ' + baiPath + print('This script requires lldb.py to be in either ' + dbgPath + ',', end=' ') + print(relPath + ', or ' + baiPath) sys.exit(-1) # This is to locate the lldb.py module. Insert it right after sys.path[0]. @@ -74,15 +76,15 @@ def setupSysPath(): def run_command(ci, cmd, res, echo=True): if echo: - print "run command:", cmd + print("run command:", cmd) ci.HandleCommand(cmd, res) if res.Succeeded(): if echo: - print "run_command output:", res.GetOutput() + print("run_command output:", res.GetOutput()) else: if echo: - print "run command failed!" - print "run_command error:", res.GetError() + print("run command failed!") + print("run_command error:", res.GetError()) def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, @@ -135,7 +137,7 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, if symbols: for i in range(len(symbols)): if verbose: - print "symbol:", symbols[i] + print("symbol:", symbols[i]) yield symbols[i] else: limited = True if num != -1 else False @@ -146,7 +148,7 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, stream = lldb.SBStream() for m in target.module_iter(): if verbose: - print "module:", m + print("module:", m) for s in m: if limited and count >= num: return @@ -159,18 +161,18 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, # If we come here, we're ready to disassemble the symbol. if verbose: - print "symbol:", s.GetName() + print("symbol:", s.GetName()) if IsCodeType(s): if limited: count = count + 1 if verbose: - print "returning symbol:", s.GetName() + print("returning symbol:", s.GetName()) yield s.GetName() if verbose: - print "start address:", s.GetStartAddress() - print "end address:", s.GetEndAddress() + print("start address:", s.GetStartAddress()) + print("end address:", s.GetEndAddress()) s.GetDescription(stream) - print "symbol description:", stream.GetData() + print("symbol description:", stream.GetData()) stream.Clear() # Disassembly time. @@ -273,13 +275,13 @@ Usage: %prog [options] # We have parsed the options. if not quiet_disassembly: - print "lldb commands:", lldb_commands - print "executable:", executable - print "disassemble options:", disassemble_options - print "quiet disassembly output:", quiet_disassembly - print "num of symbols to disassemble:", num_symbols - print "symbols to disassemble:", symbols_to_disassemble - print "regular expression of symbols to disassemble:", re_symbol_pattern + print("lldb commands:", lldb_commands) + print("executable:", executable) + print("disassemble options:", disassemble_options) + print("quiet disassembly output:", quiet_disassembly) + print("num of symbols to disassemble:", num_symbols) + print("symbols to disassemble:", symbols_to_disassemble) + print("regular expression of symbols to disassemble:", re_symbol_pattern) setupSysPath() do_lldb_disassembly(lldb_commands, executable, disassemble_options, diff --git a/lldb/utils/test/llvm-mc-shell.py b/lldb/utils/test/llvm-mc-shell.py index 4d311959842..6adaf5dd3c5 100755 --- a/lldb/utils/test/llvm-mc-shell.py +++ b/lldb/utils/test/llvm-mc-shell.py @@ -5,6 +5,8 @@ Run llvm-mc interactively. """ +from __future__ import print_function + import os import sys from optparse import OptionParser @@ -105,8 +107,8 @@ Usage: %prog [options] llvm_mc_options = opts.llvm_mc_options # We have parsed the options. - print "llvm-mc:", llvm_mc - print "llvm-mc options:", llvm_mc_options + print("llvm-mc:", llvm_mc) + print("llvm-mc options:", llvm_mc_options) llvm_mc_loop(llvm_mc, llvm_mc_options) diff --git a/lldb/utils/test/ras.py b/lldb/utils/test/ras.py index 25b76bc1e07..1b7caecdb0f 100755 --- a/lldb/utils/test/ras.py +++ b/lldb/utils/test/ras.py @@ -7,6 +7,8 @@ The code for sending of the directory is copied from http://docs.python.org/library/email-examples.html. """ +from __future__ import print_function + import os import sys import shutil @@ -33,7 +35,7 @@ def runTestsuite(testDir, sessDir, envs=None): list = env.split('=') var = list[0].strip() val = list[1].strip() - print var + "=" + val + print(var + "=" + val) os.environ[var] = val import shlex diff --git a/lldb/utils/test/run-dis.py b/lldb/utils/test/run-dis.py index b635e8c62d8..5df65e85ba1 100755 --- a/lldb/utils/test/run-dis.py +++ b/lldb/utils/test/run-dis.py @@ -5,6 +5,8 @@ Run lldb disassembler on all the binaries specified by a combination of root dir and path pattern. """ +from __future__ import print_function + import os import sys import subprocess @@ -68,7 +70,7 @@ def walk_and_invoke(sdk_root, path_regexp, suffix, num_symbols): command = template % ( scriptPath, path, num_symbols if num_symbols > 0 else 1000) - print "Running %s" % (command) + print("Running %s" % (command)) os.system(command) @@ -130,10 +132,10 @@ and path pattern. suffix = opts.suffix num_symbols = opts.num_symbols - print "Root directory for SDK symbols:", root_dir - print "Regular expression for the binaries:", path_pattern - print "Suffix of the binaries to look for:", suffix - print "num of symbols to disassemble:", num_symbols + print("Root directory for SDK symbols:", root_dir) + print("Regular expression for the binaries:", path_pattern) + print("Suffix of the binaries to look for:", suffix) + print("num of symbols to disassemble:", num_symbols) walk_and_invoke(root_dir, path_regexp, suffix, num_symbols) diff --git a/lldb/utils/test/run-until-faulted.py b/lldb/utils/test/run-until-faulted.py index 794f4fc8478..a51dbb88e1c 100755 --- a/lldb/utils/test/run-until-faulted.py +++ b/lldb/utils/test/run-until-faulted.py @@ -5,6 +5,8 @@ Run a program via lldb until it fails. The lldb executable is located via your PATH env variable, if not specified. """ +from __future__ import print_function + import os import sys from optparse import OptionParser @@ -65,7 +67,7 @@ def do_lldb_launch_loop(lldb_command, exe, exe_options): break elif index == 2: # Something went wrong. - print "TIMEOUT occurred:", str(lldb) + print("TIMEOUT occurred:", str(lldb)) # Give control of lldb shell to the user. lldb.interact() @@ -120,9 +122,9 @@ The lldb executable is located via your PATH env variable, if not specified.\ exe_options = opts.exe_options # We have parsed the options. - print "lldb command:", lldb_command - print "executable:", exe - print "executable options:", exe_options + print("lldb command:", lldb_command) + print("executable:", exe) + print("executable options:", exe_options) do_lldb_launch_loop(lldb_command, exe, exe_options) |