binutils-gdb/gdb/testsuite/lib
Tom Tromey dc294be54c fix PR symtab/15597
This patch fixes gdb PR symtab/15597.

The bug is that the .gnu_debugaltlink section includes the build-id of
the alt file, but gdb does not use it.

This patch fixes the problem by changing gdb to do what it ought to
always have done: verify the build id of the file found using the
filename in .gnu_debugaltlink; and if that does not match, try to find
the correct debug file using the build-id and debug-file-directory.

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.

FWIW gdb is the only user of bfd_get_alt_debug_link_info outside of
BFD itself.

I moved the build-id logic out of elfread.c and into a new file.
This seemed cleanest to me.

Writing a test case was a bit of a pain.  I added a couple new
features to the DWARF assembler to handle this.

Built and regtested on x86-64 Fedora 18.

	* 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.

	* gdb.dwarf2/dwzbuildid.exp: New file.
	* lib/dwarf.exp (Dwarf::_section): Add "flags" and "type"
	parameters.
	(Dwarf::_defer_output): Change "section" parameter to
	"section_spec"; update.
	(Dwarf::gnu_debugaltlink, Dwarf::_note, Dwarf::build_id): New
	procs.
2013-10-08 19:56:15 +00:00
..
ada.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
append_gdb_boards_dir.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
cache.exp introduce parallel mode 2013-08-13 16:12:04 +00:00
cell.exp use standard_temp_file in another caching proc 2013-08-22 13:46:21 +00:00
cl_util.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
cl_util.h Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
compiler.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
compiler.cc Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
cp-support.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
dwarf.exp fix PR symtab/15597 2013-10-08 19:56:15 +00:00
fortran.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
future.exp * lib/future.exp (gdb_find_objcopy, gdb_find_readelf): New procs. 2013-09-20 21:47:06 +00:00
gdb-python.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
gdb.exp Teach the testsuite that GDBserver reliably reports program exits. 2013-10-02 11:44:20 +00:00
gdbserver-support.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
go.exp Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
java.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
mi-support.exp * lib/mi-support.exp (varobj_tree::walk_tree): Set _root_idx 2013-10-07 19:10:45 +00:00
objc.exp gdb/testsuite/ 2013-03-14 13:34:06 +00:00
opencl.exp add caching procs to test suite 2013-08-13 15:55:52 +00:00
opencl_hostapp.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
opencl_kernel.cl
pascal.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
prelink-support.exp * lib/future.exp (gdb_find_objcopy, gdb_find_readelf): New procs. 2013-09-20 21:47:06 +00:00
prompt.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00
range-stepping-support.exp gdb/testsuite/ 2013-05-24 09:57:12 +00:00
selftest-support.exp fix python-selftest.exp failure with gdbserver 2013-06-18 14:12:09 +00:00
set_unbuffered_mode.c Update years in copyright notice for the GDB files. 2013-01-01 06:41:43 +00:00
trace-support.exp Remove superfluous semicolons from testsuite throughout. 2013-06-07 17:31:09 +00:00