1 # -*- coding: utf-8 -*-
3 # GDB debugging support, TCG status
5 # Copyright 2016 Linaro Ltd
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
17 class TCGLockStatusCommand(gdb
.Command
):
18 '''Display TCG Execution Status'''
20 gdb
.Command
.__init
__(self
, 'qemu tcg-lock-status', gdb
.COMMAND_DATA
,
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():
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" %
39 blocked
= "not blocked"
41 gdb
.write("%d/%d, %s, %s, %s\n" % (thread
.num
, thread
.ptid
[1],
42 iothread
, replay
, blocked
))