Greg Clayton | 6a23d21 | 2013-09-04 17:31:40 +0000 | [diff] [blame] | 1 | #!/usr/bin/python |
| 2 | |
| 3 | import lldb |
| 4 | import shlex |
| 5 | |
| 6 | def dump_module_sources(module, result): |
| 7 | if module: |
| 8 | print >> result, "Module: %s" % (module.file) |
| 9 | for compile_unit in module.compile_units: |
| 10 | if compile_unit.file: |
| 11 | print >> result, " %s" % (compile_unit.file) |
| 12 | |
| 13 | def info_sources(debugger, command, result, dict): |
| 14 | description='''This command will dump all compile units in any modules that are listed as arguments, or for all modules if no arguments are supplied.''' |
| 15 | module_names = shlex.split(command) |
| 16 | target = debugger.GetSelectedTarget() |
| 17 | if module_names: |
| 18 | for module_name in module_names: |
| 19 | dump_module_sources(target.module[module_name], result) |
| 20 | else: |
| 21 | for module in target.modules: |
| 22 | dump_module_sources(module, result) |
| 23 | |
| 24 | |
| 25 | def __lldb_init_module (debugger, dict): |
| 26 | # Add any commands contained in this module to LLDB |
| 27 | debugger.HandleCommand('command script add -f sources.info_sources info_sources') |
| 28 | print 'The "info_sources" command has been installed, type "help info_sources" or "info_sources --help" for detailed help.' |