hw/s390x/s390-skeys: use memory mapping to detect which storage keys to dump
[qemu/kevin.git] / scripts / qemugdb / tcg.py
blob16c03c06a9437776d5eed962aacf598f0ceb2499
1 # -*- coding: utf-8 -*-
3 # GDB debugging support, TCG status
5 # Copyright 2016 Linaro Ltd
7 # Authors:
8 # Alex Bennée <alex.bennee@linaro.org>
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.
13 # 'qemu tcg-lock-status' -- display the TCG lock status across threads
15 import gdb
17 class TCGLockStatusCommand(gdb.Command):
18 '''Display TCG Execution Status'''
19 def __init__(self):
20 gdb.Command.__init__(self, 'qemu tcg-lock-status', gdb.COMMAND_DATA,
21 gdb.COMPLETE_NONE)
23 def invoke(self, arg, from_tty):
24 gdb.write("Thread, BQL (iothread_mutex), Replay, Blocked?\n")
25 for thread in gdb.inferiors()[0].threads():
26 thread.switch()
28 iothread = gdb.parse_and_eval("iothread_locked")
29 replay = gdb.parse_and_eval("replay_locked")
31 frame = gdb.selected_frame()
32 if frame.name() == "__lll_lock_wait":
33 frame.older().select()
34 mutex = gdb.parse_and_eval("mutex")
35 owner = gdb.parse_and_eval("mutex->__data.__owner")
36 blocked = ("__lll_lock_wait waiting on %s from %d" %
37 (mutex, owner))
38 else:
39 blocked = "not blocked"
41 gdb.write("%d/%d, %s, %s, %s\n" % (thread.num, thread.ptid[1],
42 iothread, replay, blocked))