From patchwork Wed Mar 30 12:00:42 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 64688 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2550128lbc; Wed, 30 Mar 2016 05:01:41 -0700 (PDT) X-Received: by 10.66.199.66 with SMTP id ji2mr12538425pac.34.1459339297241; Wed, 30 Mar 2016 05:01:37 -0700 (PDT) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id kd12si6145685pad.15.2016.03.30.05.01.36; Wed, 30 Mar 2016 05:01:37 -0700 (PDT) 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; dkim=pass header.i=@linaro.org; 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; dmarc=pass (p=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753118AbcC3MBT (ORCPT + 29 others); Wed, 30 Mar 2016 08:01:19 -0400 Received: from mail-wm0-f52.google.com ([74.125.82.52]:36978 "EHLO mail-wm0-f52.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752699AbcC3MBK (ORCPT ); Wed, 30 Mar 2016 08:01:10 -0400 Received: by mail-wm0-f52.google.com with SMTP id p65so68287985wmp.0 for ; Wed, 30 Mar 2016 05:01:09 -0700 (PDT) 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=oNbC4W4Zs3sNGAu+umr92YMptsqNXMwMErHihW14wGo=; b=adVKC7fgwX5pAi89VAgnCjbMezZ9ln7s0VRLK2m8pzQ8mn91HKLqemM2619dYGvQ94 E260W3Tmvjs0dsnglgTB51okyuJV/RjOlt4jktuNvpHQe4YwabkvkQprKk4Q3ApF98z9 JvumhbGzdipbqKJ7PmtcxDiKJfV44x1ktnk9A= 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=oNbC4W4Zs3sNGAu+umr92YMptsqNXMwMErHihW14wGo=; b=GowekDucy4z45ChqM4z2fF2l9lxxpSu7H8yYZPjSUzBhDSOdo58Cn4XrnEqtLLzgv1 Y6fuBlNmuRCmRW16jxVFyz15tf98rEic+GF4rAmH7VdDFbDXIGnaxjX+7KKsa9P71Iel TeK5TMoTmgAKecBatW5uexWs3f7+o0xOCo06UAAsR1jrY4HP290gbIfwwmeZ0GyhHtg8 TWac9hBtunTlmPgcsYH+YdGkEF+6v3X09C0KCRb4js4+S4BTDV/X+jzfKjzBTAYjkUyd YBVAv7yacK8dt59qYAmMyhhWXsEgowqrQR5YaAEQ+ci9wYa8x0wIOwk6EWmP18Jra0M9 d5Dw== X-Gm-Message-State: AD7BkJL4uHm4+auGRgXhv+S9SSrtlyYiqODGMtJGfMGudg/kPR/4PyvK9aVAlwx32aDb7xPp X-Received: by 10.194.21.102 with SMTP id u6mr9003327wje.124.1459339268998; Wed, 30 Mar 2016 05:01:08 -0700 (PDT) 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 e190sm1175530wma.15.2016.03.30.05.01.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 05:01:08 -0700 (PDT) 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: [PATCHv4 03/12] scripts/gdb: Convert modules usage to lists functions Date: Wed, 30 Mar 2016 13:00:42 +0100 Message-Id: <1459339251-29611-4-git-send-email-kieran.bingham@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1459339251-29611-1-git-send-email-kieran.bingham@linaro.org> References: <1459339251-29611-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 Simplify the module list functions with the new list_for_each_entry abstractions Signed-off-by: Kieran Bingham --- scripts/gdb/linux/modules.py | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) -- 2.5.0 diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 0a35d6dbfb80..6d9e1199ce57 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -13,7 +13,7 @@ import gdb -from linux import cpus, utils +from linux import cpus, utils, lists module_type = utils.CachedType("struct module") @@ -23,12 +23,9 @@ def module_list(): global module_type module_ptr_type = module_type.get_type().pointer() modules = gdb.parse_and_eval("modules") - entry = modules['next'] - end_of_list = modules.address - while entry != end_of_list: - yield utils.container_of(entry, module_ptr_type, "list") - entry = entry['next'] + for module in lists.list_for_each_entry(modules, module_ptr_type, "list"): + yield module def find_module_by_name(name): @@ -80,17 +77,15 @@ class LxLsmod(gdb.Command): size=str(layout['size']), ref=str(module['refcnt']['counter']))) - source_list = module['source_list'] t = self._module_use_type.get_type().pointer() - entry = source_list['next'] first = True - while entry != source_list.address: - use = utils.container_of(entry, t, "source_list") + sources = module['source_list'] + for use in lists.list_for_each_entry(sources, t, "source_list"): gdb.write("{separator}{name}".format( separator=" " if first else ",", name=use['source']['name'].string())) first = False - entry = entry['next'] + gdb.write("\n")