diff options
author | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
---|---|---|
committer | Kate Stone <katherine.stone@apple.com> | 2016-09-06 20:57:50 +0000 |
commit | b9c1b51e45b845debb76d8658edabca70ca56079 (patch) | |
tree | dfcb5a13ef2b014202340f47036da383eaee74aa /lldb/examples/python/lldb_module_utils.py | |
parent | d5aa73376966339caad04013510626ec2e42c760 (diff) | |
download | llvm-b9c1b51e45b845debb76d8658edabca70ca56079.zip llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.gz llvm-b9c1b51e45b845debb76d8658edabca70ca56079.tar.bz2 |
*** This commit represents a complete reformatting of the LLDB source code
*** to conform to clang-format’s LLVM style. This kind of mass change has
*** two obvious implications:
Firstly, merging this particular commit into a downstream fork may be a huge
effort. Alternatively, it may be worth merging all changes up to this commit,
performing the same reformatting operation locally, and then discarding the
merge for this particular commit. The commands used to accomplish this
reformatting were as follows (with current working directory as the root of
the repository):
find . \( -iname "*.c" -or -iname "*.cpp" -or -iname "*.h" -or -iname "*.mm" \) -exec clang-format -i {} +
find . -iname "*.py" -exec autopep8 --in-place --aggressive --aggressive {} + ;
The version of clang-format used was 3.9.0, and autopep8 was 1.2.4.
Secondly, “blame” style tools will generally point to this commit instead of
a meaningful prior commit. There are alternatives available that will attempt
to look through this change and find the appropriate prior commit. YMMV.
llvm-svn: 280751
Diffstat (limited to 'lldb/examples/python/lldb_module_utils.py')
-rw-r--r-- | lldb/examples/python/lldb_module_utils.py | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/lldb/examples/python/lldb_module_utils.py b/lldb/examples/python/lldb_module_utils.py index 37f33ba..eb00a48 100644 --- a/lldb/examples/python/lldb_module_utils.py +++ b/lldb/examples/python/lldb_module_utils.py @@ -6,18 +6,29 @@ import shlex import string import sys -def create_dump_module_line_tables_options (): + +def create_dump_module_line_tables_options(): usage = "usage: dump_module_line_tables [options] MODULE1 [MODULE2 ...]" - description='''Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.''' - parser = optparse.OptionParser(description=description, prog='start_gdb_log',usage=usage) - parser.add_option('-v', '--verbose', action='store_true', dest='verbose', help='Display verbose output.', default=False) + description = '''Dumps all line tables from all compile units for any modules specified as arguments. Specifying the --verbose flag will output address ranges for each line entry.''' + parser = optparse.OptionParser( + description=description, + prog='start_gdb_log', + usage=usage) + parser.add_option( + '-v', + '--verbose', + action='store_true', + dest='verbose', + help='Display verbose output.', + default=False) return parser - + + def dump_module_line_tables(debugger, command, result, dict): '''Dumps all line tables from all compile units for any modules specified as arguments.''' command_args = shlex.split(command) - - parser = create_dump_module_line_tables_options () + + parser = create_dump_module_line_tables_options() try: (options, args) = parser.parse_args(command_args) except: @@ -27,33 +38,41 @@ def dump_module_line_tables(debugger, command, result, dict): lldb.target = target for module_name in command_args: result.PutCString('Searching for module "%s"' % (module_name,)) - module_fspec = lldb.SBFileSpec (module_name, False) - module = target.FindModule (module_fspec); + module_fspec = lldb.SBFileSpec(module_name, False) + module = target.FindModule(module_fspec) if module: - for cu_idx in range (module.GetNumCompileUnits()): + for cu_idx in range(module.GetNumCompileUnits()): cu = module.GetCompileUnitAtIndex(cu_idx) result.PutCString("\n%s:" % (cu.file)) for line_idx in range(cu.GetNumLineEntries()): line_entry = cu.GetLineEntryAtIndex(line_idx) start_file_addr = line_entry.addr.file_addr end_file_addr = line_entry.end_addr.file_addr - # If the two addresses are equal, this line table entry is a termination entry + # If the two addresses are equal, this line table entry + # is a termination entry if options.verbose: if start_file_addr != end_file_addr: - result.PutCString('[%#x - %#x): %s' % (start_file_addr, end_file_addr, line_entry)) + result.PutCString( + '[%#x - %#x): %s' % + (start_file_addr, end_file_addr, line_entry)) else: if start_file_addr == end_file_addr: - result.PutCString('%#x: END' % (start_file_addr)) + result.PutCString('%#x: END' % + (start_file_addr)) else: - result.PutCString('%#x: %s' % (start_file_addr, line_entry)) + result.PutCString( + '%#x: %s' % + (start_file_addr, line_entry)) if start_file_addr == end_file_addr: result.Printf("\n") else: - result.PutCString ("no module for '%s'" % module) + result.PutCString("no module for '%s'" % module) else: - result.PutCString ("error: invalid target") + result.PutCString("error: invalid target") -parser = create_dump_module_line_tables_options () +parser = create_dump_module_line_tables_options() dump_module_line_tables.__doc__ = parser.format_help() -lldb.debugger.HandleCommand('command script add -f %s.dump_module_line_tables dump_module_line_tables' % __name__) -print 'Installed "dump_module_line_tables" command'
\ No newline at end of file +lldb.debugger.HandleCommand( + 'command script add -f %s.dump_module_line_tables dump_module_line_tables' % + __name__) +print 'Installed "dump_module_line_tables" command' |