xref: /openbmc/qemu/scripts/qemu-gdb.py (revision ffe98631)
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
13# Usage:
14# At the (gdb) prompt, type "source scripts/qemu-gdb.py".
15# "help qemu" should then list the supported QEMU debug support commands.
16
17import gdb
18
19import os, sys
20
21# Annoyingly, gdb doesn't put the directory of scripts onto the
22# module search path. Do it manually.
23
24sys.path.append(os.path.dirname(__file__))
25
26from qemugdb import aio, mtree, coroutine, tcg, timers
27
28class QemuCommand(gdb.Command):
29    '''Prefix for QEMU debug support commands'''
30    def __init__(self):
31        gdb.Command.__init__(self, 'qemu', gdb.COMMAND_DATA,
32                             gdb.COMPLETE_NONE, True)
33
34QemuCommand()
35coroutine.CoroutineCommand()
36mtree.MtreeCommand()
37aio.HandlersCommand()
38tcg.TCGLockStatusCommand()
39timers.TimersCommand()
40
41coroutine.CoroutineSPFunction()
42coroutine.CoroutinePCFunction()
43coroutine.CoroutineBt()
44
45# Default to silently passing through SIGUSR1, because QEMU sends it
46# to itself a lot.
47gdb.execute('handle SIGUSR1 pass noprint nostop')
48