From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 9423D3858C54; Fri, 23 Sep 2022 12:51:05 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 9423D3858C54 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1663937465; bh=qhNXUQHd43sEo9y6EqEy9JN2u0u0LA5vnmuKvqmzNLw=; h=From:To:Subject:Date:In-Reply-To:References:From; b=qvuH75DEwFHNrWzeAUqbc6RJ62kJBGXJeftNmFzg2ZlnlsZz+TCYf3s01UPZx4rO8 IuGI1KKvL/bfv7rcHdIodWyzu95Kv32MfZQSF67CUKiLL+YFwOeP/r+hVHukGeocMo nOXMJAVCsKhMkNEHvlHrxAEURQY1UGrGeSLr5o9I= From: "jakub at gcc dot gnu.org" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/107012] [debug, dwarf-5] Missing line information for evaluating macros Date: Fri, 23 Sep 2022 12:51:05 +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: 12.2.0 X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: jakub 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=3D107012 --- Comment #2 from Jakub Jelinek --- I don't see anything wrong on what GCC emits. If I compile with -O3 -g3 -gdwarf-4 -dA -nostdinc so that stdc-predef.h isn= 't included vs. -O3 -g3 -gdwarf-5 -dA -nostdinc, in .debug_macro I see for DWA= RF 4: .section .debug_macro,"",@progbits .Ldebug_macro0: .value 0x4 # DWARF macro version number .byte 0x2 # Flags: 32-bit, lineptr present .long .Ldebug_line0 .byte 0x7 # Import .long .Ldebug_macro2 .byte 0x3 # Start new file .byte 0 # uleb128 0; Included from line number 0 .byte 0x1 # uleb128 0x1; file pr107012.c .byte 0x5 # Define macro strp .byte 0x1 # uleb128 0x1; At line number 1 .long .LASF372 # The macro: "TEST_MACRO 42" .byte 0x4 # End file .byte 0 # End compilation unit where .Ldebug_macro2 is import of the predefined macros. .debug_line then has: .ascii "pr107012.c\0" # File Entry: 0x1 .byte 0 # uleb128 0 .byte 0 # uleb128 0 .byte 0 # uleb128 0 i.e. file entry 1 is pr107012.c. In DWARF 5 it is: .section .debug_macro,"",@progbits .Ldebug_macro0: .value 0x5 # DWARF macro version number .byte 0x2 # Flags: 32-bit, lineptr present .long .Ldebug_line0 .byte 0x7 # Import .long .Ldebug_macro2 .byte 0x3 # Start new file .byte 0 # uleb128 0; Included from line number 0 .byte 0x1 # uleb128 0x1; file pr107012.c .byte 0x5 # Define macro strp .byte 0x1 # uleb128 0x1; At line number 1 .long .LASF374 # The macro: "TEST_MACRO 42" .byte 0x4 # End file .byte 0 # End compilation unit so there are only minor differences related to macros: - .long .Ldebug_macro0 # DW_AT_GNU_macros + .long .Ldebug_macro0 # DW_AT_macros in .debug_info section and .section .debug_macro,"",@progbits .Ldebug_macro0: - .value 0x4 # DWARF macro version number + .value 0x5 # DWARF macro version number .byte 0x2 # Flags: 32-bit, lineptr present .long .Ldebug_line0 .byte 0x7 # Import ... .byte 0x1 # uleb128 0x1; file pr107012.c .byte 0x5 # Define macro strp .byte 0x1 # uleb128 0x1; At line number 1 - .long .LASF372 # The macro: "TEST_MACRO 42" + .long .LASF374 # The macro: "TEST_MACRO 42" .byte 0x4 # End file .byte 0 # End compilation unit in .debug_macro. The line table then says that both file 0 and 1 are pr107012.c: .byte 0x2 # File name entry format count .byte 0x1 # uleb128 0x1; DW_LNCT_path .byte 0x1f # uleb128 0x1f; DW_FORM_line_strp .byte 0x2 # uleb128 0x2; DW_LNCT_directory_index .byte 0xb # uleb128 0xb; DW_FORM_data1 .byte 0x2 # uleb128 0x2; File names count .long .LASF0 # File Entry: 0: "pr107012.c" .byte 0 .long .LASF0 # File Entry: 0: "pr107012.c" .byte 0 You'd better file this against gdb...=