From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 48) id 1A2A33858018; Sat, 15 May 2021 11:18:28 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 1A2A33858018 From: "simon.marchi at polymtl dot ca" To: gcc-bugs@gcc.gnu.org Subject: [Bug debug/100610] New: DWARF5, wrong include_directories[0] when building in / Date: Sat, 15 May 2021 11:18:27 +0000 X-Bugzilla-Reason: CC X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: gcc X-Bugzilla-Component: debug X-Bugzilla-Version: unknown X-Bugzilla-Keywords: X-Bugzilla-Severity: normal X-Bugzilla-Who: simon.marchi at polymtl dot ca 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: bug_id short_desc product version bug_status bug_severity priority component assigned_to reporter target_milestone Message-ID: 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 X-BeenThere: gcc-bugs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-bugs mailing list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 15 May 2021 11:18:28 -0000 https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D100610 Bug ID: 100610 Summary: DWARF5, wrong include_directories[0] when building in / Product: gcc Version: unknown Status: UNCONFIRMED Severity: normal Priority: P3 Component: debug Assignee: unassigned at gcc dot gnu.org Reporter: simon.marchi at polymtl dot ca Target Milestone: --- If I build a trivial test file while in the /tmp directory: $ pwd /tmp $ cat test.c #include #define FOO 2 int main() { return FOO; } $ /opt/gcc/git/bin/gcc -gdwarf-5 -g3 -O0 -o test test.c The include_directories table of .debug_line looks fine: $ readelf --debug-dump=3Drawline test The Directory Table (offset 0x22, lines 7, columns 1): Entry Name 0 (line_strp) (offset: 0x0): /tmp 1 (line_strp) (offset: 0xc): /usr/include 2 (line_strp) (offset: 0x19): /usr/include/bits 3 (line_strp) (offset: 0x2b): /usr/include/sys 4 (line_strp) (offset: 0x3c): /usr/include/gnu 5 (line_strp) (offset: 0x4d): /opt/gcc/git/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include 6 (line_strp) (offset: 0x85): /usr/include/bits/types The File Name Table (offset 0x44, lines 26, columns 2): Entry Dir Name 0 (udata) 0 (line_strp) (offset: 0x5): test.c 1 (udata) 0 (line_strp) (offset: 0x5): test.c Files #0 and #1 point to directory 0, which gives /tmp/test.c. However, if I move test.c in the root directory, at /test.c and move there: $ pwd / $ /opt/gcc/git/bin/gcc -gdwarf-5 -g3 -O0 -o /tmp/test test.c The Directory Table (offset 0x22, lines 7, columns 1): Entry Name 0 (line_strp) (offset: 0x9): /usr/include 1 (line_strp) (offset: 0x9): /usr/include 2 (line_strp) (offset: 0x16): /usr/include/bits 3 (line_strp) (offset: 0x28): /usr/include/sys 4 (line_strp) (offset: 0x39): /usr/include/gnu 5 (line_strp) (offset: 0x4a): /opt/gcc/git/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include 6 (line_strp) (offset: 0x82): /usr/include/bits/types The File Name Table (offset 0x44, lines 26, columns 2): Entry Dir Name 0 (udata) 0 (line_strp) (offset: 0x0): test.c 1 (udata) 0 (line_strp) (offset: 0x0): test.c See the files #0 and #1. They point to directory #0, which is /usr/include= .=20 That makes it believe that the source file was at /usr/include/test.c. That looks wrong to me.=