]> git.proxmox.com Git - mirror_qemu.git/blame - scripts/qemugdb/tcg.py
Merge remote-tracking branch 'remotes/stefanberger/tags/pull-tpm-2019-07-08-1' into...
[mirror_qemu.git] / scripts / qemugdb / tcg.py
CommitLineData
f1cd52d8
AB
1#!/usr/bin/python
2# -*- coding: utf-8 -*-
3#
4# GDB debugging support, TCG status
5#
6# Copyright 2016 Linaro Ltd
7#
8# Authors:
9# Alex Bennée <alex.bennee@linaro.org>
10#
328eb60d
PB
11# This work is licensed under the terms of the GNU GPL, version 2 or
12# later. See the COPYING file in the top-level directory.
f1cd52d8
AB
13
14# 'qemu tcg-lock-status' -- display the TCG lock status across threads
15
16import gdb
17
18class TCGLockStatusCommand(gdb.Command):
19 '''Display TCG Execution Status'''
20 def __init__(self):
21 gdb.Command.__init__(self, 'qemu tcg-lock-status', gdb.COMMAND_DATA,
22 gdb.COMPLETE_NONE)
23
24 def invoke(self, arg, from_tty):
25 gdb.write("Thread, BQL (iothread_mutex), Replay, Blocked?\n")
26 for thread in gdb.inferiors()[0].threads():
27 thread.switch()
28
29 iothread = gdb.parse_and_eval("iothread_locked")
30 replay = gdb.parse_and_eval("replay_locked")
31
32 frame = gdb.selected_frame()
33 if frame.name() == "__lll_lock_wait":
34 frame.older().select()
35 mutex = gdb.parse_and_eval("mutex")
36 owner = gdb.parse_and_eval("mutex->__data.__owner")
37 blocked = ("__lll_lock_wait waiting on %s from %d" %
38 (mutex, owner))
39 else:
40 blocked = "not blocked"
41
42 gdb.write("%d/%d, %s, %s, %s\n" % (thread.num, thread.ptid[1],
43 iothread, replay, blocked))