Mirror of the gdb-patches mailing list
 help / color / mirror / Atom feed
From: Daniel Jacobowitz <drow@false.org>
To: Jan Kratochvil <jan.kratochvil@redhat.com>
Cc: gdb-patches@sourceware.org, Roland McGrath <roland@redhat.com>
Subject: Re: [patch] build-id .debug files load (like .gnu_debuglink)
Date: Fri, 24 Aug 2007 18:20:00 -0000	[thread overview]
Message-ID: <20070824182028.GA19512@caradoc.them.org> (raw)
In-Reply-To: <20070824180450.GA4216@host0.dyn.jankratochvil.net>

On Fri, Aug 24, 2007 at 08:04:50PM +0200, Jan Kratochvil wrote:
> Hi,
> 
> Patch improves performance of the separate debug info files verification as it
> does not need to read and checksum the whole .debug file, it only reads its id.
> 
> This part may be questionable:
> -  debugfile = find_separate_debug_file (objfile); 
> +  /* If the file has its own symbol tables it has no separate debug info.  */
> +  if (objfile->psymtabs == NULL)
> +    debugfile = find_separate_debug_file (objfile);
> 
> So far .gnu_debuglink existed only in the main file (not the .debug file) and
> it existed only if the debug info was stripped to a separate file from it.
> debug-id exists always and even both in the main file and the .debug file,
> therefore the former code above would deadlock in a loop.  Not sure if
> `PSYMTABS == NULL' is the right condition.  According to my experiments on
> GNU/Linux it should be correct.

In some cases a library will be left with .symtab but not .debug_info;
sometimes elfutils does this, also sometimes it is done deliberately
for ld.so / libpthread.so so that the separate debug file is not
necessary for minimal debugging to work.

We should either pass a flag down so that we know we're already
looking at the separate debug file (more efficient, saves us the
second search, more work to implement) or else have
find_separate_debug_file fail if it finds objfile again.

> +/* Locate NT_GNU_BUILD_ID and return its content.
> +   Separate debuginfo files have corrupted PHDR but SHDR is correct there.  */
> +
> +static struct build_id *
> +build_id_bfd_shdr_get (bfd *abfd)
> +{
> +  struct build_id *retval;
> +
> +  if (!bfd_check_format (abfd, bfd_object)
> +      || bfd_get_flavour (abfd) != bfd_target_elf_flavour
> +      || elf_tdata (abfd)->build_id == NULL)
> +    return NULL;
> +
> +  retval = xmalloc (sizeof *retval - 1 + elf_tdata (abfd)->build_id_size);
> +  retval->size = elf_tdata (abfd)->build_id_size;
> +  memcpy (retval->data, elf_tdata (abfd)->build_id, retval->size);
> +
> +  return retval;
> +}

This function isn't doing anything with program headers or section
headers now, maybe it should be renamed (and the comment doesn't need
to talk about corrupted phdrs in that case).

I believe the manual needs an update to mention the new search path.

-- 
Daniel Jacobowitz
CodeSourcery


  reply	other threads:[~2007-08-24 18:20 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-08-24 18:05 Jan Kratochvil
2007-08-24 18:20 ` Daniel Jacobowitz [this message]
2007-08-25 22:49   ` Jan Kratochvil
2007-08-25 23:58     ` Daniel Jacobowitz
2007-08-26  9:41       ` Jan Kratochvil
2007-08-31  9:38         ` Eli Zaretskii
2007-08-31 20:51           ` [patch approval?] " Jan Kratochvil
2007-08-31 21:12             ` Daniel Jacobowitz
2007-09-01  8:01             ` Eli Zaretskii
     [not found]           ` <20070901081934.GA31205@host0.dyn.jankratochvil.net>
2007-09-01 10:31             ` [patch] " Eli Zaretskii
2007-09-01 11:35               ` Jan Kratochvil
2007-09-01 12:15                 ` Eli Zaretskii
2007-09-01 13:12                   ` Jan Kratochvil
2007-09-01 13:25                     ` Mark Kettenis
2007-09-01 14:22                       ` Eli Zaretskii
2007-09-02 13:57                       ` [patch approved?] [doc] " Jan Kratochvil
2007-09-02 17:49                         ` Mark Kettenis
2007-09-02 19:38                         ` Eli Zaretskii
2007-09-01 14:16                     ` [patch] " Eli Zaretskii
2007-09-04  2:21                   ` Roland McGrath
2007-09-04  3:23                     ` Eli Zaretskii
2007-09-04  7:21                       ` Roland McGrath
2007-09-15  9:52                         ` Eli Zaretskii
2007-09-16 17:19                           ` Roland McGrath
2007-08-25 22:48 ` Roland McGrath

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=20070824182028.GA19512@caradoc.them.org \
    --to=drow@false.org \
    --cc=gdb-patches@sourceware.org \
    --cc=jan.kratochvil@redhat.com \
    --cc=roland@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