Re: [PATCH] fix PR symtab/15597

nick clifton
2013-08-14T11:25:45Z

Hi Tom,

> This patch touches BFD. Previously, gdb had its own code for parsing
> .gnu_debugaltlink; I changed it to use the BFD functions after those
> were introduced. However, the BFD functions are incorrect -- they
> assume that .gnu_debugaltlink is formatted like .gnu_debuglink.
> However, it it is not. Instead, it consists of a file name followed
> by the build-id -- no alignment, and the build-id is not a CRC.
>
> Fixing this properly is a bit of a pain. But, because
> separate_alt_debug_file_exists just has a FIXME for the build-id case,
> I did not fix it properly. Instead I introduced a hack. This leaves
> BFD working just as well as it did before my patch.
>
> I'm willing to do something better here but I could use some guidance
> as to what. It seems that the build-id code in BFD is largely punted
> on.

True - it would be nice to see this fixed, but it can be left for a
future patch.

> * bfd-in2.h: Rebuild.
> * opncls.c (bfd_get_alt_debug_link_info): Add buildid_len
> parameter. Change type of buildid_out. Update.
> (get_alt_debug_link_info_shim): New function.
> (bfd_follow_gnu_debuglink): Use it.
>
> * Makefile.in (SFILES): Add build-id.c.
> (HFILES_NO_SRCDIR): Add build-id.h.
> * build-id.c: New file, largely from elfread.c. Modified
> most functions.
> * build-id.h: New file.
> * dwarf2read.c (dwarf2_get_dwz_file): Update for change to
> bfd_get_alt_debug_link_info. Verify dwz file's build-id.
> Search for dwz file using build-id.
> * elfread.c (build_id_bfd_get, build_id_verify)
> (build_id_to_debug_filename, find_separate_debug_file): Remove.
>

Approved - please apply.

Cheers
Nick