public inbox for gcc-bugs@sourceware.org help / color / mirror / Atom feed
From: "simon.marchi at polymtl dot ca" <gcc-bugzilla@gcc.gnu.org> 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 [thread overview] Message-ID: <bug-100610-4@http.gcc.gnu.org/bugzilla/> (raw) https://gcc.gnu.org/bugzilla/show_bug.cgi?id=100610 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 <stdio.h> #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=rawline 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. That makes it believe that the source file was at /usr/include/test.c. That looks wrong to me.
reply other threads:[~2021-05-15 11:18 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-100610-4@http.gcc.gnu.org/bugzilla/ \ --to=gcc-bugzilla@gcc.gnu.org \ --cc=gcc-bugs@gcc.gnu.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).