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