disas 956 B

123456789101112131415161718192021222324252627282930313233343536373839
  1. #!/usr/bin/env python3
  2. import os
  3. import lkmc.import_path
  4. import common
  5. from shell_helpers import LF
  6. class Main(common.LkmcCliFunction):
  7. def __init__(self):
  8. super().__init__(
  9. defaults = {
  10. 'show_time': False,
  11. },
  12. description='''\
  13. Disassemble one function of the given executable.
  14. https://cirosantilli.com/linux-kernel-module-cheat#run-toolchain
  15. ''',
  16. )
  17. self.add_argument('function', default='main', help='Which function to disassemble.')
  18. def timed_main(self):
  19. lkmc.import_path.import_path_main('run-toolchain')(
  20. tool='gdb',
  21. extra_args=[
  22. '-nh',
  23. '-batch',
  24. '-ex',
  25. 'disas/rs {}'.format(self.env['function']),
  26. self.env['image_elf'],
  27. ],
  28. quiet=True,
  29. **self.get_common_args()
  30. )
  31. if __name__ == '__main__':
  32. Main().cli()