From patchwork Tue Jan 16 14:17:16 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Paolo Bonzini X-Patchwork-Id: 124725 Delivered-To: patch@linaro.org Received: by 10.46.64.148 with SMTP id r20csp1041414lje; Tue, 16 Jan 2018 06:59:39 -0800 (PST) X-Google-Smtp-Source: ACJfBosxWRhl+FCrjI9be1zZsvkFJ1tjfc94qFybesik5qltAoCKBkf8APqHG4tAL+IaCq4Mdg62 X-Received: by 10.37.51.136 with SMTP id z130mr25766533ybz.445.1516114779506; Tue, 16 Jan 2018 06:59:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516114779; cv=none; d=google.com; s=arc-20160816; b=LKcrR+Vuf15rDGZf3i0mth85CFXsalwCoeT0SmA+Ugj+ub3tEfx9FK0e2HvDdzYM05 W1/TvHAB/jljYSFBNkKHMyOGpvPmIxbI4TZ+j1L0XGDGbywyPgGa97VpHX6WG0c9k96I wfG8KT2AOujva1CJvFmFQBilJepPv1XfT+uoGfbXl/eUFrX6C8PrGtj0pHhzg89KItQo xJzg04/gidIbN3p0PKHVrKOFJHc+EEYXiZQTC6E/G6/EmdBWCpM34ooqmZkAdk3zeN3/ 9zldU7foNz/deCvD3Jn7VH4wsmyFdjQUp/4p9p1K2mzlnAdThzyGAVOURUw7F2jCKKTe IlAQ== 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=nM5x7nn6gBUN79XLiJu7Jfxk/UEegVHCqc7JSXTe0hE=; b=tseHlqOtm//NcVSUdTXM9AOzi9C6NhhxFNugYLK28TvuvAP6N1RMDQ/cGVMvMy9kKT aapiwzQTagve/ibjZwftF4/xvJPwN9xibk5mZDA2G/ylYNPvc9xq9xPhGEVv+xZ7KPgi ahK1SWBfCYFfKhxP0jW+g8Bhr7VTSSoxrDqtLJSq0gRaU6UEZDSeBJ+LlrslvKawt6MM yNMx1wmTOgMXlSLajPbFYhcNS7nUPF4vfZ+vVfnVqAxDzLw4bflX6Qd7SSdO7IodPvQM hSE4cl6SgsKED6C1OSECqjgMIszGbW8wDN+Wia5xsj5M9llBwqINc1uIDK2lwqcbLQzM p3vg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@gmail.com header.s=20161025 header.b=rnYEapmb; 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 e11si540137ybk.263.2018.01.16.06.59.39 for (version=TLS1 cipher=AES128-SHA bits=128/128); Tue, 16 Jan 2018 06:59:39 -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=rnYEapmb; 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]:39470 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1ebSiA-0002jF-QO for patch@linaro.org; Tue, 16 Jan 2018 09:59:38 -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) 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-Received: by 10.28.129.212 with SMTP id c203mr13009478wmd.98.1516112304252; Tue, 16 Jan 2018 06:18:24 -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) 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 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_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..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é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")