Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp1625096rwb; Wed, 14 Dec 2022 12:38:21 -0800 (PST) X-Google-Smtp-Source: AA0mqf6/l91jmq6OW0LVsFdrJRz8SI9HreAhXzVsdEIzpTqcZKDORzsR0hV/yJKUss/E6AW9I9+5 X-Received: by 2002:a62:3846:0:b0:577:7cfb:a896 with SMTP id f67-20020a623846000000b005777cfba896mr29354867pfa.31.1671050301473; Wed, 14 Dec 2022 12:38:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671050301; cv=none; d=google.com; s=arc-20160816; b=gFTgu+Ff18XCVAj5Gv/uEvv7RU4deWFZ4e0K3rvJQLz69LYMvECgPAYHVvG8Q+Z604 XSxNscA2MX0kzY3n2T5uUX394kVf0qo6xSYI8ExOV/cFwqIUAREStCgQNDnNw2UcGyS5 6SNSKMsUyMUA1FdbAkfaa9OTqXGLHNs+HCzHqBAoQEovnav4cCmf/giSV0O/BJBacCLf /9hchcUix4AybJBwHHYPI3DUacDxeN8AxMnVf9CqIhCiwYt9U8JwoghQwRB9pdVAlRRL 4Lu/sA5D4YLxYRyEF5CKUesQQA48SLHq6pDl5G+vPceDoAY/QtM891cw0dx6PFfxW8WK NI0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=a47PBb52hre3dMm0AL5cihlS60hbl6dz/y8Xw4hz05A=; b=f8LS7zzZMWvHhqJUdkp0hXV1M/wVdlg2BzXy+ozEn/we9PlvUM11u4J+Kly8JlgJfU a1o1qDojhrOneK9pRCbIPJI637sZYrs5Psxkwt8XOWGyheRGBdFTo8EaOkkWRCqxZp1y vQXRItN9x8WGScP/aTuuSMHl73zfdr++MrVj7ToWHAJzA2lka0lYY5SUbwZ4Ay6y2v0s Rny6FQHgJCSyb+r91effb7NkfWxeqiYjMWRInovqC911yaQiNkFhErDdqR2TLnTYQV9X j58DGkoTkJWpivX4HQpraxaaLxO2rnbG+ywdUZ5iSGJ2a3xmDGRuoiajZuPRDKMI19SH /G6Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Sh5SIBT4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 125-20020a620483000000b0057705b25f02si587567pfe.337.2022.12.14.12.38.05; Wed, 14 Dec 2022 12:38:21 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=Sh5SIBT4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238805AbiLNTj4 (ORCPT + 69 others); Wed, 14 Dec 2022 14:39:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50066 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237451AbiLNTjx (ORCPT ); Wed, 14 Dec 2022 14:39:53 -0500 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F45929376 for ; Wed, 14 Dec 2022 11:39:52 -0800 (PST) Received: by mail-pg1-x535.google.com with SMTP id f3so2693816pgc.2 for ; Wed, 14 Dec 2022 11:39:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=a47PBb52hre3dMm0AL5cihlS60hbl6dz/y8Xw4hz05A=; b=Sh5SIBT4csDrPl5BRApL4Hysxx9/1D/AQMgFnsK33j0DGJYNff1dWUl1X+48/CcyU9 dhLm/QaxYsr8diOl+9WGgwQM4yPxaGOmF/HH6HtOUO/NgzgTt9JA/Tf956S3NOKJodUm ar9Vglzot+AgGss/XOWTiNe1oUEMWF1o1wjkK9fjo8XxmJjeWfRulzaLGLf/eqRxlLa0 H+Eltxo1kbDaoGZues7GjInqdbCkG+fIpDaxYbZORU1mot5TiawehnXw+0LqnWNM1DO4 sE50+vxBFBPbvCCCcI2qWST383kOkoJzg9ykvrNR0qnjMC2iXDENvrpGFl9TA5bwZ811 Gyfg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=a47PBb52hre3dMm0AL5cihlS60hbl6dz/y8Xw4hz05A=; b=ZFNQiOPkM8+13ktUi3h1mo7K10at7jrMiSv5hHOMna+onOTE/GCMcRs+YLTVCoYvDu kHkqoSVS7nkYlbskT46n3V0tEQJ3gCd1oYrQL1yXYkUNoW9SCOMisSq3StRPTTXoBcCs MqPL/Li+4Wiy5V5a61VNCUz5oePVL6WDk/daKI+K0hBC88fjiOj22FS2cRH0tmtMy+qO J5Oo05u9uVjXbDw9L9APOJoND5P6xWZSn/+unuuF2oc7gcOEXvQnkrOR6sGWqSOHU1ez dxUmo5+Vcn9zA2F+gBQcdqi7d/jTpSaulK0XtXtD55zQ0MeEHpIqwn8ZdDC01kXufE2V Oefw== X-Gm-Message-State: ANoB5pmQB+XyBSd2WEtGP2FoubUODCa/Z7rQZsIDMwkxhEJURK2nRmpX EABvjSjXafueD3V03FsC9+rfzITC/XCLPpNHsJFI6A== X-Received: by 2002:a65:6385:0:b0:478:e6cf:c24c with SMTP id h5-20020a656385000000b00478e6cfc24cmr10948486pgv.365.1671046791399; Wed, 14 Dec 2022 11:39:51 -0800 (PST) MIME-Version: 1.0 References: <20220712110248.1404125-1-atomlin@redhat.com> <20221214185658.fgsqrysq4luk2w4n@google.com> In-Reply-To: <20221214185658.fgsqrysq4luk2w4n@google.com> From: Nick Desaulniers Date: Wed, 14 Dec 2022 11:39:40 -0800 Message-ID: Subject: Re: [PATCH v2] scripts/gdb: Ensure the absolute path is generated on initial source To: Aaron Tomlin Cc: jan.kiszka@siemens.com, kbingham@kernel.org, atomlin@atomlin.com, linux-kernel@vger.kernel.org, dianders@chromium.org, Nathan Chancellor Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Dec 14, 2022 at 10:57 AM Nick Desaulniers wrote: > > On Tue, Jul 12, 2022 at 12:02:48PM +0100, Aaron Tomlin wrote: > > Post 'make scripts_gdb' a symbolic link to scripts/gdb/vmlinux-gdb.py > > is created. Currently 'os.path.dirname(__file__)' does not generate > > the absolute path to scripts/gdb resulting in the following: > > > > (gdb) source vmlinux-gdb.py > > Traceback (most recent call last): > > File "scripts/gdb/vmlinux-gdb.py", line 25, in > > import linux.utils > > ModuleNotFoundError: No module named 'linux' > > So I recently moved to a new machine, and lost my previous .gdbinit. > > I've re-added: > add-auto-load-safe-path /path/to/linux/ > > to my new ~/.gdbinit. > > Upon startup, lx-dmesg and friends aren't available. > > If I try: > (gdb) source scripts/gdb/vmlinux-gdb.py > Traceback (most recent call last): > File "scripts/gdb/vmlinux-gdb.py", line 25, in > import linux.utils > ModuleNotFoundError: No module named 'linux' > > Which is exactly the error claimed to be fixed by > commit b99695580bfc ("scripts/gdb: ensure the absolute path is generated on initial source") > even though I have b99695580bfc, which is how I found this thread to > reply to. > > (gdb) show auto-load safe-path > List of directories from which it is safe to auto-load files is $debugdir:$datadir/auto-load:/path/to/linux/. > > $ gdb-multiarch --version | head -n1 > GNU gdb (Debian 12.1-3) 12.1 > $ python3 --version > Python 3.10.8 > > I've also RTFM @ > Documentation/dev-tools/gdb-kernel-debugging.rst > though perhaps there's something I've missed? > > $ grep -rn GDB_SCRIPTS .config > 4162:CONFIG_GDB_SCRIPTS=y > > This definitely has worked in the past for me, on my previous > workstation. > > (gdb) show configuration > ... > --with-python=/usr (relocatable) > --with-python-libdir=/usr/lib (relocatable) > ... > (gdb) apropos lx > (gdb) > > No warnings from GDB either about the autoload path not being set. > Running gdb in my top level kernel sources. > > Am I holding it wrong? > > Any tips on how to go about debugging this? PEBKAC; looks like I was building `vmlinux` and not `all`. D'oh! > > > > > This patch ensures that the absolute path to scripts/gdb in relation to > > the given file is generated so each module can be located accordingly. > > > > Signed-off-by: Aaron Tomlin > > --- > > scripts/gdb/vmlinux-gdb.py | 2 +- > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > diff --git a/scripts/gdb/vmlinux-gdb.py b/scripts/gdb/vmlinux-gdb.py > > index 4136dc2c59df..3e8d3669f0ce 100644 > > --- a/scripts/gdb/vmlinux-gdb.py > > +++ b/scripts/gdb/vmlinux-gdb.py > > @@ -13,7 +13,7 @@ > > > > import os > > > > -sys.path.insert(0, os.path.dirname(__file__) + "/scripts/gdb") > > +sys.path.insert(0, os.path.dirname(os.path.abspath(__file__)) + "/scripts/gdb") > > > > try: > > gdb.parse_and_eval("0") > > -- > > 2.34.3 > > > > -- Thanks, ~Nick Desaulniers