From nobody Tue Oct 28 01:57:59 2025 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) client-ip=208.118.235.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Authentication-Results: mx.zohomail.com; dkim=fail; spf=pass (zoho.com: domain of gnu.org designates 208.118.235.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org Return-Path: Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) by mx.zohomail.com with SMTPS id 1516114730496738.3190279382646; Tue, 16 Jan 2018 06:58:50 -0800 (PST) Received: from localhost ([::1]:39470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebShN-0002jF-LR for importer@patchew.org; Tue, 16 Jan 2018 09:58:49 -0500 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50664) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebS4N-0003OK-Lv for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1ebS4H-00055n-Qz for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:31 -0500 Received: from mail-wm0-x241.google.com ([2a00:1450:400c:c09::241]:44170) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1ebS4H-00054A-JZ for qemu-devel@nongnu.org; Tue, 16 Jan 2018 09:18:25 -0500 Received: by mail-wm0-x241.google.com with SMTP id t74so8752398wme.3 for ; Tue, 16 Jan 2018 06:18:25 -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 u10sm1537758wrg.6.2018.01.16.06.18.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 16 Jan 2018 06:18:23 -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=nM5x7nn6gBUN79XLiJu7Jfxk/UEegVHCqc7JSXTe0hE=; b=rnYEapmb0GG+0d8XSTitKJMs3WekyyFozMTB4eJYzAIQ3i4s73XFkGeWWTd6IEKWeM /Saxg7o0z070A+Rf1UiwRWcSAX7hFQX4cn4D+AjYZk7RqaaVL+ASJu3Y0cXXbe6K7eoT vFnrdW8ac0vsBtiE9Z9P3imnGb6ji+ogWS+nUymaIkNQPOlOyds5djwaH0XejQMF2G0s fK+xzcTnR8U/m9M3us3SPrqxv9SFijxENmNKmOEznFLWBrJQbI1zFhLz8+ZyWM2Jy4bp HcBUvQQSVJt4epixTGLOsZShKaw+mqG5DpUz4pV6FvAL4WaGpYIRbNxQUokJA2SdTJ3m kG7w== 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=nM5x7nn6gBUN79XLiJu7Jfxk/UEegVHCqc7JSXTe0hE=; b=k2pWRd4g/kXZvBqICnlhdQMQsYsPh6FAWU1YlNesOfEawQgKOi5tEjrF0MmEfxRJkb kvME3gc0ZdQetuKuPDjAolcLwOpWijps+MJjF1vjORKfSxir+w6TNFUuoEumqFDAYk7e 5rla1OQktJIiTYQsD6xv1+F1n1RpLT0Zu6ZDscQ2A76q/n04iCQIyi3p3LK8oTy7ECSI Z4V1tv+xUTMXWOj7UoJq28lVLFS7tent/POK5tv93g6uO/6IozANg4b8nYs11sAk4nDN MDNwD2xy6F5WDo8FR4f8DOoxh/V6lrkG1U12pJ+Rcunrr7Z6YXxCwWeKZ3gjSvN9KxBr 1s7A== X-Gm-Message-State: AKwxytdHjlxjn3O/UCaEAzlmk1HWpjuUN88TBfkL6TGuhHRi3iqeqW92 ERaAz7Mxc/+XT38tWmZ+zlne72QQ X-Google-Smtp-Source: ACJfBouORisczAyBCsnV9KwCixA+C7+e7xUTOq3+WgPo45fVSwOAel+eHuG9LJVw6/6NwZM5EvRs5g== X-Received: by 10.28.129.212 with SMTP id c203mr13009478wmd.98.1516112304252; Tue, 16 Jan 2018 06:18:24 -0800 (PST) From: Paolo Bonzini To: qemu-devel@nongnu.org Date: Tue, 16 Jan 2018 15:17:16 +0100 Message-Id: <1516112253-14480-35-git-send-email-pbonzini@redhat.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> References: <1516112253-14480-1-git-send-email-pbonzini@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:400c:c09::241 Subject: [Qemu-devel] [PULL 34/51] 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=20Benn=C3=A9e?= Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: "Qemu-devel" X-ZohoMail-DKIM: fail (Header signature does not verify) X-ZohoMail: RDKM_2 RSF_0 Z_629925259 SPT_0 From: Alex Benn=C3=A9e 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=C3=A9e Reviewed-by: Philippe Mathieu-Daud=C3=A9 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 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 =20 sys.path.append(os.path.dirname(__file__)) =20 -from qemugdb import aio, mtree, coroutine, tcg +from qemugdb import aio, mtree, coroutine, tcg, timers =20 class QemuCommand(gdb.Command): '''Prefix for QEMU debug support commands''' @@ -39,6 +39,7 @@ coroutine.CoroutineCommand() mtree.MtreeCommand() aio.HandlersCommand() tcg.TCGLockStatusCommand() +timers.TimersCommand() =20 coroutine.CoroutineSPFunction() coroutine.CoroutinePCFunction() diff --git a/scripts/qemugdb/timers.py b/scripts/qemugdb/timers.py new file mode 100644 index 0000000..be71a00 --- /dev/null +++ b/scripts/qemugdb/timers.py @@ -0,0 +1,54 @@ +#!/usr/bin/python +# GDB debugging support +# +# Copyright 2017 Linaro Ltd +# +# Author: Alex Benn=C3=A9e +# +# 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 =3D 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") --=20 1.8.3.1