public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Aaron Merey <amerey@redhat.com>
To: Mark Wielaard <mark@klomp.org>
Cc: elfutils-devel@sourceware.org
Subject: Re: [PATCH] libdw: dwarf_getsrcfiles should not imply dwarf_getsrclines
Date: Wed, 10 Apr 2024 16:43:53 -0400	[thread overview]
Message-ID: <CAJDtP-QC8BcNP9HxAeJOibBpF6Hqk-KPQ=SNEq3tyaiR2c4p9Q@mail.gmail.com> (raw)
In-Reply-To: <2a6f04357e6cb900fe055939673a7abc542ae333.camel@klomp.org>

Hi Mark,

On Wed, Apr 10, 2024 at 3:48 PM Mark Wielaard <mark@klomp.org> wrote:
> > v2 changes:
> > Restored support for DW_LNE_define_file.
>
> Great. And sorry I first suggested to just drop it and then said I
> would like it back. This was more work than I though.

No problem, better if we support this just in case.

> This one line uses tabs for indentation, all others spaces.
> [...]
> And this last block uses tabs again.
> [...]
> Here tabs again, then the rest spaces.
> [...]
> So inconsistent indentation, but the code looks good.

Fixed the indentation.

> > -  /* Pass the file data structure to the caller.  */
> > -  if (filesp != NULL)
> > -    *filesp = files;
> > +      const char **newdirs = (void *) &newfiles->info[nnewfiles];
> > +      const char **prevdirs = (void *) &prevfiles->info[nprevfiles];
> > +
> > +      /* Copy prevdirs to newdirs.  */
> > +      for (size_t n = 0; n < ndirs; n++)
> > +     newdirs[n] = prevdirs[n];
>
> Again slightly off indentation.
> But I also don't fully follow the prevdirs/newdirs copying.
> Why is this? No newdirs are defined here, are there?
> Maybe I don't understand the data-structure used here.

The directories are the same but we still need to copy them so that
dwarf_getsrcdirs can find newfiles' dir names.

Dwarf_Files is an unusual structure since it doesn't contain a member
specifically for the array of dirnames.  Instead they're stored at
the end of the Dwarf_Fileinfo array member.

> So testfile-define-file is actually testfile36.debug but with a new
> line program? How did you edit/insert that one?

I used xxd to create a hexdump of testfile36.debug and modified the line
program by hand with a text editor.  I converted the modified hexdump
back to a binary with xxd -r.

I chose testfile36.debug because its .debug_line includes multiple
directory and file names.  It also contains a single short line program
that was easy to replace with two DW_LNE_define_file opcodes without
corrupting things.

Aaron


  reply	other threads:[~2024-04-10 20:44 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-04-10  3:45 Aaron Merey
2024-04-10 19:47 ` Mark Wielaard
2024-04-10 20:43   ` Aaron Merey [this message]
2024-04-11  9:55     ` Mark Wielaard
2024-04-11 16:41       ` Aaron Merey
  -- strict thread matches above, loose matches on Subject: below --
2024-03-29  1:12 Aaron Merey
2024-04-02 14:47 ` Mark Wielaard

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='CAJDtP-QC8BcNP9HxAeJOibBpF6Hqk-KPQ=SNEq3tyaiR2c4p9Q@mail.gmail.com' \
    --to=amerey@redhat.com \
    --cc=elfutils-devel@sourceware.org \
    --cc=mark@klomp.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: 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).