aboutsummaryrefslogtreecommitdiff
path: root/gdb/dwarf2/index-write.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2023-12-03 12:10:14 -0700
committerTom Tromey <tom@tromey.com>2024-01-18 08:20:16 -0700
commit6e53356b77887974e554ae07f9d76b83cd211700 (patch)
treeacf2bb649fd6bca725736d1c1f9a02b41a52da0a /gdb/dwarf2/index-write.c
parent9fac3e79fdec94b53fffdab6e8605d0ff8bab9d6 (diff)
downloadfsf-binutils-gdb-6e53356b77887974e554ae07f9d76b83cd211700.zip
fsf-binutils-gdb-6e53356b77887974e554ae07f9d76b83cd211700.tar.gz
fsf-binutils-gdb-6e53356b77887974e554ae07f9d76b83cd211700.tar.bz2
Do not write the index cache from an index
The new .debug_names reader will work by creating a cooked index from .debug_names. This patch updates cooked_index::maybe_write_index to avoid writing the index in this case. However, in order to do this in a clean way, the readers are changed so that a nullptr result from index_for_writing means "cannot be done", and then the error message is moved into write_dwarf_index (where it historically lived).
Diffstat (limited to 'gdb/dwarf2/index-write.c')
-rw-r--r--gdb/dwarf2/index-write.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 2decee6..5cd550e 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1629,6 +1629,8 @@ write_dwarf_index (dwarf2_per_bfd *per_bfd, const char *dir,
if (per_bfd->index_table == nullptr)
error (_("No debugging symbols"));
cooked_index *table = per_bfd->index_table->index_for_writing ();
+ if (table == nullptr)
+ error (_("Cannot use an index to create the index"));
if (per_bfd->types.size () > 1)
error (_("Cannot make an index when the file has multiple .debug_types sections"));