public inbox for elfutils@sourceware.org
 help / color / mirror / Atom feed
From: Mark Wielaard <mjw@redhat.com>
To: elfutils-devel@lists.fedorahosted.org
Subject: Re: [PATCH v3 2/6] libdw: Add dwarf_getalt, dwarf_setalt
Date: Thu, 17 Apr 2014 17:17:12 +0200	[thread overview]
Message-ID: <1397747832.29199.41.camel@bordewijk.wildebeest.org> (raw)
In-Reply-To: ed5f0fcf4405e6b650828d7f1e767e99a8bf0b55.1397586259.git.fweimer@redhat.com

[-- Attachment #1: Type: text/plain, Size: 1637 bytes --]

Hi Florian,

Looks good, just some nitpicks.

On Tue, 2014-04-15 at 14:31 +0200, Florian Weimer wrote:
> +++ b/libdw/dwarf_getalt.c
> @@ -0,0 +1,42 @@
> +/* Create descriptor from ELF descriptor for processing file.

This isn't a great description.

> diff --git a/libdw/dwarf_setalt.c b/libdw/dwarf_setalt.c
> +/* Create descriptor from ELF descriptor for processing file.

Same here.

> +void
> +dwarf_setalt (Dwarf *main, Dwarf *alt)
> +{
> +  if (main->free_alt)
> +    INTUSE (dwarf_end) (main->alt_dwarf);
> +  main->free_alt = false;
> +  main->alt_dwarf = alt;
> +}
> +INTDEF (dwarf_setalt)

Two questions. I think either answer is fine, but it should be
explicitly said/documented.
1) Should we verify the underlying ELF files to see whether there is
a .gnu_debugaltlink with matching build_id in the alt file? If not then
we should document that the user is responsible for the sanity checking.
2) Should we allow resetting the alt file once set? If we do, like here,
we should add a warning to dwarf_getalt that dwarf_setalt might
reset/end the underlying Dwarf.
 
> +/* Retrieve DWARF descriptor for debugaltlink data.  Returns NULL if
> +   no alternate debug data has been supplied.  */
> +extern Dwarf *dwarf_getalt (Dwarf *main);
> +
> +/* Provides the data referenced by the .gnu_debugaltlink section.  It
> +   is the responsibility of the caller to ensure that the data
> +   referenced by ALT stays valid until dwarf_end (MAIN) is called.  */
> +extern void dwarf_setalt (Dwarf *main, Dwarf *alt);

So whatever is decided should be documented here.

Cheers,

Mark



             reply	other threads:[~2014-04-17 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-04-17 15:17 Mark Wielaard [this message]
  -- strict thread matches above, loose matches on Subject: below --
2014-04-23 12:28 Mark Wielaard
2014-04-22  7:26 Florian Weimer
2014-04-18 10:35 Mark Wielaard
2014-04-17 15:33 Florian Weimer
2014-04-15 12:31 Florian Weimer

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=1397747832.29199.41.camel@bordewijk.wildebeest.org \
    --to=mjw@redhat.com \
    --cc=elfutils-devel@lists.fedorahosted.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).