Preserve artificial CU name in process_psymtab_comp_unit_reader
authorTom Tromey <tom@tromey.com>
Sun, 5 Dec 2021 20:13:33 +0000 (13:13 -0700)
committerTom Tromey <tom@tromey.com>
Sun, 5 Dec 2021 20:13:33 +0000 (13:13 -0700)
commit33af066d07d495c81c7c102125aec8dbac62c27b
tree8b5490d3eb5add969f8df4a9cf471f2fa1f7c2d9
parent843bf75416dd11d91a5d617f7a49f6e9e5025b42
Preserve artificial CU name in process_psymtab_comp_unit_reader

This fixes a use-after-free that Simon pointed out.
process_psymtab_comp_unit_reader was allocating an artificial name for
a CU, and then discarding it.  However, this name was preserved in the
cached file_and_directory.  This patch arranges for the allocated name
to be preserved there.
gdb/dwarf2/file-and-dir.h
gdb/dwarf2/read.c