From patchwork Fri Aug 21 21:23:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Kratochvil X-Patchwork-Id: 8375 Received: (qmail 120054 invoked by alias); 21 Aug 2015 21:23:47 -0000 Mailing-List: contact gdb-patches-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-patches-owner@sourceware.org Delivered-To: mailing list gdb-patches@sourceware.org Received: (qmail 120026 invoked by uid 89); 21 Aug 2015 21:23:47 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-3.6 required=5.0 tests=AWL, BAYES_00, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD, SPF_HELO_PASS autolearn=no version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-GCM-SHA384 encrypted) ESMTPS; Fri, 21 Aug 2015 21:23:46 +0000 Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (Postfix) with ESMTPS id A40B18E4F4 for ; Fri, 21 Aug 2015 21:23:44 +0000 (UTC) Received: from host1.jankratochvil.net (ovpn-116-22.ams2.redhat.com [10.36.116.22]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t7LLNh1a020712 for ; Fri, 21 Aug 2015 17:23:43 -0400 Subject: [PATCH v12 27/32] build_id_verify: Make it more verbose From: Jan Kratochvil To: gdb-patches@sourceware.org Date: Fri, 21 Aug 2015 23:23:43 +0200 Message-ID: <20150821212342.6673.45719.stgit@host1.jankratochvil.net> In-Reply-To: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> References: <20150821212006.6673.35100.stgit@host1.jankratochvil.net> User-Agent: StGit/0.17.1-dirty MIME-Version: 1.0 X-IsSubscribed: yes Hi, it was discussed on this list that if build-ids do not match they should be printed for troubleshooting. It is mostly independent from the other patches. Jan gdb/ChangeLog 2015-08-20 Jan Kratochvil * build-id.c: Include rsp-low.h. (build_id_verify): Print non-matching build-ids, update the messages. --- 0 files changed diff --git a/gdb/build-id.c b/gdb/build-id.c index 25ee606..48839cc 100644 --- a/gdb/build-id.c +++ b/gdb/build-id.c @@ -28,6 +28,7 @@ #include "gdbcore.h" #include "gdbcmd.h" #include "source.h" +#include "rsp-low.h" /* Boolean for command 'set validate-build-id'. */ int validate_build_id = 1; @@ -64,21 +65,39 @@ int build_id_verify (bfd *abfd, size_t check_len, const bfd_byte *check) { const struct bfd_build_id *found; - int retval = 0; + char *message, *check_hex; + struct cleanup *back_to; + + if (check_len == 0 || !validate_build_id) + return 1; found = build_id_bfd_get (abfd); + check_hex = alloca (check_len * 2 + 1); + bin2hex (check, check_hex, check_len); if (found == NULL) - warning (_("File \"%s\" has no build-id, file skipped"), - bfd_get_filename (abfd)); + message = xstrprintf (_("inferior build ID is %s but symbol file \"%s\" " + "does not have build ID"), + check_hex, bfd_get_filename (abfd)); else if (found->size != check_len || memcmp (found->data, check, found->size) != 0) - warning (_("File \"%s\" has a different build-id, file skipped"), - bfd_get_filename (abfd)); - else - retval = 1; + { + char *abfd_hex = alloca (found->size * 2 + 1); - return retval; + bin2hex (found->data, abfd_hex, found->size); + message = xstrprintf (_("inferior build ID %s is not identical to " + "symbol file \"%s\" build ID %s"), + check_hex, bfd_get_filename (abfd), abfd_hex); + } + else + return 1; + back_to = make_cleanup (xfree, message); + + warning (_("Symbol file \"%s\" could not be validated (%s) and " + "will be ignored; or use 'set validate-build-id off'."), + bfd_get_filename (abfd), message); + do_cleanups (back_to); + return 0; } /* Find and open a BFD given a build-id. If no BFD can be found,