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.133.124]) by sourceware.org (Postfix) with ESMTPS id C9D783858D28 for ; Wed, 7 Sep 2022 17:31:18 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org C9D783858D28 Received: from mimecast-mx02.redhat.com (mimecast-mx02.redhat.com [66.187.233.88]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id us-mta-362-oFjzbNxiMsGe5_Shmy51TQ-1; Wed, 07 Sep 2022 13:31:15 -0400 X-MC-Unique: oFjzbNxiMsGe5_Shmy51TQ-1 Received: from smtp.corp.redhat.com (int-mx06.intmail.prod.int.rdu2.redhat.com [10.11.54.6]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx02.redhat.com (Postfix) with ESMTPS id 0BA66101AA45; Wed, 7 Sep 2022 17:31:15 +0000 (UTC) Received: from f36-1.lan (unknown [10.2.16.60]) by smtp.corp.redhat.com (Postfix) with ESMTP id 65C182166B26; Wed, 7 Sep 2022 17:31:14 +0000 (UTC) From: Kevin Buettner To: gdb-patches@sourceware.org Cc: lsix@lancelotsix.com, Kevin Buettner Subject: [PATCH v2 0/2] Suppress printing of superfluous BFD error messages Date: Wed, 7 Sep 2022 10:30:47 -0700 Message-Id: <20220907173050.8739-1-kevinb@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.78 on 10.11.54.6 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=-5.0 required=5.0 tests=BAYES_00, DKIMWL_WL_HIGH, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, DKIM_VALID_EF, RCVD_IN_DNSWL_LOW, SPF_HELO_NONE, SPF_NONE, TXREP, T_SCC_BODY_TEXT_LINE 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 List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 07 Sep 2022 17:31:20 -0000 Tools which use the BFD library will output error messages of the form "BFD: some messsage" when a problem with the file upon which it operating is found. E.g. an actual message (modulo some shortening of the pathname) from the test case in this series is: BFD: bfd-errors-lib.so: invalid string offset 1154 >= 154 for section `.dynstr' For some problems with executable files or libraries, BFD will attempt to output many identical messages. The first patch in this series adds code to GDB to suppress messages which are identical to earlier messages that have already been printed. (The above blurb was adapted from a comment in the test case.) This V2 patch addresses concerns noted by Lancelot SIX. For part 1, I've used one of Lancelot's suggestions for simplifying the implementation of increment_bfd_error_count() in gdb_bfd.c. Regarding the test case, Lancelot found that it failed when tested on Ubuntu. It turned out that attempting to run to a catchpoint whilst using a mangled shared library was fragile. I rewrote parts of the test to instead use 'add-symbol-file -readnow' to load symbols from the mangled shared object into GDB. Also, since the main program is no longer needed, I removed it and all references to in in the .exp file. Lancelot suggested several other improvements which I also put into place. Kevin Buettner (2): Suppress printing of superfluous BFD error messages BFD error message suppression test case gdb/gdb_bfd.c | 67 +++++++++ gdb/testsuite/gdb.base/bfd-errors-lib.c | 44 ++++++ gdb/testsuite/gdb.base/bfd-errors.exp | 187 ++++++++++++++++++++++++ 3 files changed, 298 insertions(+) create mode 100644 gdb/testsuite/gdb.base/bfd-errors-lib.c create mode 100644 gdb/testsuite/gdb.base/bfd-errors.exp -- 2.37.3