diff options
Diffstat (limited to 'lldb/utils/test/lldb-disasm.py')
-rwxr-xr-x | lldb/utils/test/lldb-disasm.py | 40 |
1 files changed, 22 insertions, 18 deletions
diff --git a/lldb/utils/test/lldb-disasm.py b/lldb/utils/test/lldb-disasm.py index 7825ca93086..7987c6b01c3 100755 --- a/lldb/utils/test/lldb-disasm.py +++ b/lldb/utils/test/lldb-disasm.py @@ -62,18 +62,18 @@ def setupSysPath(): # This is to locate the lldb.py module. Insert it right after sys.path[0]. sys.path[1:1] = [lldbPath] - print "sys.path:", sys.path + #print "sys.path:", sys.path -def run_command(ci, cmd, res, echoInput=True, echoOutput=True): - if echoInput: +def run_command(ci, cmd, res, echo=True): + if echo: print "run command:", cmd ci.HandleCommand(cmd, res) if res.Succeeded(): - if echoOutput: + if echo: print "run_command output:", res.GetOutput() else: - if echoOutput: + if echo: print "run command failed!" print "run_command error:", res.GetError() @@ -104,10 +104,10 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, # See if there any extra command(s) to execute before we issue the file command. for cmd in lldb_commands: - run_command(ci, cmd, res) + run_command(ci, cmd, res, not quiet_disassembly) # Now issue the file command. - run_command(ci, 'file %s' % exe, res) + run_command(ci, 'file %s' % exe, res, not quiet_disassembly) # Create a target. #target = dbg.CreateTarget(exe) @@ -123,7 +123,8 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, # If we specify the symbols to disassemble, ignore symbol table dump. if symbols: for i in range(len(symbols)): - print "symbol:", symbols[i] + if verbose: + print "symbol:", symbols[i] yield symbols[i] else: limited = True if num != -1 else False @@ -133,7 +134,8 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, pattern = re.compile(re_symbol_pattern) stream = lldb.SBStream() for m in target.module_iter(): - print "module:", m + if verbose: + print "module:", m for s in m: if limited and count >= num: return @@ -144,7 +146,8 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, continue # If we come here, we're ready to disassemble the symbol. - print "symbol:", s.GetName() + if verbose: + print "symbol:", s.GetName() if IsCodeType(s): if limited: count = count + 1 @@ -161,7 +164,7 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, # Disassembly time. for symbol in symbol_iter(num_symbols, symbols_to_disassemble, re_symbol_pattern, target, not quiet_disassembly): cmd = "disassemble %s '%s'" % (disassemble_options, symbol) - run_command(ci, cmd, res, True, not quiet_disassembly) + run_command(ci, cmd, res, not quiet_disassembly) def main(): @@ -220,13 +223,14 @@ Usage: %prog [options] re_symbol_pattern = opts.re_symbol_pattern # We have parsed the options. - 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 + 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 setupSysPath() do_lldb_disassembly(lldb_commands, executable, disassemble_options, |