binutils-gdb/gdb/dwarf2
Tom Tromey a7308ce01e Avoid crash on missing dwz file
If DWARF contains a reference to a "dwz" file, but there is no
.gnu_debugaltlink section, then gdb will crash.  This happens because
dwarf2_get_dwz_file will return NULL, but some callers do not expect
this.

This patch changes dwarf2_get_dwz_file so that callers can require a
dwz file.  Then, it updates the callers that are attempting to process
references to the dwz file to require one.

This includes a new testcase.  The dwarf.exp changes don't handle the
new forms exactly correctly -- they are only handled well enough to
let this test case complete.

gdb/ChangeLog
2021-03-06  Tom Tromey  <tom@tromey.com>

	* dwarf2/read.h (dwarf2_get_dwz_file): Add 'require' parameter.
	* dwarf2/read.c (dwarf2_get_dwz_file): Add 'require' parameter.
	(get_abbrev_section_for_cu, read_attribute_value)
	(get_debug_line_section): Update.
	* dwarf2/macro.c (dwarf_decode_macro_bytes): Update.

gdb/testsuite/ChangeLog
2021-03-06  Tom Tromey  <tom@tromey.com>

	* lib/dwarf.exp (_handle_DW_FORM): Treat DW_FORM_GNU_ref_alt and
	DW_FORM_GNU_strp_alt like DW_FORM_sec_offset.
	* gdb.dwarf2/dwznolink.exp: New file.
2021-03-06 09:26:39 -07:00
..
abbrev.c Micro-optimize abbrev reading and storage 2021-03-06 09:17:28 -07:00
abbrev.h Micro-optimize abbrev reading and storage 2021-03-06 09:17:28 -07:00
attribute.c [gdb/symtab] Handle DW_AT_decl_file with form DW_FORM_implicit_const 2021-02-24 23:58:42 +01:00
attribute.h [gdb/symtab] Handle DW_AT_decl_file with form DW_FORM_implicit_const 2021-02-24 23:58:42 +01:00
comp-unit.c
comp-unit.h
die.h gdb/dwarf: split dwarf2_cu::ranges_base in two 2021-02-02 10:42:11 -05:00
dwz.c
dwz.h
expr.c
expr.h
frame-tailcall.c
frame-tailcall.h
frame.c
frame.h
index-cache.c
index-cache.h
index-common.c
index-common.h
index-write.c [gdb/symtab] Fix assert in write_one_signatured_type 2021-02-02 08:37:45 +01:00
index-write.h
leb.c
leb.h
line-header.c
line-header.h
loc.c Use std::vector for "registers_used" in compile feature 2021-01-23 20:33:25 -07:00
loc.h Use std::vector for "registers_used" in compile feature 2021-01-23 20:33:25 -07:00
macro.c Avoid crash on missing dwz file 2021-03-06 09:26:39 -07:00
macro.h
read.c Avoid crash on missing dwz file 2021-03-06 09:26:39 -07:00
read.h Avoid crash on missing dwz file 2021-03-06 09:26:39 -07:00
sect-names.h Change section_is_p to a method on dwarf2_section_names 2021-03-06 09:26:39 -07:00
section.c
section.h
stringify.c
stringify.h