From patchwork Thu Mar 3 11:41:04 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 63468 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2895289lbc; Thu, 3 Mar 2016 03:44:26 -0800 (PST) X-Received: by 10.67.12.175 with SMTP id er15mr2961056pad.70.1457005466386; Thu, 03 Mar 2016 03:44:26 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 13si6664048pft.59.2016.03.03.03.44.26; Thu, 03 Mar 2016 03:44:26 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dkim=pass header.i=@linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757600AbcCCLoS (ORCPT + 30 others); Thu, 3 Mar 2016 06:44:18 -0500 Received: from mail-wm0-f45.google.com ([74.125.82.45]:32967 "EHLO mail-wm0-f45.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756977AbcCCLl1 (ORCPT ); Thu, 3 Mar 2016 06:41:27 -0500 Received: by mail-wm0-f45.google.com with SMTP id l68so30812314wml.0 for ; Thu, 03 Mar 2016 03:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=LGFrA+O2sF6DXFwI1XSPV0wp4kXMR29BjoKI+JNEDTI=; b=YqeLHFUYbwLblguPrWWHkjdzqCq7v+db+yyCBoe24FzQOe2oh2G1qcb0IB/ktA7z8k ZNCvAxnemjO7KfhZGKec8SFt2rk9T5ApGX1dXEaQA9z+dW5jolweUXqFSrirtTDU4Kku qhvX+BGA0kpI+mZhZlR9HvruPs5lgW3zgsRxo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=LGFrA+O2sF6DXFwI1XSPV0wp4kXMR29BjoKI+JNEDTI=; b=fTxT2pNy03qlzMUX7TVpmSTDKa1B9qG+r062fqFZptsvrpzYsPU0sJwItw4+16PmlD zbaNQeId4aciugaQFvu385MhpAy220Nc1u24Q75Zih2Z3FX/EapzSZYkOj05yifAamsF disYwcKrSPYTCc8Rv3bNmtQljsqPtyLiHPwD7XJ2gN5s3ae2ehp9OSxkjkKOB2to3U7W wUdbo3Zia+bWVQt+9tMUW25Sx6VdxZcMa4fo74CqUjwHjw81iHKAUBaSJHdODYYLKKVU xfQj6QTfHwcl6bPvtlT537t1UxC5LQ0uWUaTb1cZYB7fvO0Tgrpci2243s6JPxKidGzK V3aw== X-Gm-Message-State: AD7BkJIKb94GBCMRABM1IAIQ7WuHBNQ7NwqHra45m3fBwIZ/U/WrA13DVK2qezapGcTfNKkC X-Received: by 10.28.6.71 with SMTP id 68mr3021269wmg.41.1457005286397; Thu, 03 Mar 2016 03:41:26 -0800 (PST) Received: from localhost.localdomain (cpc87017-aztw30-2-0-cust65.18-1.cable.virginm.net. [92.232.232.66]) by smtp.gmail.com with ESMTPSA id e19sm8570696wmd.1.2016.03.03.03.41.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Mar 2016 03:41:26 -0800 (PST) From: Kieran Bingham To: jan.kiszka@siemens.com, linux-kernel@vger.kernel.org Cc: lee.jones@linaro.org, peter.griffin@linaro.org, maxime.coquelin@st.com, Kieran Bingham Subject: [PATCHv3 10/13] scripts/gdb: Add cpu iterators Date: Thu, 3 Mar 2016 11:41:04 +0000 Message-Id: <1457005267-843-11-git-send-email-kieran.bingham@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1457005267-843-1-git-send-email-kieran.bingham@linaro.org> References: <1457005267-843-1-git-send-email-kieran.bingham@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The linux kernel provides macro's for iterating against values from the cpu_list masks. By providing some commonly used masks, we can mirror the kernels helper macros with easy to use generators. Signed-off-by: Kieran Bingham --- scripts/gdb/linux/cpus.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) -- 2.5.0 diff --git a/scripts/gdb/linux/cpus.py b/scripts/gdb/linux/cpus.py index 4297b83fedef..59e24472c507 100644 --- a/scripts/gdb/linux/cpus.py +++ b/scripts/gdb/linux/cpus.py @@ -100,6 +100,27 @@ def cpu_list(mask_name): yield cpu +def each_online_cpu(): + for cpu in cpu_list("cpu_online_mask"): + yield cpu + + +def each_present_cpu(): + for cpu in cpu_list("cpu_present_mask"): + yield cpu + + +def each_possible_cpu(): + for cpu in cpu_list("cpu_possible_mask"): + yield cpu + + +def print_cpus(): + gdb.write("Possible CPUS : {}\n".format(list(each_possible_cpu()))) + gdb.write("Present CPUS : {}\n".format(list(each_present_cpu()))) + gdb.write("Online CPUS : {}\n".format(list(each_online_cpu()))) + + class PerCpu(gdb.Function): """Return per-cpu variable.