From patchwork Mon Feb 22 15:24:09 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kieran Bingham X-Patchwork-Id: 62591 Delivered-To: patch@linaro.org Received: by 10.112.43.199 with SMTP id y7csp1303429lbl; Mon, 22 Feb 2016 07:25:45 -0800 (PST) X-Received: by 10.98.87.141 with SMTP id i13mr38391202pfj.72.1456154745595; Mon, 22 Feb 2016 07:25:45 -0800 (PST) Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id we2si40323105pac.127.2016.02.22.07.25.45; Mon, 22 Feb 2016 07:25:45 -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 S1753760AbcBVPZo (ORCPT + 30 others); Mon, 22 Feb 2016 10:25:44 -0500 Received: from mail-wm0-f43.google.com ([74.125.82.43]:34790 "EHLO mail-wm0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753393AbcBVPY2 (ORCPT ); Mon, 22 Feb 2016 10:24:28 -0500 Received: by mail-wm0-f43.google.com with SMTP id b205so160408850wmb.1 for ; Mon, 22 Feb 2016 07:24: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=eZCVueW9g+9h4BJ5uRBUPb8fElKP9lm2qNeB301ddsQ=; b=jk6i/ZJJf3YLgTGCLi/uoqEAgETM/SlF3isskOpFV1c5IzSg+N0hYXuhYyqU7yyfBG 5KVlhjKRdffCtOpvOih+slAHOslQY5aJIJMl8mGp6wEyos+DxktHpckXQDMPAk17rPOw m4gfGu/8+UQCMHOz1zrCk2Jfcvae9lngbHJsk= 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=aLtds3NS5kHsVs2AA8In+fZ9vu9+sWm/NWAxGOf1MgSQWW3A2kKtnTpocYDk8fPvP0 zrf91OAKtytqA3eLRK6aI86GF8uxt5d0ZIrd50hYkTCdL/Z6BQsWTDnfKaQeJOxzdXFd psWohLgL87LUPXj4Erv6LcAwAa+Q27J5xtQfPn+KXRfx5J02uE1/e8o2TiOal30m2WGf EZoBtlpKmIgCxQIZP9Sw5phvhDDkNU4vjRQY6zUwR5B1x5F3ce3UmD23f9R29IHX9vt2 9HUEwNVZ8wx/xIZe+Zhma9keW3wAG7CweEJt/Ux+89zSyuLR+ZUsuKYbP85MhljNXhBr NkLw== X-Gm-Message-State: AG10YOQYDyN1IFiJ38uhu72Z/9eoRTZDDMMqlILklq4UXg/aTQMnu00w0nDIeUriaAssaLBG X-Received: by 10.194.58.234 with SMTP id u10mr28786925wjq.174.1456154666683; Mon, 22 Feb 2016 07:24: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 w66sm21557528wmd.2.2016.02.22.07.24.25 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 22 Feb 2016 07:24: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: [PATCH 5/8] scripts/gdb: Support !CONFIG_MODULES gracefully Date: Mon, 22 Feb 2016 15:24:09 +0000 Message-Id: <1456154652-29023-6-git-send-email-kieran.bingham@linaro.org> X-Mailer: git-send-email 2.5.0 In-Reply-To: <1456154652-29023-1-git-send-email-kieran.bingham@linaro.org> References: <1456154652-29023-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