From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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 ; Wed, 8 Feb 2023 17:13:51 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org DF2253858D39 Authentication-Results: sourceware.org; dmarc=pass (p=none dis=none) header.from=redhat.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=redhat.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1675876431; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=8wyLq9HVa+1YYnm8d1OjF0U8V+nQR4L2GqUyrxfCTq4=; b=cLD/WZ0itPQR28JetPZgbwkI5OPegmeCKA4hsC1celT8xqP4RTlNUjYAcyJ8Mil/BeBkLH GDYTyYdLudX9eEe06c4OpQZo+z4t2ExT13Ntp2PhQu9W5W4M1D+TXMAYApkJFvwzatbUAY VezelAZB7W+vGxWeZnEEzplpmHZe544= 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 ; 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) From: Andrew Burgess To: gdb-patches@sourceware.org Cc: Andrew Burgess 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 List-Id: 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(-) 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 base-commit: 1947a4a4bb7651a4656edceb1f9b246f96f89ebd -- 2.25.4