From patchwork Wed Mar 30 12:00:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 64686 Delivered-To: patch@linaro.org Received: by 10.112.199.169 with SMTP id jl9csp2550075lbc; Wed, 30 Mar 2016 05:01:36 -0700 (PDT) X-Received: by 10.98.19.82 with SMTP id b79mr12492404pfj.17.1459339296148; Wed, 30 Mar 2016 05:01:36 -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.35; Wed, 30 Mar 2016 05:01:36 -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 S1752945AbcC3MBP (ORCPT + 29 others); Wed, 30 Mar 2016 08:01:15 -0400 Received: from mail-wm0-f49.google.com ([74.125.82.49]:34890 "EHLO mail-wm0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752855AbcC3MBM (ORCPT ); Wed, 30 Mar 2016 08:01:12 -0400 Received: by mail-wm0-f49.google.com with SMTP id 191so86549835wmq.0 for ; Wed, 30 Mar 2016 05:01:11 -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=4SkMXuU4wFFTTDNZknd3swWCXBbKT3xS9zM14G0z+BI=; b=e2ZCdz7KHzDpLD/jLi28v5iniWeqGSiMj6Id8B10UWczy8Pa6FRbnnMw4Hn8rhRwRi UXWjZDI6ctiQkDJmXNhA5F+I535nouxaMYrdc+G5jDoA3RUOChUzSnRGgr49DLK/qNc1 2cMKg+5e5qbn0GZt7ZnMNkHillq4wNeCjApLE= 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=4SkMXuU4wFFTTDNZknd3swWCXBbKT3xS9zM14G0z+BI=; b=WX/D0F8FIVdwK34VZ+57zpF38p+DIvgxntRacHQqRlt0pUVB+2CTtBnO3GIEXyuilg cv9c7zaWE0EEMdJ+T+BtXCjnwLNkRvUqUYg/ZbQ8pernkbbDArf9H1hIFFiGoLue45dA UZw3aX8B5eXFly57JoB6Ss3sIqIB8ihsZKwi5FDOd/zXJWAQGszaL42xkAMegPt0sgGV fvFbyeYJ4BZc/5J5NSIE+fgZUe6oyDfch77dJviP8pqIK6pK+VZvFSZo0XzQiNAZYDLG Zx7ubeTThiQT1qAepEpgk4sBZfkVRl0vfdEu7juZmn2x7EAQ6+EeBqfahORJ/2uY45xv N7Kw== X-Gm-Message-State: AD7BkJKgmIyr8n1yTN0ZK8eqCygLjo0FwcziY6SLfUjEy9Oof32ScTvmV0g8LARJj6y/qQcW X-Received: by 10.28.4.131 with SMTP id 125mr9307074wme.44.1459339270991; Wed, 30 Mar 2016 05:01:10 -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.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 30 Mar 2016 05:01:10 -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 05/12] scripts/gdb: Support !CONFIG_MODULES gracefully Date: Wed, 30 Mar 2016 13:00:44 +0100 Message-Id: <1459339251-29611-6-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 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 6d9e1199ce57..61cc8a533cd8 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