]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit
Fix Ada crash with .debug_types
authorTom Tromey <tromey@adacore.com>
Wed, 29 Apr 2020 17:16:57 +0000 (11:16 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 29 Apr 2020 17:16:57 +0000 (11:16 -0600)
commited6aceddf5b2c31cda8f74982e8dd0574b3979b8
tree8b550d0c1b9131604fc5149406b5d973f01ec30f
parentb68b1b58d687584f7177678146e4c7def22e9699
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.
gdb/ChangeLog
gdb/dwarf2/read.c