From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1551) id 50F923858D32; Thu, 7 Jul 2022 12:28:11 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 50F923858D32 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable From: Pedro Alves To: gdb-cvs@sourceware.org Subject: [binutils-gdb] Fix pedantically invalid DWARF in gdb.trace/unavailable-dwarf-piece.exp X-Act-Checkin: binutils-gdb X-Git-Author: Pedro Alves X-Git-Refname: refs/heads/master X-Git-Oldrev: 83f477f25ad63ea9f2e5e5fc9c0a7297a46a7a21 X-Git-Newrev: a2a176c46bcb739db47c88b5641a23c1129accf0 Message-Id: <20220707122811.50F923858D32@sourceware.org> Date: Thu, 7 Jul 2022 12:28:11 +0000 (GMT) X-BeenThere: gdb-cvs@sourceware.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gdb-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 07 Jul 2022 12:28:11 -0000 https://sourceware.org/git/gitweb.cgi?p=3Dbinutils-gdb.git;h=3Da2a176c46bcb= 739db47c88b5641a23c1129accf0 commit a2a176c46bcb739db47c88b5641a23c1129accf0 Author: Pedro Alves Date: Thu Jul 7 13:05:50 2022 +0100 Fix pedantically invalid DWARF in gdb.trace/unavailable-dwarf-piece.exp =20 The DWARF spec says: =20 Any debugging information entry representing the declaration of an ob= ject, 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 inte= ger ^^^^^^^^ constant. =20 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. =20 Unsurprisingly, this: =20 $ make check \ TESTS=3D"gdb.trace/unavailable-dwarf-piece.exp" \ RUNTESTFLAGS=3D"--target_board=3Dnative-gdbserver" =20 ... still passes cleanly for me after this change. =20 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. =20 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: =20 $ 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) =20 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) =20 0x00000054: DW_TAG_member DW_AT_name ("a") =20 Change-Id: I5c866946356da421ff944019d0eca2607b2b738f Diff: --- 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/test= suite/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}