From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (wildebeest.demon.nl [212.238.236.112]) by sourceware.org (Postfix) with ESMTPS id 27D3F385802A for ; Tue, 26 Jan 2021 20:45:17 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.3.2 sourceware.org 27D3F385802A Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=mark@klomp.org Received: from tarox.wildebeest.org (tarox.wildebeest.org [172.31.17.39]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 8E79E300043B; Tue, 26 Jan 2021 21:45:15 +0100 (CET) Received: by tarox.wildebeest.org (Postfix, from userid 1000) id 3840A4000BBE; Tue, 26 Jan 2021 21:45:15 +0100 (CET) From: Mark Wielaard To: dwz@sourceware.org Cc: Mark Wielaard Subject: [PATCH] Add DIE offsets in error messages to make it easier to find what is wrong. Date: Tue, 26 Jan 2021 21:45:09 +0100 Message-Id: <20210126204509.24710-1-mark@klomp.org> X-Mailer: git-send-email 2.18.4 X-Spam-Status: No, score=-11.5 required=5.0 tests=BAYES_00, GIT_PATCH_0, JMQ_SPF_NEUTRAL, KAM_DMARC_STATUS, SPF_HELO_NONE, SPF_PASS, TXREP autolearn=ham autolearn_force=no version=3.4.2 X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on server2.sourceware.org X-BeenThere: dwz@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Dwz mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 26 Jan 2021 20:45:18 -0000 With the following patch dwz will give a message like: libmozjs-78.so: Couldn't find DIE at [bd6b507] referenced by DW_AT_abstract_origin from DIE at [bd5bb9b] Which makes it a easier to figure out what is going on. In the above case it is easy to find the producer of the CU of those two DIEs. Which turned out the be is clang LLVM (rustc version 1.49.0) which seems to have gotten the abstract origin reference wrong. --- dwz.c | 35 +++++++++++++++++++++++------------ 1 file changed, 23 insertions(+), 12 deletions(-) diff --git a/dwz.c b/dwz.c index 28f0c4d..1db93dd 100644 --- a/dwz.c +++ b/dwz.c @@ -2414,8 +2414,10 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, ref = off_htab_lookup (cu, cu->cu_offset + addr); if (ref == NULL) { - error (0, 0, "%s: Couldn't find DIE referenced by %s", - dso->filename, get_DW_OP_str (op)); + error (0, 0, "%s: Couldn't find DIE at [%" PRIx64 "] " + "referenced by %s from DIE at [%x]", + dso->filename, cu->cu_offset + addr, + get_DW_OP_str (op), die->die_offset); return 1; } if (op == DW_OP_call2) @@ -2465,8 +2467,9 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, ref = off_htab_lookup (NULL, addr); if (ref == NULL || (unlikely (low_mem) && ref->die_tag == 0)) { - error (0, 0, "%s: Couldn't find DIE referenced by %s", - dso->filename, get_DW_OP_str (op)); + error (0, 0, "%s: Couldn't find DIE at [%" PRIx64 "] " + "referenced by %s from DIE at [%x]", + dso->filename, addr, get_DW_OP_str (op), die->die_offset); return 1; } ref->die_no_multifile = 1; @@ -2551,8 +2554,10 @@ read_exprloc (DSO *dso, dw_die_ref die, unsigned char *ptr, size_t len, ref = off_htab_lookup (cu, cu->cu_offset + addr); if (ref == NULL) { - error (0, 0, "%s: Couldn't find DIE referenced by %s", - dso->filename, get_DW_OP_str (op)); + error (0, 0, "%s: Couldn't find DIE at [%" PRIx64 "] " + "referenced by %s from DIE at [%x]", + dso->filename, cu->cu_offset + addr, + get_DW_OP_str (op), die->die_offset); return 1; } if (unlikely (low_mem)) @@ -3537,8 +3542,10 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die) ref = off_htab_lookup (cu, value); if (ref == NULL) { - error (0, 0, "%s: Couldn't find DIE referenced by %s", - dso->filename, get_DW_AT_str (t->attr[i].attr)); + error (0, 0, "%s: Couldn't find DIE at [%" PRIx64 "] " + "referenced by %s from DIE at [%x]", + dso->filename, value, + get_DW_AT_str (t->attr[i].attr), die->die_offset); return 1; } if (unlikely (op_multifile) && ref->die_collapsed_child) @@ -3635,8 +3642,10 @@ checksum_die (DSO *dso, dw_cu_ref cu, dw_die_ref top_die, dw_die_ref die) = off_htab_lookup (cu, cu->cu_offset + value); if (ref == NULL) { - error (0, 0, "%s: Couldn't find DIE referenced by %s", - dso->filename, get_DW_AT_str (t->attr[i].attr)); + error (0, 0, "%s: Couldn't find DIE at [%" PRIx64 "] " + "referenced by %s from DIE at [%x]", + dso->filename, cu->cu_offset + value, + get_DW_AT_str (t->attr[i].attr), die->die_offset); return 1; } if (die->die_ck_state != CK_BAD) @@ -7146,8 +7155,10 @@ read_debug_info (DSO *dso, int kind, unsigned int *die_count) dw_die_ref ref = off_htab_lookup (cu, cu->cu_offset + type_offset); if (ref == NULL) { - error (0, 0, "%s: Couldn't find DIE referenced by type_offset", - dso->filename); + error (0, 0, "%s: Couldn't find DIE at [%x] " + "referenced by type_offset from cu DIE at [%x]", + dso->filename, cu->cu_offset + type_offset, + cu->cu_die->die_offset); goto fail; } if (unlikely (low_mem)) -- 2.18.4