From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail-wr1-f44.google.com (mail-wr1-f44.google.com [209.85.221.44]) by sourceware.org (Postfix) with ESMTPS id B93953858D32 for ; Thu, 7 Jul 2022 12:28:47 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.1 sourceware.org B93953858D32 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=palves.net Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f44.google.com with SMTP id d16so19764258wrv.10 for ; Thu, 07 Jul 2022 05:28:47 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:subject:date:message-id:mime-version :content-transfer-encoding; bh=TCbjFuKs/6uGH1OvVVraqdcYzoAbX8EIShRhjB8bPic=; b=BwsLXlNJ3o8gUHDcOSwH8QK16fZRkNk0k9TO85sPXRssa1rWo11kI7k2ihJ1NQ3uKl soewcFYZEbQhgczgxK5d5d6jMOWsreqVM0pIoo6znwaVsZfgTYlUfO1JGuGkCLIEmqG7 wgGeZRH2O0ElJSEEStKReWQON020cnen2RvYh2WVH72pQTz8lEK8499ggv/cHOG3eLeb cq9lld2q8knboNXcp1piLfs5Wkm/ndYwP02HJGUfvwUcOi4I6kXZclpKixCEgkPq/94h yndfOW1kxpBTgsCeZEmJObGuBZcJzFni/IbL9PTdIJkzxBe1XaBiym89g3qaU28YXOMr dfbg== X-Gm-Message-State: AJIora8MUloAawCPL60YK4RzTUf/QutMOGbemqxbVAdAEVcXKH1kLrVk 157NtsOhIv00IVm2qhXcbBGxX8jaBeM= X-Google-Smtp-Source: AGRyM1uaCVDURMqDOZdyIN39WDxeVF7/TjSR+41wCnZ3luMDDizgFnwVoMvJye5mG/IrvGWCDy2fhg== X-Received: by 2002:a05:6000:1f96:b0:21d:8516:9ec9 with SMTP id bw22-20020a0560001f9600b0021d85169ec9mr3848918wrb.359.1657196925952; Thu, 07 Jul 2022 05:28:45 -0700 (PDT) Received: from localhost ([2001:8a0:f924:2600:209d:85e2:409e:8726]) by smtp.gmail.com with ESMTPSA id q7-20020a05600000c700b0021d76985929sm6495434wrx.80.2022.07.07.05.28.44 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 07 Jul 2022 05:28:45 -0700 (PDT) From: Pedro Alves To: gdb-patches@sourceware.org Subject: [ob/pushed] Fix pedantically invalid DWARF in gdb.trace/unavailable-dwarf-piece.exp Date: Thu, 7 Jul 2022 13:28:43 +0100 Message-Id: <20220707122843.1195097-1-pedro@palves.net> X-Mailer: git-send-email 2.36.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-9.8 required=5.0 tests=BAYES_00, FREEMAIL_FORGED_FROMDOMAIN, FREEMAIL_FROM, GIT_PATCH_0, HEADER_FROM_DIFFERENT_DOMAINS, KAM_DMARC_STATUS, 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, 07 Jul 2022 12:28:49 -0000 The DWARF spec says: Any debugging information entry representing the declaration of an object, module, subprogram or type may have DW_AT_decl_file, DW_AT_decl_line and DW_AT_decl_column attributes, each of whose value is an unsigned integer ^^^^^^^^ constant. Grepping around the DWARF-assembler-based testcases, I noticed that gdb.trace/unavailable-dwarf-piece.exp emits decl_line with DW_FORM_sdata, a signed integer form. This commit tweaks it to use DW_FORM_udata instead. Unsurprisingly, this: $ make check \ TESTS="gdb.trace/unavailable-dwarf-piece.exp" \ RUNTESTFLAGS="--target_board=native-gdbserver" ... still passes cleanly for me after this change. I've noticed this because current llvm-dwarfdump crashed on an ROCm-internal DWARF-assembler-based testcase that incorrectly used signed forms for DW_AT_decl_file/DW_AT_decl_line. The older llvm-dwarfdump found on Ubuntu 20.04 (LLVM 10) reads the line numbers with signed forms as "0" instead of crashing. Here's the before/after fix for gdb.trace/unavailable-dwarf-piece.exp with that llvm-dwarfdump version: $ diff -up before.txt after.txt --- before.txt 2022-07-07 13:21:28.387690334 +0100 +++ after.txt 2022-07-07 13:21:39.379801092 +0100 @@ -18,7 +18,7 @@ DW_AT_name ("s") DW_AT_byte_size (3) DW_AT_decl_file (0) - DW_AT_decl_line (0) + DW_AT_decl_line (1) 0x0000002f: DW_TAG_member DW_AT_name ("a") @@ -41,7 +41,7 @@ DW_AT_name ("t") DW_AT_byte_size (3) DW_AT_decl_file (0) - DW_AT_decl_line (0) + DW_AT_decl_line (1) 0x00000054: DW_TAG_member DW_AT_name ("a") Change-Id: I5c866946356da421ff944019d0eca2607b2b738f --- gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp index c6b1382e9b1..f80f8005fcf 100644 --- a/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp +++ b/gdb/testsuite/gdb.trace/unavailable-dwarf-piece.exp @@ -45,7 +45,7 @@ Dwarf::assemble $asm_file { {name s} {byte_size 3 DW_FORM_sdata} {decl_file 0 DW_FORM_udata} - {decl_line 1 DW_FORM_sdata} + {decl_line 1 DW_FORM_udata} } { DW_TAG_member { {name a} @@ -74,7 +74,7 @@ Dwarf::assemble $asm_file { {name t} {byte_size 3 DW_FORM_sdata} {decl_file 0 DW_FORM_udata} - {decl_line 1 DW_FORM_sdata} + {decl_line 1 DW_FORM_udata} } { DW_TAG_member { {name a} base-commit: 83f477f25ad63ea9f2e5e5fc9c0a7297a46a7a21 -- 2.36.0