From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 2B151387102F; Tue, 14 May 2024 12:00:54 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 2B151387102F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1715688055; bh=KJW7gwtkEka5Fusvpl6M4ErSF2NhwPSnxGPTKlU4nXk=; h=From:To:Subject:Date:In-Reply-To:References:From; b=EZDCLLqIi1Gw8UbY6CNef5pqA9DUPMaZe1qjdBj75/EKBi/JAdoB4Pi/Cu4+S9Xc1 yXjU1u0DU3SsrWdXGSGSkrv19YVFlgH/22h8jH2QkkycDSvnSIfOO+ppky2dJ8OODL KVw3Tkpu26MX68hAtTACsX8WOrtnXxgw1qKPFu9I= From: "cvs-commit at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/115066] [debug, gsplit-dwarf, gdwarf-4, g3] DW_MACRO_define_strp used for debug_str_offsets index Date: Tue, 14 May 2024 12:00:54 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: changed X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: 14.0 X-Bugzilla-Keywords: wrong-debug X-Bugzilla-Severity: normal X-Bugzilla-Who: cvs-commit at gcc dot gnu.org X-Bugzilla-Status: UNCONFIRMED X-Bugzilla-Resolution: X-Bugzilla-Priority: P3 X-Bugzilla-Assigned-To: unassigned at gcc dot gnu.org X-Bugzilla-Target-Milestone: --- X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: Message-ID: In-Reply-To: References: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: http://gcc.gnu.org/bugzilla/ Auto-Submitted: auto-generated MIME-Version: 1.0 List-Id: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D115066 --- Comment #8 from GCC Commits --- The master branch has been updated by Tom de Vries : https://gcc.gnu.org/g:b7003b4cc5e263343f047fe64ed1ae12f561b2d1 commit r15-483-gb7003b4cc5e263343f047fe64ed1ae12f561b2d1 Author: Tom de Vries Date: Mon May 13 18:10:15 2024 +0200 [debug] Fix dwarf v4 .debug_macro.dwo Consider a hello world, compiled with -gsplit-dwarf and dwarf version 4, and -g3: ... $ gcc -gdwarf-4 -gsplit-dwarf /data/vries/hello.c -g3 -save-temps -dA ... In section .debug_macro.dwo, we have: ... .Ldebug_macro0: .value 0x4 # DWARF macro version number .byte 0x2 # Flags: 32-bit, lineptr present .long .Lskeleton_debug_line0 .byte 0x3 # Start new file .uleb128 0 # Included from line number 0 .uleb128 0x1 # file /data/vries/hello.c .byte 0x5 # Define macro strp .uleb128 0 # At line number 0 .uleb128 0x1d0 # The macro: "__STDC__ 1" ... Given that we use a DW_MACRO_define_strp, we'd expect 0x1d0 to be an offset into a .debug_str.dwo section. But in fact, 0x1d0 is an index into the string offset table in section .debug_str_offsets.dwo: ... .long 0x34f0 # indexed string 0x1d0: __STDC__ 1 ... Add asserts that catch this inconsistency, and fix this by using DW_MACRO_define_strx instead. Tested on x86_64. gcc/ChangeLog: 2024-05-14 Tom de Vries PR debug/115066 * dwarf2out.cc (output_macinfo_op): Fix DW_MACRO_define_strx/st= rp choice for v4 .debug_macro.dwo. Add asserts to check that choi= ce. gcc/testsuite/ChangeLog: 2024-05-14 Tom de Vries PR debug/115066 * gcc.dg/pr115066.c: New test.=