qemu-gdb.py 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #!/usr/bin/python
  2. # GDB debugging support
  3. #
  4. # Copyright 2012 Red Hat, Inc. and/or its affiliates
  5. #
  6. # Authors:
  7. # Avi Kivity <avi@redhat.com>
  8. #
  9. # This work is licensed under the terms of the GNU GPL, version 2. See
  10. # the COPYING file in the top-level directory.
  11. #
  12. # Contributions after 2012-01-13 are licensed under the terms of the
  13. # GNU GPL, version 2 or (at your option) any later version.
  14. # Usage:
  15. # At the (gdb) prompt, type "source scripts/qemu-gdb.py".
  16. # "help qemu" should then list the supported QEMU debug support commands.
  17. import gdb
  18. import os, sys
  19. # Annoyingly, gdb doesn't put the directory of scripts onto the
  20. # module search path. Do it manually.
  21. sys.path.append(os.path.dirname(__file__))
  22. from qemugdb import aio, mtree, coroutine, tcg, timers
  23. class QemuCommand(gdb.Command):
  24. '''Prefix for QEMU debug support commands'''
  25. def __init__(self):
  26. gdb.Command.__init__(self, 'qemu', gdb.COMMAND_DATA,
  27. gdb.COMPLETE_NONE, True)
  28. QemuCommand()
  29. coroutine.CoroutineCommand()
  30. mtree.MtreeCommand()
  31. aio.HandlersCommand()
  32. tcg.TCGLockStatusCommand()
  33. timers.TimersCommand()
  34. coroutine.CoroutineSPFunction()
  35. coroutine.CoroutinePCFunction()
  36. # Default to silently passing through SIGUSR1, because QEMU sends it
  37. # to itself a lot.
  38. gdb.execute('handle SIGUSR1 pass noprint nostop')