public inbox for gdb-patches@sourceware.org
 help / color / mirror / Atom feed
From: Will Hawkins <hawkinsw@obs.cr>
To: Tom de Vries <tdevries@suse.de>
Cc: gdb-patches@sourceware.org
Subject: Re: [PATCH v5] gdb: Support embedded source in DWARF
Date: Sun, 14 Apr 2024 03:15:46 -0400	[thread overview]
Message-ID: <CADx9qWh-0sQMp5eM8A01RihCAKaFu7__qVyeZPTEORLtBVDwow@mail.gmail.com> (raw)
In-Reply-To: <afe0f88a-ee39-41fd-852c-dd57c9c2e33e@suse.de>

On Sun, Apr 14, 2024 at 3:01 AM Tom de Vries <tdevries@suse.de> wrote:
>
> On 4/14/24 04:50, Will Hawkins wrote:
> > On Fri, Apr 12, 2024 at 4:12 PM Tom de Vries <tdevries@suse.de> wrote:
> >>
> >> On 4/12/24 20:55, Will Hawkins wrote:
> >>> +         DW_LNE_set_address main_end
> >>> +         line [gdb_get_line_number "main end"]
> >>> +         DW_LNS_copy
> >>> +
> >>> +         DW_LNE_end_sequence
> >>> +     }
> >> I've just submitted a patch series designed to catch this (
> >> https://sourceware.org/pipermail/gdb-patches/2024-April/207922.html ).
> >>
> >> The copy produces a line table entry with empty address range (because
> >> the end_sequence is at the same address),.
> >>
> >> This is probably not what you intended.
> >
> > What I get for doing copy/paste! A v6 is on its way! Thank you for the
> > eagle eyes!
> >
>
> It's just that I spent some time fixing all test-cases with this
> problem, so I happened to spot it.  Anyway, thanks for following up.
>
> > On a semi-related note, it appears that "many" of the dwarf2 tests do
> > not properly specify
> >
> > add_dummy_cus 0
> >
> > in their invocation of Dwarf::assemble resulting in two CUs being
> > generated in the .S file. This does not appear to cause problems for
> > the tests, but if you run the generated binaries through a "dwarf
> > validator", e.g., llvm-dwarfdump, they will report errors. I have
> > requested an account on the gdb bugzilla to report a bug and will file
> > a related patch as a fix, if that is okay with you?
>
> The dummy cu's are there by default, intentionally, as explained here (
> https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=5ef670d81fd222ae5edfa1428ad48710f5e10d35
> ).  In brief, it tries to make sure that when writing a dwarf assembly
> test-case on one platform it will work on another.
>
> If this causes problems with llvm-dwarfdump, we can look into fixing
> that.  So, yes, please file a PR.
>
> But I'd look into a way of fixing this that doesn't require
> "add_dummy_cus 0".

Interesting. So, as I understand it, forcing CUs for the file being
compiled (hello.c in the example you cited) to be somewhere other than
the beginning of the .debug_info sections allowed you to catch
additional bugs. In order to draw out similar bugs on platforms where
the "main" CU goes first by default, you added the dummy CU feature.
Am I understanding that correctly? If so, that's really neat.

I will file a bug and then work on PR that makes the dummy cu feature
"compatible" with llvm-dwarfdump. It could obviously also be an issue
with the llvm-dwarfdump tool, too. I have contributed to LLDB, too,
and would be more than happy to work with them if the problems is
really in their tool.

Thank you for the follow up!
Will


>
> Thanks,
> - Tom
>

  reply	other threads:[~2024-04-14  7:15 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-12 18:55 Will Hawkins
2024-04-12 20:12 ` Tom de Vries
2024-04-14  2:50   ` Will Hawkins
2024-04-14  7:01     ` Tom de Vries
2024-04-14  7:15       ` Will Hawkins [this message]
2024-04-15 16:13         ` Will Hawkins
2024-04-19 20:17 ` Tom Tromey
2024-04-26  6:12   ` Will Hawkins

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=CADx9qWh-0sQMp5eM8A01RihCAKaFu7__qVyeZPTEORLtBVDwow@mail.gmail.com \
    --to=hawkinsw@obs.cr \
    --cc=gdb-patches@sourceware.org \
    --cc=tdevries@suse.de \
    /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).