Fix crash when creating index from index
authorTom Tromey <tromey@adacore.com>
Thu, 21 Apr 2022 17:20:22 +0000 (11:20 -0600)
committerTom Tromey <tromey@adacore.com>
Wed, 4 May 2022 14:38:05 +0000 (08:38 -0600)
commit758ffab46b5b6c4f0a145e8833f24ba72a4259e4
treeaffcc008bad0e690b46a576e84cf8e373a366efc
parentd8a735330883faa2670ccf70880f04b3c29683ed
Fix crash when creating index from index

My patches yesterday to unify the DWARF index base classes had a bug
-- namely, I did the wholesale dynamic_cast-to-static_cast too hastily
and introduced a crash.  This can be seen by trying to add an index to
a file that has an index, or by running a test like gdb-index-cxx.exp
using the cc-with-debug-names.exp target board.

This patch fixes the crash by introducing a new virtual method and
removing some of the static casts.
gdb/dwarf2/cooked-index.h
gdb/dwarf2/index-write.c
gdb/dwarf2/mapped-index.h