From patchwork Thu Mar 3 11:40:59 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 63463 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2894084lbc; Thu, 3 Mar 2016 03:41:50 -0800 (PST) X-Received: by 10.98.16.198 with SMTP id 67mr2921043pfq.21.1457005310598; Thu, 03 Mar 2016 03:41:50 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id qp8si41478619pac.244.2016.03.03.03.41.50; Thu, 03 Mar 2016 03:41:50 -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 S1757414AbcCCLlc (ORCPT + 30 others); Thu, 3 Mar 2016 06:41:32 -0500 Received: from mail-wm0-f41.google.com ([74.125.82.41]:32875 "EHLO mail-wm0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756860AbcCCLlW (ORCPT ); Thu, 3 Mar 2016 06:41:22 -0500 Received: by mail-wm0-f41.google.com with SMTP id l68so30809203wml.0 for ; Thu, 03 Mar 2016 03:41:22 -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=eZCVueW9g+9h4BJ5uRBUPb8fElKP9lm2qNeB301ddsQ=; b=bVUQFodROmnr7wuOglk0s8uXeZlh3OCkRtgE/2XF5jshUZO4xupdKFIrYBLWmgRre4 LRRpw+vtoaEkIXJG+b3+UkD2K3JxyClUxtSDOPPr53uzXkYBqjHJ2MgvW27kJh1AvFoR UDxOAr/4xGCcU3WxEs2K9gdgarwTRDubeR2K4= 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=eZCVueW9g+9h4BJ5uRBUPb8fElKP9lm2qNeB301ddsQ=; b=WoQ/EDbcC0DSePq/kdkzSOzSZBNhGNna7wUd4uwaF4vq1bpIVQ0KErMaaIZfVaaTpN HSMbqJbs9iDhWUlarE5hXa57D62j381gwvnaNDtamnTN77q+r9MX4jNV+VLvVt0Rk1tg wTX27j7RZlXyIW5/vVytFkSW4vPJh3ZzZAXDKH32DVZKZfDS1b6d9YBPm7XKgmtBi9ON jtknQ1snvnsOyYD97bLiO3NnLidT8FChuEamgfpXy3yDzzjxfmYlwpPUTMnKnZD7V5Er 6ty/IsoDADqn/Kfr/OWlnmI575Cna05C45b6UwBqPweCsAOrXclWOSe7+/wa05wToJo6 3XBg== X-Gm-Message-State: AD7BkJL1MLKW2lTsPS2Bi+Q53kjd5vkJIs5Wd9rmCLrXOviNzzmpMxn5sFbgtn52dMGLGtp8 X-Received: by 10.194.123.102 with SMTP id lz6mr2778897wjb.2.1457005281707; Thu, 03 Mar 2016 03:41:21 -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.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 03 Mar 2016 03:41:21 -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 05/13] scripts/gdb: Support !CONFIG_MODULES gracefully Date: Thu, 3 Mar 2016 11:40:59 +0000 Message-Id: <1457005267-843-6-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 If CONFIG_MODULES is not enabled, lx-lsmod tries to find a non-existent symbol and generates an unfriendly traceback: (gdb) lx-lsmod Address Module Size Used by Traceback (most recent call last): File "scripts/gdb/linux/modules.py", line 75, in invoke for module in module_list(): File "scripts/gdb/linux/modules.py", line 24, in module_list module_ptr_type = module_type.get_type().pointer() File "scripts/gdb/linux/utils.py", line 28, in get_type self._type = gdb.lookup_type(self._name) gdb.error: No struct type named module. Error occurred in Python command: No struct type named module. Catch the error and return an empty module_list() for a clean command output as follows: (gdb) lx-lsmod Address Module Size Used by (gdb) Signed-off-by: Kieran Bingham --- scripts/gdb/linux/modules.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) -- 2.5.0 diff --git a/scripts/gdb/linux/modules.py b/scripts/gdb/linux/modules.py index 571489b3b9c2..60224d8bbfb2 100644 --- a/scripts/gdb/linux/modules.py +++ b/scripts/gdb/linux/modules.py @@ -21,8 +21,11 @@ module_type = utils.CachedType("struct module") def module_list(): global module_type + modules = utils.gdb_eval_or_none("modules") + if modules is None: + return + module_ptr_type = module_type.get_type().pointer() - modules = gdb.parse_and_eval("modules") for module in lists.list_for_each_entry(modules, module_ptr_type, "list"): yield module