From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alt-proxy28.mail.unifiedlayer.com (alt-proxy28.mail.unifiedlayer.com [74.220.216.123]) by sourceware.org (Postfix) with ESMTPS id 59CF2385C316 for ; Thu, 9 Jun 2022 15:31:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org 59CF2385C316 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=tromey.com Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=tromey.com Received: from cmgw12.mail.unifiedlayer.com (unknown [10.0.90.127]) by progateway1.mail.pro1.eigbox.com (Postfix) with ESMTP id 9CAD71003B164 for ; Thu, 9 Jun 2022 15:31:46 +0000 (UTC) Received: from box5379.bluehost.com ([162.241.216.53]) by cmsmtp with ESMTP id zK8Qn68YTRsNbzK8QnIZHU; Thu, 09 Jun 2022 15:31:46 +0000 X-Authority-Reason: nr=8 X-Authority-Analysis: v=2.4 cv=A9Opg4aG c=1 sm=1 tr=0 ts=62a21262 a=ApxJNpeYhEAb1aAlGBBbmA==:117 a=ApxJNpeYhEAb1aAlGBBbmA==:17 a=dLZJa+xiwSxG16/P+YVxDGlgEgI=:19 a=JPEYwPQDsx4A:10:nop_rcvd_month_year a=Qbun_eYptAEA:10:endurance_base64_authed_username_1 a=ntHWgoZrEAOoEbcPGjAA:9 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=tromey.com; s=default; h=Content-Transfer-Encoding:MIME-Version:Message-Id:Date:Subject: Cc:To:From:Sender:Reply-To:Content-Type:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=WTeBei+cGJEeL2BIjp60bd3t9AkUDCn9fhimKboKkLc=; b=U6HOAsD/dz7LSPUKurnj2Ge8VL Ornah0tQTKk0XYomHuxEOA/PrrBUBb4DbFoEsbIOiX6nV6mlkjNQWQUgCoMFcod4LuFt8ovy1jo9A IRqNLMZmPlRSlLkHco8/uTZEn; Received: from 71-211-171-143.hlrn.qwest.net ([71.211.171.143]:45648 helo=prentzel.Home) by box5379.bluehost.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1nzK8P-002vmp-PP; Thu, 09 Jun 2022 09:31:45 -0600 From: Tom Tromey To: gdb-patches@sourceware.org Cc: Tom Tromey Subject: [PATCH] Fix corrupt DWARF in dw2-double-set-die-type Date: Thu, 9 Jun 2022 09:31:43 -0600 Message-Id: <20220609153143.648567-1-tom@tromey.com> X-Mailer: git-send-email 2.34.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - box5379.bluehost.com X-AntiAbuse: Original Domain - sourceware.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - tromey.com X-BWhitelist: no X-Source-IP: 71.211.171.143 X-Source-L: No X-Exim-ID: 1nzK8P-002vmp-PP X-Source: X-Source-Args: X-Source-Dir: X-Source-Sender: 71-211-171-143.hlrn.qwest.net (prentzel.Home) [71.211.171.143]:45648 X-Source-Auth: tom+tromey.com X-Email-Count: 2 X-Source-Cap: ZWx5bnJvYmk7ZWx5bnJvYmk7Ym94NTM3OS5ibHVlaG9zdC5jb20= X-Local-Domain: yes X-Spam-Status: No, score=-3029.7 required=5.0 tests=BAYES_00, DKIM_SIGNED, DKIM_VALID, GIT_PATCH_0, JMQ_SPF_NEUTRAL, RCVD_IN_DNSWL_NONE, RCVD_IN_MSPIKE_H2, SPF_HELO_NONE, SPF_PASS, 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: Thu, 09 Jun 2022 15:31:50 -0000 The dw2-double-set-die-type.exp test case caused an AddressSanitizer failure in the new DWARF scanner. The immediate cause was bad DWARF in the test -- in particular, the the sibling attribute here: <2><181>: Abbrev Number: 33 (DW_TAG_subprogram) <182> DW_AT_external : 1 <183> DW_AT_name : address <18b> DW_AT_type : <0x171> <18f> DW_AT_declaration : 1 <190> DW_AT_sibling : <0x1a1> ... <1><1a1>: Abbrev Number: 23 (DW_TAG_pointer_type) <1a2> DW_AT_byte_size : 4 <1a3> DW_AT_type : <0x1a7> ...points to a "sibling" DIE that is at a different child depth. Because this test case doesn't really require sibling attributes, this patch fixes the problem by removing them from the test. Note that gdb is not generally robust against malformed DWARF. Detecting and compensating for this problem would probably be expensive and, IMO, is better left to some (still hypothetical) DWARF linter. --- .../gdb.dwarf2/dw2-double-set-die-type.S | 31 ------------------- 1 file changed, 31 deletions(-) diff --git a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S index 6f0a0a80346..ab5a2f712aa 100644 --- a/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S +++ b/gdb/testsuite/gdb.dwarf2/dw2-double-set-die-type.S @@ -65,7 +65,6 @@ .Ldie_4a: .uleb128 0x4 /* (DIE (0x4a) DW_TAG_namespace) */ .ascii "std\0" /* DW_AT_name */ - .4byte OFFSET (143) /* DW_AT_sibling */ .Ldie_70: .uleb128 0x8 /* (DIE (0x70) DW_TAG_class_type) */ @@ -76,7 +75,6 @@ .uleb128 0x9 /* (DIE (0x76) DW_TAG_structure_type) */ .ascii "_Vector_base >\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (f7) /* DW_AT_sibling */ .Ldie_80: .uleb128 0xa /* (DIE (0x80) DW_TAG_structure_type) */ @@ -131,13 +129,11 @@ .uleb128 0x1b /* (DIE (0x221) DW_TAG_class_type) */ .ascii "a\0" /* DW_AT_name */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (277) /* DW_AT_sibling */ .Ldie_22b: .uleb128 0x1b /* (DIE (0x22b) DW_TAG_class_type) */ .ascii "b\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (244) /* DW_AT_sibling */ .Ldie_235: .uleb128 0x1c /* (DIE (0x235) DW_TAG_subprogram) */ @@ -165,7 +161,6 @@ .ascii "a\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_artificial */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (262) /* DW_AT_sibling */ .Ldie_25b: .uleb128 0xe /* (DIE (0x25b) DW_TAG_formal_parameter) */ @@ -201,7 +196,6 @@ .uleb128 0x20 /* (DIE (0x27d) DW_TAG_class_type) */ .4byte OFFSET (162) /* DW_AT_specification */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (3b2) /* DW_AT_sibling */ .Ldie_2d0: .uleb128 0x21 /* (DIE (0x2d0) DW_TAG_subprogram) */ @@ -209,7 +203,6 @@ .ascii "address\0" /* DW_AT_name */ .4byte OFFSET (277) /* DW_AT_type */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (3b2) /* DW_AT_sibling */ .Ldie_2e5: .uleb128 0xe /* (DIE (0x2e5) DW_TAG_formal_parameter) */ @@ -249,7 +242,6 @@ .uleb128 0x20 /* (DIE (0x3e0) DW_TAG_class_type) */ .4byte OFFSET (70) /* DW_AT_specification */ .byte 0x1 /* DW_AT_byte_size */ - .4byte OFFSET (44e) /* DW_AT_sibling */ .Ldie_3ec: .uleb128 0xb /* (DIE (0x3ec) DW_TAG_inheritance) */ @@ -262,13 +254,11 @@ .uleb128 0x1a /* (DIE (0x44e) DW_TAG_structure_type) */ .4byte OFFSET (76) /* DW_AT_specification */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (505) /* DW_AT_sibling */ .Ldie_505: .uleb128 0x11 /* (DIE (0x505) DW_TAG_subprogram) */ .ascii "~_Vector_base\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (51f) /* DW_AT_sibling */ .Ldie_512: .uleb128 0xe /* (DIE (0x512) DW_TAG_formal_parameter) */ @@ -286,13 +276,11 @@ .ascii "_M_allocate\0" /* DW_AT_name */ .4byte OFFSET (277) /* DW_AT_type */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (540) /* DW_AT_sibling */ .Ldie_540: .uleb128 0x11 /* (DIE (0x540) DW_TAG_subprogram) */ .ascii "_M_deallocate\0" /* DW_AT_name */ .byte 0x1 /* DW_AT_declaration */ - .4byte OFFSET (562) /* DW_AT_sibling */ .Ldie_551: .uleb128 0xe /* (DIE (0x551) DW_TAG_formal_parameter) */ @@ -327,7 +315,6 @@ .uleb128 0x20 /* (DIE (0x59d) DW_TAG_class_type) */ .4byte OFFSET (f7) /* DW_AT_specification */ .byte 0x18 /* DW_AT_byte_size */ - .4byte OFFSET (b44) /* DW_AT_sibling */ .Ldie_5a9: .uleb128 0xb /* (DIE (0x5a9) DW_TAG_inheritance) */ @@ -390,8 +377,6 @@ .byte 0x1 /* DW_children_yes */ .uleb128 0x3 /* (DW_AT_name) */ .uleb128 0x8 /* (DW_FORM_string) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -420,8 +405,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -472,8 +455,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -518,8 +499,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -530,8 +509,6 @@ .uleb128 0x8 /* (DW_FORM_string) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -572,8 +549,6 @@ .uleb128 0xc /* (DW_FORM_flag) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -598,8 +573,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0xb /* (DW_AT_byte_size) */ .uleb128 0xb /* (DW_FORM_data1) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -614,8 +587,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 @@ -640,8 +611,6 @@ .uleb128 0x13 /* (DW_FORM_ref4) */ .uleb128 0x3c /* (DW_AT_declaration) */ .uleb128 0xc /* (DW_FORM_flag) */ - .uleb128 0x1 /* (DW_AT_sibling) */ - .uleb128 0x13 /* (DW_FORM_ref4) */ .byte 0x0 .byte 0x0 -- 2.34.1