blob: 690827e6fc62f1f71fdad173dec1219a7a1e8962 [file] [log] [blame]
Avi Kivity4daa1872012-03-18 16:48:44 +02001#!/usr/bin/python
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. See
11# the COPYING file in the top-level directory.
12#
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.
15
Peter Maydell30c38c92015-08-14 18:46:32 +010016# Usage:
17# At the (gdb) prompt, type "source scripts/qemu-gdb.py".
18# "help qemu" should then list the supported QEMU debug support commands.
Avi Kivity4daa1872012-03-18 16:48:44 +020019
20import gdb
21
Peter Maydell93b1b362015-08-14 18:46:29 +010022import os, sys
Avi Kivity4daa1872012-03-18 16:48:44 +020023
Peter Maydell93b1b362015-08-14 18:46:29 +010024# Annoyingly, gdb doesn't put the directory of scripts onto the
25# module search path. Do it manually.
26
27sys.path.append(os.path.dirname(__file__))
28
Alex Bennéec24999f2018-01-11 11:27:33 +030029from qemugdb import aio, mtree, coroutine, tcg, timers
Stefan Hajnoczi9eddd6a2015-03-26 22:42:34 +000030
Avi Kivity4daa1872012-03-18 16:48:44 +020031class 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)
36
Avi Kivity4daa1872012-03-18 16:48:44 +020037QemuCommand()
Peter Maydell191590f2015-08-14 18:46:30 +010038coroutine.CoroutineCommand()
Peter Maydell93b1b362015-08-14 18:46:29 +010039mtree.MtreeCommand()
Dr. David Alan Gilbertc900ef82015-10-27 13:09:45 +000040aio.HandlersCommand()
Alex Bennéef1cd52d2018-01-11 11:27:11 +030041tcg.TCGLockStatusCommand()
Alex Bennéec24999f2018-01-11 11:27:33 +030042timers.TimersCommand()
Peter Maydell5e3c72d2015-08-14 18:46:31 +010043
Paolo Bonzinia201b0f2015-10-12 10:02:54 +020044coroutine.CoroutineSPFunction()
45coroutine.CoroutinePCFunction()
46
Peter Maydell5e3c72d2015-08-14 18:46:31 +010047# Default to silently passing through SIGUSR1, because QEMU sends it
48# to itself a lot.
49gdb.execute('handle SIGUSR1 pass noprint nostop')