binutils-gdb/gdb/dwarf2
Tom Tromey ed6aceddf5 Fix Ada crash with .debug_types
PR ada/25875 concerns a gdb crash when gdb.ada/arr_enum_idx_w_gap.exp
is run using the .debug_types board.

The problem turns out to be caused by weird compiler output.  In this
test, the compiler emits a top-level type that refers to an
enumeration type which is nested in a function.  However, this
function is just a declaration.

This results in gdb calling read_enumeration_type for the enum type,
but process_enumeration_scope is never called, yielding an enum with
no fields.  This causes the crash.

This patch fixes the problem by arranging to create the enum fields in
read_enumeration_type.

Tested on x86-64 Fedora 30.

gdb/ChangeLog
2020-04-29  Tom Tromey  <tromey@adacore.com>

	PR ada/25875:
	* dwarf2/read.c (update_enumeration_type_from_children): Compute
	type fields here.
	(read_enumeration_type): Call
	update_enumeration_type_from_children later.  Update comments.
	(process_enumeration_scope): Don't create type fields.
2020-04-29 11:16:57 -06:00
..
abbrev.c Don't pass NULL to memcpy in gdb 2020-03-31 07:29:53 -06:00
abbrev.h
attribute.c Add attribute::value_as_string method 2020-04-24 15:35:02 -06:00
attribute.h Add attribute::value_as_string method 2020-04-24 15:35:02 -06:00
comp-unit.c
comp-unit.h
die.h Rewrite new die_info methods 2020-03-26 09:28:26 -06:00
dwz.c
dwz.h
expr.c
expr.h
frame-tailcall.c Fix remaining inline/tailcall unwinding breakage for x86_64 2020-04-27 09:04:55 -03:00
frame-tailcall.h
frame.c Change get_objfile_arch to a method on objfile 2020-04-18 08:35:04 -06:00
frame.h
index-cache.c
index-cache.h
index-common.c
index-common.h
index-write.c Change get_objfile_arch to a method on objfile 2020-04-18 08:35:04 -06:00
index-write.h
leb.c
leb.h
line-header.c Move more code to line-header.c 2020-03-26 09:28:20 -06:00
line-header.h Move more code to line-header.c 2020-03-26 09:28:20 -06:00
loc.c Prefer existing data when evaluating DWARF expression 2020-04-24 13:40:31 -06:00
loc.h Prefer existing data when evaluating DWARF expression 2020-04-24 13:40:31 -06:00
macro.c Trivial fix in dwarf_decode_macro_bytes 2020-03-26 09:28:18 -06:00
macro.h Use a const dwarf2_section_info in macro reader 2020-03-26 09:28:17 -06:00
read.c Fix Ada crash with .debug_types 2020-04-29 11:16:57 -06:00
read.h gdb: small cleanups in dwarf2_psymtab constructors 2020-04-07 11:48:46 -04:00
section.c Add dwarf2_section_info::read_string method 2020-03-26 09:28:14 -06:00
section.h Add dwarf2_section_info::read_string method 2020-03-26 09:28:14 -06:00
stringify.c Move DWARF-constant stringifying code to new file 2020-03-26 09:28:26 -06:00
stringify.h Move DWARF-constant stringifying code to new file 2020-03-26 09:28:26 -06:00