2
0

qemu-gdb.py 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546
  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 or
  10. # later. See the COPYING file in the top-level directory.
  11. # Usage:
  12. # At the (gdb) prompt, type "source scripts/qemu-gdb.py".
  13. # "help qemu" should then list the supported QEMU debug support commands.
  14. import gdb
  15. import os, sys
  16. # Annoyingly, gdb doesn't put the directory of scripts onto the
  17. # module search path. Do it manually.
  18. sys.path.append(os.path.dirname(__file__))
  19. from qemugdb import aio, mtree, coroutine, tcg, timers
  20. class QemuCommand(gdb.Command):
  21. '''Prefix for QEMU debug support commands'''
  22. def __init__(self):
  23. gdb.Command.__init__(self, 'qemu', gdb.COMMAND_DATA,
  24. gdb.COMPLETE_NONE, True)
  25. QemuCommand()
  26. coroutine.CoroutineCommand()
  27. mtree.MtreeCommand()
  28. aio.HandlersCommand()
  29. tcg.TCGLockStatusCommand()
  30. timers.TimersCommand()
  31. coroutine.CoroutineSPFunction()
  32. coroutine.CoroutinePCFunction()
  33. # Default to silently passing through SIGUSR1, because QEMU sends it
  34. # to itself a lot.
  35. gdb.execute('handle SIGUSR1 pass noprint nostop')