qemu-gdb.py 1.2 KB

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