[gdb/symtab] Fix version check in dwarf compilation unit header
authorTom de Vries <tdevries@suse.de>
Tue, 3 Jul 2018 22:07:30 +0000 (00:07 +0200)
committerTom de Vries <tdevries@suse.de>
Wed, 4 Jul 2018 09:56:51 +0000 (11:56 +0200)
commit1ea5da02629b4bf9c4cea50aee189f94fa7d1a3b
tree33ef422b27b891d67e07c3a69d51fe0274c22bfe
parentf51e0e20bd303a9b366084ac719db10978402713
[gdb/symtab] Fix version check in dwarf compilation unit header

The version check of the dwarf compilation unit header in
error_check_comp_unit_head is done too late, and consequently dwarf code with
an unsupported version in the compilation unit header is interpreted as dwarf5
code in read_comp_unit_head.

Fixed by moving the check earlier.

Build and reg-tested on x86_64-linux.

2018-07-04  Tom de Vries  <tdevries@suse.de>

* dwarf2read.c (error_check_comp_unit_head): Move dwarf version
check ...
(read_comp_unit_head): ... here.

* gdb.dwarf2/dw2-error.exp: Update expected error message.
gdb/ChangeLog
gdb/dwarf2read.c
gdb/testsuite/ChangeLog
gdb/testsuite/gdb.dwarf2/dw2-error.exp