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 47C8B3858D20 for ; Tue, 11 Apr 2023 10:56:45 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 47C8B3858D20 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=1681210604; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type; bh=sf98UK4EmvgABy24RL+hLH0zEBL2mUd2lCzKusd6g4o=; b=B7yyG8n+ibGvzzcdibmKekqb//4VvF5rZgTkEVAE/uKvh5AJH/DndlgAKQsT6Aa4DuQEyS MDHB1C0PVLmtiwnNN/QOEg4F9iax6kFibvdGW8q8t2NpZ2Q4Sd0fdGqlYKuyXXxlFYEz2y V8P9QJLXiLVO2DCbDUKrSMFyhggs9sY= Received: from mail-qt1-f199.google.com (mail-qt1-f199.google.com [209.85.160.199]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-327-89HNMl-DMfmKWfdFnC1LKw-1; Tue, 11 Apr 2023 06:56:43 -0400 X-MC-Unique: 89HNMl-DMfmKWfdFnC1LKw-1 Received: by mail-qt1-f199.google.com with SMTP id bp42-20020a05622a1baa00b003e6748b05edso12859894qtb.2 for ; Tue, 11 Apr 2023 03:56:43 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1681210603; h=mime-version:user-agent:message-id:date:organization:subject:to :from:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=sf98UK4EmvgABy24RL+hLH0zEBL2mUd2lCzKusd6g4o=; b=YisX3kWhObQyxkvKFB8C+Lf+RkwQpS/03d4lHlkzfB5GqVQq4k8LCza1V82zqfm/MR 4SdqLbA6pWL5Ej0HZbU+k3/YSiTy7P2CYv1lCj/aBsnnOeLdnItso7lbpHHDs1WxnJh6 5CNzfO18b43vrkMr1E/aKzx8Fa33dVfqyniHJ8FzMx4Fx0Hxb/w1kAvqYtyC3ZJjfTfc XnBuXhlz0irR9v7gxCq1zg6/CdySB18lgTs1Pr6zwBaxfONHuulg+tV7C2o7XaquNPGy dcrIxBIhZPeAuKcugugnLvAYEXn1GK2c/iZk5VRAWAysHe9j8EcdlQXWBW6ErFaOV28h iQGg== X-Gm-Message-State: AAQBX9dFDx/qgYnen84pROA1+xDHLt/dfBI//obDw+bX5HeEkCB8wJ1b eEsKuNNaJsDlL63NjaFLdp3659ywGebP/Cba3naJXHGvZwNGnUOTxYvPGfr+ECkUFw/QD3Ob3Kz wnxs1iYHUzvUoB0DMAM3Ki5j2Nm+pcaWWGP2A8eqhtEtBXeBDS3k2kr4wpkxue9ICspPeAOqHCT lW X-Received: by 2002:ac8:5a0a:0:b0:3bf:be7d:b3e5 with SMTP id n10-20020ac85a0a000000b003bfbe7db3e5mr23185339qta.41.1681210602980; Tue, 11 Apr 2023 03:56:42 -0700 (PDT) X-Google-Smtp-Source: AKy350b5LiJ0CAuWIRmaQu1vdn6sLZcUD8jcxjWRGTNEGb5WoCsq6otDgnc16uZnhFtqotAPK8fhpQ== X-Received: by 2002:ac8:5a0a:0:b0:3bf:be7d:b3e5 with SMTP id n10-20020ac85a0a000000b003bfbe7db3e5mr23185315qta.41.1681210602527; Tue, 11 Apr 2023 03:56:42 -0700 (PDT) Received: from localhost ([88.120.130.27]) by smtp.gmail.com with ESMTPSA id l26-20020a37f91a000000b0074860fcfbecsm3881587qkj.21.2023.04.11.03.56.41 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 11 Apr 2023 03:56:42 -0700 (PDT) Received: by localhost (Postfix, from userid 1000) id C4A0E581C7B; Tue, 11 Apr 2023 12:56:40 +0200 (CEST) From: Dodji Seketeli To: libabigail@sourceware.org Subject: [PATCH, applied] abi{dw,diff}: Better error messages when alternate debuginfo not found Organization: Red Hat / France X-Operating-System: Fedora 38 X-URL: http://www.redhat.com Date: Tue, 11 Apr 2023 12:56:40 +0200 Message-ID: <87h6tmk7pz.fsf@redhat.com> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/27.1 (gnu/linux) MIME-Version: 1.0 X-Mimecast-Spam-Score: 0 X-Mimecast-Originator: redhat.com Content-Type: text/plain X-Spam-Status: No, score=-11.9 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH,DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,GIT_PATCH_0,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: Hello, When the alternate debug info referenced by the main debug info file is missing, both abidw and abidiff fail to explain what is happening to the user. The patch adds explicit error messages to those two programs in that case. * tools/abidiff.cc (handle_error): Handle cases where the fe_iface::STATUS[_ALT]_DEBUG_INFO_NOT_FOUND bits are set. Refer to the alternate debug info file in the error message. * tools/abidw.cc (load_corpus_and_write_abixml): Do not clear the reader before emitting the error message, rather clear it after. Also, refer to the alternate debug info file in the error message. Signed-off-by: Dodji Seketeli --- tools/abidiff.cc | 10 ++++++---- tools/abidw.cc | 22 +++++++++++++++++----- 2 files changed, 23 insertions(+), 9 deletions(-) diff --git a/tools/abidiff.cc b/tools/abidiff.cc index d2fa5b63..427c1f19 100644 --- a/tools/abidiff.cc +++ b/tools/abidiff.cc @@ -1047,7 +1047,9 @@ handle_error(abigail::fe_iface::status status_code, const string& prog_name, const options& opts) { - if (!(status_code & abigail::fe_iface::STATUS_OK)) + if (!(status_code & abigail::fe_iface::STATUS_OK) + || status_code & abigail::fe_iface::STATUS_DEBUG_INFO_NOT_FOUND + || status_code & abigail::fe_iface::STATUS_ALT_DEBUG_INFO_NOT_FOUND) { emit_prefix(prog_name, cerr) << "failed to read input file " << opts.file1 << "\n"; @@ -1110,10 +1112,10 @@ handle_error(abigail::fe_iface::status status_code, emit_prefix(prog_name, cerr) << "could not find the alternate debug info file"; - if (rdr->alternate_dwarf_debug_info()) + if (!rdr->alternate_dwarf_debug_info_path().empty()) cerr << " at: " - << rdr->alternate_dwarf_debug_info_path() - << "\n"; + << rdr->alternate_dwarf_debug_info_path(); + cerr << "\n"; } if (status_code & abigail::fe_iface::STATUS_NO_SYMBOLS_FOUND) diff --git a/tools/abidw.cc b/tools/abidw.cc index ddb3846e..eead7889 100644 --- a/tools/abidw.cc +++ b/tools/abidw.cc @@ -662,11 +662,6 @@ load_corpus_and_write_abixml(char* argv[], emit_prefix(argv[0], cerr) << "read corpus from elf file in: " << t << "\n"; - // Clear some resources to gain back some space. - t.start(); - reader.reset(); - t.stop(); - if (opts.do_log) emit_prefix(argv[0], cerr) << "reset reader ELF in: " << t << "\n"; @@ -709,10 +704,27 @@ load_corpus_and_write_abixml(char* argv[], emit_prefix(argv[0], cerr) << "Could not read ELF symbol information from " << opts.in_file_path << "\n"; + else if (s & fe_iface::STATUS_ALT_DEBUG_INFO_NOT_FOUND) + { + emit_prefix(argv[0], cerr) + << "Could not read alternate debug info file"; + if (!reader->alternate_dwarf_debug_info_path().empty()) + cerr << " '" << reader->alternate_dwarf_debug_info_path() << "'"; + cerr << " for '" + << opts.in_file_path << "'.\n"; + emit_prefix(argv[0], cerr) + << "You might have forgotten to install some " + "additional needed debug info\n"; + } return 1; } + // Clear some resources to gain back some space. + t.start(); + reader.reset(); + t.stop(); + // Now create a write context and write out an ABI XML description // of the read corpus. t.start(); -- 2.39.2 -- Dodji