summaryrefslogtreecommitdiffstats
path: root/lldb/utils/test
diff options
context:
space:
mode:
authorJohnny Chen <johnny.chen@apple.com>2011-08-18 22:04:27 +0000
committerJohnny Chen <johnny.chen@apple.com>2011-08-18 22:04:27 +0000
commit901209dccab167cc7487f6f7d6946e5b6f43880e (patch)
tree7aca531dfad98be086d1e5ee11d9a42af125c6cf /lldb/utils/test
parent40aa7c91b6dd78d1ebf539cdfd49428bb2bf53e4 (diff)
downloadbcm5719-llvm-901209dccab167cc7487f6f7d6946e5b6f43880e.tar.gz
bcm5719-llvm-901209dccab167cc7487f6f7d6946e5b6f43880e.zip
Add an option '-q' to have quiet disassembly by not printing out the disassembled result.
This could be useful by reducing the strain on standard output. Example: utils/test/lldb-disasm.py -C "platform select remote-ios" -o "-b -n" -e '~/CoreFoundation' -n 50 -q llvm-svn: 137988
Diffstat (limited to 'lldb/utils/test')
-rwxr-xr-xlldb/utils/test/lldb-disasm.py33
1 files changed, 22 insertions, 11 deletions
diff --git a/lldb/utils/test/lldb-disasm.py b/lldb/utils/test/lldb-disasm.py
index 5a4662d26d2..9671ee5f4c1 100755
--- a/lldb/utils/test/lldb-disasm.py
+++ b/lldb/utils/test/lldb-disasm.py
@@ -76,7 +76,7 @@ def run_command(ci, cmd, res, echoInput=True, echoOutput=True):
print "run command failed!"
print "run_command error:", res.GetError()
-def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, symbols_to_disassemble):
+def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, symbols_to_disassemble, quiet_disassembly):
import lldb, atexit, re
# Create the debugger instance now.
@@ -115,7 +115,7 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, sy
return symbol.GetType() == lldb.eSymbolTypeCode
# Define a generator for the symbols to disassemble.
- def symbol_iter(num, symbols, target):
+ def symbol_iter(num, symbols, target, verbose):
# If we specify the symbols to disassemble, ignore symbol table dump.
if symbols:
for i in range(len(symbols)):
@@ -135,18 +135,20 @@ def do_lldb_disassembly(lldb_commands, exe, disassemble_options, num_symbols, sy
if IsCodeType(s):
if limited:
count = count + 1
- print "returning symbol:", s.GetName()
+ if verbose:
+ print "returning symbol:", s.GetName()
yield s.GetName()
- print "start address:", s.GetStartAddress()
- print "end address:", s.GetEndAddress()
- s.GetDescription(stream)
- print "symbol description:", stream.GetData()
- stream.Clear()
+ if verbose:
+ print "start address:", s.GetStartAddress()
+ print "end address:", s.GetEndAddress()
+ s.GetDescription(stream)
+ print "symbol description:", stream.GetData()
+ stream.Clear()
# Disassembly time.
- for symbol in symbol_iter(num_symbols, symbols_to_disassemble, target):
+ for symbol in symbol_iter(num_symbols, symbols_to_disassemble, target, not quiet_disassembly):
cmd = "disassemble %s '%s'" % (disassemble_options, symbol)
- run_command(ci, cmd, res)
+ run_command(ci, cmd, res, True, not quiet_disassembly)
def main():
@@ -176,6 +178,10 @@ Usage: %prog [options]
type='int', action='store', default=-1,
dest='num_symbols',
help="""The number of symbols to disassemble, if specified.""")
+ parser.add_option('-q', '--quiet-disassembly',
+ action='store_true', default=False,
+ dest='quiet_disassembly',
+ help="""The symbol(s) to invoke lldb's 'disassemble' command on, if specified.""")
parser.add_option('-s', '--symbol',
type='string', action='append', metavar='SYMBOL', default=[],
dest='symbols_to_disassemble',
@@ -192,6 +198,7 @@ Usage: %prog [options]
executable = opts.executable
disassemble_options = opts.disassemble_options
num_symbols = opts.num_symbols
+ quiet_disassembly = opts.quiet_disassembly
symbols_to_disassemble = opts.symbols_to_disassemble
# We have parsed the options.
@@ -199,10 +206,14 @@ Usage: %prog [options]
print "executable:", executable
print "disassemble options:", disassemble_options
print "num of symbols to disassemble:", num_symbols
+ print "quiet disassembly output:", quiet_disassembly
print "symbols to disassemble:", symbols_to_disassemble
setupSysPath()
- do_lldb_disassembly(lldb_commands, executable, disassemble_options, num_symbols, symbols_to_disassemble)
+ do_lldb_disassembly(lldb_commands, executable, disassemble_options,
+ num_symbols,
+ symbols_to_disassemble,
+ quiet_disassembly)
if __name__ == '__main__':
main()
OpenPOWER on IntegriCloud