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.