From patchwork Fri Jan 12 11:31:00 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 124305 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1968484qgn; Fri, 12 Jan 2018 03:59:31 -0800 (PST) X-Google-Smtp-Source: ACJfBovfPgzhd+PfcW2Tbro0G9C6Kg2KQKiL4sKj5R59VCmc27+XMJCBcCJpzt530EYo81hZ6glf X-Received: by 10.37.61.135 with SMTP id k129mr1233582yba.149.1515758371419; Fri, 12 Jan 2018 03:59:31 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1515758371; cv=none; d=google.com; s=arc-20160816; b=DIqii8zqCpV+Zf40zvbth2U6/dInPzSvgcwNUuf7kVfhRqiqxwSAwXiQMKlw8O9deX nW2TUpo4+klSSgJbR1gWGxRsAvxiD3dc8bHDqAw7nH71MfUA3JdHT4ufQKQbMpH9WhpA 1DAue4dzH8MkEZzKOu4xAMj6pwSCek2dJY6fs/1ktoLO7xMHO8d3IiQyB45oYHQmRFGr uMllAu/xHItmW+49yqkOh8970OjRQZJfkHo7JAtjaKZHtjWG6HCNrBJ5VB3mFjS2Eva+ 5ZVtJSm+Nec8P3A+04+FyFlrvRMg+jkIRn6Hv5iacV5GgvrDn8bVMdI78u3lG97kQ/5Z M9/A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:subject :content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:to:from:dkim-signature:arc-authentication-results; bh=IZajmzx9rYLPKOH9/4/XmxvTKJQx6xsNJtYxUYRx2LM=; b=STrAS9GhfjQbfGdGJwRPDSIZsXg11QZpsl/4+f63SwpigzlBd7ziqOVGKQqDNTwcZz iu8A7TVefDEGalGByyO3AIAoSIno81UYIi1faNVIgzjLGiAc02+cqN/Yh3nCJt0a0NA0 kN1Rj9D2Ad8G6ilYwzlV2cka0VGISm8E/w28Bw1/oSB2D0/skZnS9AlFbK3lmDwtlyBv ssRLCrZDQaIFsInPaDu2x9NG8Wf/O3NcmGd4+qNdYctTgJB3/qQa7h9LQLZ7BYASKv0L k05XiAE1JNPgQ+1BVth5docBMLS4Dzig7X8TBmBVBFDjaAorisO5r8JwWtXLMii1DlVb MnyA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=R8sdTAro; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [2001:4830:134:3::11]) by mx.google.com with ESMTPS id v124si1343163ywf.321.2018.01.12.03.59.31 for (version=TLS1 cipher=AES128-SHA bits=128/128); Fri, 12 Jan 2018 03:59:31 -0800 (PST) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) client-ip=2001:4830:134:3::11; Authentication-Results: mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=R8sdTAro; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 2001:4830:134:3::11 as permitted sender) smtp.mailfrom=qemu-devel-bounces+patch=linaro.org@nongnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1]:35687 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZxze-0006yi-St for patch@linaro.org; Fri, 12 Jan 2018 06:59:30 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:41931) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1eZxZ5-0007ky-Mm for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:04 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1eZxZ4-0005mc-L6 for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:03 -0500 Received: from mail-wr0-x234.google.com ([2a00:1450:400c:c0c::234]:33976) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1eZxZ4-0005mL-Db for qemu-devel@nongnu.org; Fri, 12 Jan 2018 06:32:02 -0500 Received: by mail-wr0-x234.google.com with SMTP id 36so5058150wrh.1 for ; Fri, 12 Jan 2018 03:32:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=IZajmzx9rYLPKOH9/4/XmxvTKJQx6xsNJtYxUYRx2LM=; b=R8sdTAroFYJtMmPIxzGXa4EM7D7FMbpvhcS7IJ/62hZnYsCHYtqUTs+8Aw6EGTmVTY 2Bwx68Q4V5bxKWgGPWIGV4UrlcpiFpytIGS+2nRDVQwJOb3+HOeAFlh3lyidshW9YOoz HfGGlUtJcJH9iAwY1h4xke+pWMhQXeH7FczHb6Xa2T76I7KKH6XhexUsJtyjdBzYpuzd 9gpgUiykDDMi53WBQwZps1cHSPSYMrqlQni/cuYYuWwy3H+QPsEcGUD/+CYbO4DhFIuJ bHGRO5SA6sqb+TSLcE4rvN0MS48Qh5VpgLl8J5SMP6gR5rbAs7MMWX/qBT3jWn2r8IzK fxgQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; bh=IZajmzx9rYLPKOH9/4/XmxvTKJQx6xsNJtYxUYRx2LM=; b=ALgCNYc74XNsrsSMYTfY8jHMpEU3Xx0laV2U3UNZG14af3oKSx8tQ6xMIKhmdryBco oZSeXUrAeEALHN5ukW0pAmNLJUjMEJ/lkDnodqIeQwA8wkJXTKPDzgbVxLbVJaTdPc/L GLuNl5pNoDoR2URdTk0rLvgQ/HNQQ+MRog3jfh/1p6+v2w5HMMvj9ttLUjg97plrYaBQ NnostZJ9uKpx706TftTT/TEXvkvSz66x8dUwswys0zoY/1lqRSlu2+1UbRGrlPslCu9h N4ha2Xy2wXeZIQ3z/IZ6r7SuuekQydhbdOpYvLxBD6lXibDafpdnFc7Ks8Uo+mmHt6HR mVjw== X-Gm-Message-State: AKGB3mJUq9ipPxvxd66HlZCBbuZHPS1x4tZmt6U74H6IocWuY7f45j75 w4IkF8859jmu1F7RpHHUbfUqOdZv X-Received: by 10.223.160.139 with SMTP id m11mr22577963wrm.119.1515756721089; Fri, 12 Jan 2018 03:32:01 -0800 (PST) Received: from 640k.lan (dynamic-adsl-78-12-229-84.clienti.tiscali.it. [78.12.229.84]) by smtp.gmail.com with ESMTPSA id l8sm2732271wmg.46.2018.01.12.03.32.00 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 12 Jan 2018 03:32:00 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Fri, 12 Jan 2018 12:31:00 +0100 Message-Id: <1515756676-3860-37-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1515756676-3860-1-git-send-email-pbonzini@redhat.com> References: <1515756676-3860-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c0c::234 Subject: [Qemu-devel] [PULL 36/52] scripts/qemu-gdb/timers.py: new helper to dump timer state X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: =?utf-8?q?Alex_Benn=C3=A9e?= Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: "Qemu-devel" From: Alex Bennée This introduces the qemu-gdb command "qemu timers" which will dump the state of the main timers in the system. Signed-off-by: Alex Bennée Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Paolo Bonzini --- scripts/qemu-gdb.py | 3 ++- scripts/qemugdb/timers.py | 54 +++++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+), 1 deletion(-) create mode 100644 scripts/qemugdb/timers.py -- 1.8.3.1 diff --git a/scripts/qemu-gdb.py b/scripts/qemu-gdb.py index d58213e..690827e 100644 --- a/scripts/qemu-gdb.py +++ b/scripts/qemu-gdb.py @@ -26,7 +26,7 @@ import os, sys sys.path.append(os.path.dirname(__file__)) -from qemugdb import aio, mtree, coroutine, tcg +from qemugdb import aio, mtree, coroutine, tcg, timers class QemuCommand(gdb.Command): '''Prefix for QEMU debug support commands''' @@ -39,6 +39,7 @@ coroutine.CoroutineCommand() mtree.MtreeCommand() aio.HandlersCommand() tcg.TCGLockStatusCommand() +timers.TimersCommand() coroutine.CoroutineSPFunction() coroutine.CoroutinePCFunction() diff --git a/scripts/qemugdb/timers.py b/scripts/qemugdb/timers.py new file mode 100644 index 0000000..98ab7c6 --- /dev/null +++ b/scripts/qemugdb/timers.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# GDB debugging support +# +# Copyright 2017 Linaro Ltd +# +# Author: Alex Bennée +# +# This work is licensed under the terms of the GNU GPL, version 2. See +# the COPYING file in the top-level directory. + +# 'qemu timers' -- display the current timerlists + +import gdb + +class TimersCommand(gdb.Command): + '''Display the current QEMU timers''' + + def __init__(self): + 'Register the class as a gdb command' + gdb.Command.__init__(self, 'qemu timers', gdb.COMMAND_DATA, + gdb.COMPLETE_NONE) + + def dump_timers(self, timer): + "Follow a timer and recursively dump each one in the list." + # timer should be of type QemuTimer + gdb.write(" timer %s/%s (cb:%s,opq:%s)\n" % ( + timer['expire_time'], + timer['scale'], + timer['cb'], + timer['opaque'])) + + if int(timer['next']) > 0: + self.dump_timers(timer['next']) + + + def process_timerlist(self, tlist, ttype): + gdb.write("Processing %s timers\n" % (ttype)) + gdb.write(" clock %s is enabled:%s, last:%s\n" % ( + tlist['clock']['type'], + tlist['clock']['enabled'], + tlist['clock']['last'])) + if int(tlist['active_timers']) > 0: + self.dump_timers(tlist['active_timers']) + + + def invoke(self, arg, from_tty): + 'Run the command' + main_timers = gdb.parse_and_eval("main_loop_tlg") + + # This will break if QEMUClockType in timer.h is redfined + self.process_timerlist(main_timers['tl'][0], "Realtime") + self.process_timerlist(main_timers['tl'][1], "Virtual") + self.process_timerlist(main_timers['tl'][2], "Host") + self.process_timerlist(main_timers['tl'][3], "Virtual RT")