blob: 4d2a9f6c430ade56697a5d349579d733b266f823 [file] [log] [blame]
Philippe Mathieu-Daudé806c2002020-05-12 12:32:34 +02001#!/usr/bin/env python3
2#
Avi Kivity4daa1872012-03-18 16:48:44 +02003# GDB debugging support
4#
5# Copyright 2012 Red Hat, Inc. and/or its affiliates
6#
7# Authors:
8# Avi Kivity <avi@redhat.com>
9#
Paolo Bonzini328eb602019-03-11 13:13:53 +010010# 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.
Avi Kivity4daa1872012-03-18 16:48:44 +020012
Peter Maydell30c38c92015-08-14 18:46:32 +010013# Usage:
14# At the (gdb) prompt, type "source scripts/qemu-gdb.py".
15# "help qemu" should then list the supported QEMU debug support commands.
Avi Kivity4daa1872012-03-18 16:48:44 +020016
17import gdb
18
Peter Maydell93b1b362015-08-14 18:46:29 +010019import os, sys
Avi Kivity4daa1872012-03-18 16:48:44 +020020
Peter Maydell93b1b362015-08-14 18:46:29 +010021# 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
Alex Bennéec24999f2018-01-11 11:27:33 +030026from qemugdb import aio, mtree, coroutine, tcg, timers
Stefan Hajnoczi9eddd6a2015-03-26 22:42:34 +000027
Avi Kivity4daa1872012-03-18 16:48:44 +020028class 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
Avi Kivity4daa1872012-03-18 16:48:44 +020034QemuCommand()
Peter Maydell191590f2015-08-14 18:46:30 +010035coroutine.CoroutineCommand()
Peter Maydell93b1b362015-08-14 18:46:29 +010036mtree.MtreeCommand()
Dr. David Alan Gilbertc900ef82015-10-27 13:09:45 +000037aio.HandlersCommand()
Alex Bennéef1cd52d2018-01-11 11:27:11 +030038tcg.TCGLockStatusCommand()
Alex Bennéec24999f2018-01-11 11:27:33 +030039timers.TimersCommand()
Peter Maydell5e3c72d2015-08-14 18:46:31 +010040
Paolo Bonzinia201b0f2015-10-12 10:02:54 +020041coroutine.CoroutineSPFunction()
42coroutine.CoroutinePCFunction()
Maxim Levitskyb9a0de32020-12-17 17:54:36 +020043coroutine.CoroutineBt()
Paolo Bonzinia201b0f2015-10-12 10:02:54 +020044
Peter Maydell5e3c72d2015-08-14 18:46:31 +010045# Default to silently passing through SIGUSR1, because QEMU sends it
46# to itself a lot.
47gdb.execute('handle SIGUSR1 pass noprint nostop')