This is the mail archive of the gdb-patches@sourceware.org mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [patch] build-id .debug files load (like .gnu_debuglink)


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]