public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Simon Marchi <simon.marchi@polymtl.ca>
To: "Tomar, Sourabh Singh" <SourabhSingh.Tomar@amd.com>,
	Keith Seitz <keiths@redhat.com>,
	"gdb-patches@sourceware.org" <gdb-patches@sourceware.org>
Subject: Re: [PATCH] Fix macro info lookup for binaries containing DWARFv5 line table
Date: Fri, 14 May 2021 16:56:12 -0400	[thread overview]
Message-ID: <8035316c-5cc2-d650-ba89-05242f7e1f89@polymtl.ca> (raw)
In-Reply-To: <DM4PR12MB5295FE3DA86D7D26DD10F4D89D509@DM4PR12MB5295.namprd12.prod.outlook.com>

> Thanks for sharing this, since both file0 and dir0 both are present, if possible, could you please share any behavior change or anything subtle you notice before/after
> applying patch ?

That gcc is in a container, so not to practical to test with.  So I
built various gcc versions from source to investigate this:

 - 10.2.0 (I did not actually build this one, it's the one from my
   distro)
 - 11.1.0
 - 11 from today's git
 - master from today's git

With gcc 10.2.0, as seen before, I don't get a DWARF 5 .debug_line
section.

With all three others, I get the same thing (modulo dir[2] which
specific to the compiler version) that looks good:

    include_directories[  0] = "/home/simark/build/binutils-gdb/gdb"
    include_directories[  1] = "/usr/include"
    include_directories[  2] = "/opt/gcc/git/lib/gcc/x86_64-pc-linux-gnu/12.0.0/include"
    include_directories[  3] = "/usr/include/bits"
    include_directories[  4] = "/usr/include/sys"
    include_directories[  5] = "/usr/include/gnu"
    file_names[  0]:
               name: "test.c"
          dir_index: 0
    file_names[  1]:
               name: "test.c"
          dir_index: 0
    file_names[  2]:
               name: "stdc-predef.h"
          dir_index: 1
    file_names[  3]:
               name: "stdint.h"
          dir_index: 2
    file_names[  4]:
               name: "stdint.h"
          dir_index: 1

I tested again using the gcc 11.1.0 from Ubuntu, that gave me a wrong
dir[0] before.  I replicated the same directory structure
(/home/simark/build/binutils-gdb/gdb/...) in my Ubuntu container, and
things look good actually:

    include_directories[  0] = "/home/simark/build/binutils-gdb/gdb"
    include_directories[  1] = "/usr/include"
    include_directories[  2] = "/usr/lib/gcc/x86_64-linux-gnu/11/include"
    include_directories[  3] = "/usr/include/x86_64-linux-gnu/bits"
    include_directories[  4] = "/usr/include/x86_64-linux-gnu/sys"
    include_directories[  5] = "/usr/include/x86_64-linux-gnu/gnu"
    file_names[  0]:
               name: "test.c"
          dir_index: 0
    file_names[  1]:
               name: "test.c"
          dir_index: 0
    file_names[  2]:
               name: "stdc-predef.h"
          dir_index: 1

So I tried compiling a file in the root directory (/) on my
(non-container) host, and I did see the weird output:

    include_directories[  0] = "/usr/include"
    include_directories[  1] = "/usr/include"
    include_directories[  2] = "/usr/include/bits"
    include_directories[  3] = "/usr/include/sys"
    include_directories[  4] = "/usr/include/gnu"
    include_directories[  5] = "/opt/gcc/11.1.0/lib/gcc/x86_64-pc-linux-gnu/11.1.0/include"
    include_directories[  6] = "/usr/include/bits/types"
    file_names[  0]:
               name: "test.c"
          dir_index: 0
    file_names[  1]:
               name: "test.c"
          dir_index: 0
    file_names[  2]:
               name: "stdc-predef.h"
          dir_index: 1

So that looks like a gcc bug that only happens when the compilation
directory is the root.  I'll go see if there's a gcc bug for this
already and file one if there isn't.

But other than that little corner case, the gcc 11+ -gdwarf-5 output
looks good.

I did a quick test loading the binary made using gcc master in GDB, and
I wasn't able to print the macro - both without and with your patch.  I
didn't investigate further, I have to go now.

Simon

  reply	other threads:[~2021-05-14 20:56 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-12 17:16 Sourabh Singh Tomar
2021-05-12 17:31 ` Tomar, Sourabh Singh
2021-05-13 15:47 ` Tom Tromey
2021-05-13 18:20 ` Simon Marchi
2021-05-14 14:56 ` Keith Seitz
2021-05-14 18:21   ` Tomar, Sourabh Singh
2021-05-14 18:50     ` Simon Marchi
2021-05-14 19:20       ` Tomar, Sourabh Singh
2021-05-14 20:56         ` Simon Marchi [this message]
2021-05-24 11:36   ` Tomar, Sourabh Singh
2021-05-24 18:47     ` Keith Seitz
2021-06-08 18:48       ` Keith Seitz
2021-06-22 17:01         ` [RFC] PING [Re: [PATCH] Fix macro info lookup for binaries containing DWARFv5 line table] Keith Seitz
2021-06-22 20:52           ` Simon Marchi

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=8035316c-5cc2-d650-ba89-05242f7e1f89@polymtl.ca \
    --to=simon.marchi@polymtl.ca \
    --cc=SourabhSingh.Tomar@amd.com \
    --cc=gdb-patches@sourceware.org \
    --cc=keiths@redhat.com \
    /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: link
Be 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).