Message ID | 51bcb8afd665fed00ce44e7eb33846d8444feea9.1675876331.git.aburgess@redhat.com |
---|---|
State | Committed |
Commit | b9c05fc03d313d8505df2c1265481faf6594b62a |
Headers |
Return-Path: <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> X-Original-To: patchwork@sourceware.org Delivered-To: patchwork@sourceware.org Received: from server2.sourceware.org (localhost [IPv6:::1]) by sourceware.org (Postfix) with ESMTP id 21D403858410 for <patchwork@sourceware.org>; Wed, 8 Feb 2023 17:14:16 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 21D403858410 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=sourceware.org; s=default; t=1675876456; bh=8wyLq9HVa+1YYnm8d1OjF0U8V+nQR4L2GqUyrxfCTq4=; h=To:Cc:Subject:Date:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:List-Subscribe:From:Reply-To:From; b=nCm9pBPLyTiLW2XZbT332o+7hbUNzV8cOJk2VFmsxCm5onJvczjbPa7h8YMI9qP3v sl8UKq52keNkNsDWxiaVq/2sJYffBTwsSmeK7hHSwRRPgOVc7QUGNk1WXFAf/9iki9 mL+zAhflYtmf0N55j7JFW+3ZbAwtja58Lult0L2U= X-Original-To: gdb-patches@sourceware.org Delivered-To: gdb-patches@sourceware.org Received: from us-smtp-delivery-124.mimecast.com (us-smtp-delivery-124.mimecast.com [170.10.129.124]) by sourceware.org (Postfix) with ESMTPS id DF2253858D39 for <gdb-patches@sourceware.org>; Wed, 8 Feb 2023 17:13:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF2253858D39 Received: from mail-qt1-f197.google.com (mail-qt1-f197.google.com [209.85.160.197]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_128_GCM_SHA256) id us-mta-617-tlrrsmg3MX62moNduJlDCg-1; Wed, 08 Feb 2023 12:13:50 -0500 X-MC-Unique: tlrrsmg3MX62moNduJlDCg-1 Received: by mail-qt1-f197.google.com with SMTP id bz17-20020a05622a1e9100b003b9c1013018so11088937qtb.18 for <gdb-patches@sourceware.org>; Wed, 08 Feb 2023 09:13:50 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=8wyLq9HVa+1YYnm8d1OjF0U8V+nQR4L2GqUyrxfCTq4=; b=Vr2jaYs8dZPNxyEfdtJE2rjgaLbo4ExWE5XHXunIiJ8Hm9pFK7Z4YjmeDTJUggkWCY DSwy22yt2I0BGRJ2puR2VCNhy3emqRswUxPgql/TtQUCzNWjW9NtXVJxhakFtN+pffM4 O5ZZ4gl98/VI3NbqS2i9ASL9UoQgSoHuRH5zHYnxwOe7HzHKMppwWJ8pjTCDPwwAtTFN 2B6w9H0GZdjITPD7bqNrDgQR+oisaA8BExSHOmxyubYDthFycl3g1O3oNRKxHDFpaqzl /Jd3Q8xSMKjxFxWcplMiqZUwf7PNYi1bMqgLLNxgBNKXS60Geplz9JMaaR5gPnSazVU2 Yyxg== X-Gm-Message-State: AO0yUKULfLNpZ99Y40QMXyv+t6vHGR6lVMYHW79DfElgSKT0Yi9LOhfb blnzidZ69V+oxEYSvXyfEFaDMKpefMq93NrQCWNz7Ev8kiDYhLuksboEfVcSPHJWFlPnbvjJtBV C3+QFm3danjd6XU+Zq8CcmJ+LbsnsbzHUkzwnO36I77sTVDiE33s06QsOar98k6bHPi2oEgDSfz 6z7WI= X-Received: by 2002:a05:622a:203:b0:3a5:24ac:a175 with SMTP id b3-20020a05622a020300b003a524aca175mr12528668qtx.56.1675876429674; Wed, 08 Feb 2023 09:13:49 -0800 (PST) X-Google-Smtp-Source: AK7set/Tn/5VEbBzbzTKHe+b7kD6iqyZcBlySCOIhUz+wFdRKblAMs5as8+M6co3k4zTBOlIBYDOjA== X-Received: by 2002:a05:622a:203:b0:3a5:24ac:a175 with SMTP id b3-20020a05622a020300b003a524aca175mr12528635qtx.56.1675876429356; Wed, 08 Feb 2023 09:13:49 -0800 (PST) Received: from localhost (95.72.115.87.dyn.plus.net. [87.115.72.95]) by smtp.gmail.com with ESMTPSA id v25-20020ae9e319000000b00720f61af739sm11845909qkf.115.2023.02.08.09.13.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Feb 2023 09:13:49 -0800 (PST) To: gdb-patches@sourceware.org Cc: Andrew Burgess <aburgess@redhat.com> Subject: [PATCH] gdb: remove unnecessary 'dir' commands from gdb-gdb.gdb script Date: Wed, 8 Feb 2023 17:13:46 +0000 Message-Id: <51bcb8afd665fed00ce44e7eb33846d8444feea9.1675876331.git.aburgess@redhat.com> X-Mailer: git-send-email 2.25.4 MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="US-ASCII"; x-default=true X-Spam-Status: No, score=-11.2 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, GIT_PATCH_0, HEXHASH_WORD, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_NONE, TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org X-BeenThere: gdb-patches@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-patches mailing list <gdb-patches.sourceware.org> List-Unsubscribe: <https://sourceware.org/mailman/options/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=unsubscribe> List-Archive: <https://sourceware.org/pipermail/gdb-patches/> List-Post: <mailto:gdb-patches@sourceware.org> List-Help: <mailto:gdb-patches-request@sourceware.org?subject=help> List-Subscribe: <https://sourceware.org/mailman/listinfo/gdb-patches>, <mailto:gdb-patches-request@sourceware.org?subject=subscribe> From: Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> Reply-To: Andrew Burgess <aburgess@redhat.com> Errors-To: gdb-patches-bounces+patchwork=sourceware.org@sourceware.org Sender: "Gdb-patches" <gdb-patches-bounces+patchwork=sourceware.org@sourceware.org> |
Series |
gdb: remove unnecessary 'dir' commands from gdb-gdb.gdb script
|
|
Commit Message
Andrew Burgess
Feb. 8, 2023, 5:13 p.m. UTC
While debugging GDB I used 'show directories' and spotted lots of entries that didn't make much sense. Here are all the entries that are in my directories list: /tmp/binutils-gdb/build /tmp/binutils-gdb/build/../../src/gdb /tmp/binutils-gdb/build/../../src/gdb/../bfd /tmp/binutils-gdb/build/../../src/gdb/../libiberty $cdir $cwd Notice the second, third, and fourth entries in this list, these should really be: /tmp/binutils-gdb/build/../src/gdb /tmp/binutils-gdb/build/../src/gdb/../bfd /tmp/binutils-gdb/build/../src/gdb/../libiberty The problem is because I generally run everything from the top level build directory, not the gdb/ sub-directory, thus, I start GDB like: ./gdb/gdb --data-directory ./gdb/data-directory If run GDB under GDB, then I end up loading the gdb/gdb-gdb.gdb script, which contains these lines: dir ../../src/gdb/../libiberty dir ../../src/gdb/../bfd dir ../../src/gdb dir . These commands only make sense when running within the gdb/ sub-directory. However, my debugging experience doesn't seem to be degraded at all, I can still see the GDB source code just fine; which is because the directory list still contains $cdir. The build/gdb/gdb-gdb.gdb script is created from the src/gdb/gdb-gdb.gdb.in template, which includes the automake @srcdir@ markers. The 'dir' commands have mostly been around since the sourceware repository was first created, though this commit 67f0714670383a did reorder some of the 'dir' commands, which would seem to indicate these commands were important to some people, at some time. One possible fix would be to replace @srcdir@ with @abs_srcdir@, this would ensure that the entries added were all valid, no matter the user's current directory when debugging GDB. However... I'd like to propose that we instead remove all the extra directories completely. My hope is that, with more recent tools, the debug information should allow us to correctly find all of the source files without having to add any extra 'dir' entries. Obviously, commit 67f0714670383a does make me a little nervous, but the gdb-gdb.gdb script isn't something a non-maintainer will be using, so I think we can afford to be a little more aggressive here. If it turns out the 'dir' entries are needed then we can add them back, but actually document why they are needed. Plus, when we add them back we will use @abs_srcdir@ instead of @srcdir@. --- gdb/gdb-gdb.gdb.in | 5 ----- 1 file changed, 5 deletions(-) base-commit: 1947a4a4bb7651a4656edceb1f9b246f96f89ebd
Comments
>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes: Andrew> While debugging GDB I used 'show directories' and spotted lots of Andrew> entries that didn't make much sense. Here are all the entries that are Andrew> in my directories list: Andrew> However... I'd like to propose that we instead remove all the extra Andrew> directories completely. My hope is that, with more recent tools, the Andrew> debug information should allow us to correctly find all of the source Andrew> files without having to add any extra 'dir' entries. Obviously, Andrew> commit 67f0714670383a does make me a little nervous, but the Andrew> gdb-gdb.gdb script isn't something a non-maintainer will be using, so Andrew> I think we can afford to be a little more aggressive here. If it Andrew> turns out the 'dir' entries are needed then we can add them back, but Andrew> actually document why they are needed. Plus, when we add them back we Andrew> will use @abs_srcdir@ instead of @srcdir@. Makes sense to me. Reviewed-By: Tom Tromey <tom@tromey.com> Tom
Tom Tromey <tom@tromey.com> writes: >>>>>> "Andrew" == Andrew Burgess via Gdb-patches <gdb-patches@sourceware.org> writes: > > Andrew> While debugging GDB I used 'show directories' and spotted lots of > Andrew> entries that didn't make much sense. Here are all the entries that are > Andrew> in my directories list: > > Andrew> However... I'd like to propose that we instead remove all the extra > Andrew> directories completely. My hope is that, with more recent tools, the > Andrew> debug information should allow us to correctly find all of the source > Andrew> files without having to add any extra 'dir' entries. Obviously, > Andrew> commit 67f0714670383a does make me a little nervous, but the > Andrew> gdb-gdb.gdb script isn't something a non-maintainer will be using, so > Andrew> I think we can afford to be a little more aggressive here. If it > Andrew> turns out the 'dir' entries are needed then we can add them back, but > Andrew> actually document why they are needed. Plus, when we add them back we > Andrew> will use @abs_srcdir@ instead of @srcdir@. > > Makes sense to me. Thanks. I've pushed this. I'm sure people will shout if it turns out these were useful in someway. Thanks, Andrew
diff --git a/gdb/gdb-gdb.gdb.in b/gdb/gdb-gdb.gdb.in index 8d97c95a70e..b9fd457d069 100644 --- a/gdb/gdb-gdb.gdb.in +++ b/gdb/gdb-gdb.gdb.in @@ -16,11 +16,6 @@ if !$gdb_init_done return end - dir @srcdir@/../libiberty - dir @srcdir@/../bfd - dir @srcdir@ - dir . - # Commands below are not fully compatible with wrapping into an 'if' block. end