public inbox for gdb-prs@sourceware.org
help / color / mirror / Atom feed
From: "vries at gcc dot gnu.org" <sourceware-bugzilla@sourceware.org>
To: gdb-prs@sourceware.org
Subject: [Bug symtab/28159] [gdb/symtab] gdb generates .gdb_index with only empty hashtable entries, then fails to recognize it as empty
Date: Fri, 06 Aug 2021 22:23:37 +0000	[thread overview]
Message-ID: <bug-28159-4717-B5mCwd8NiX@http.sourceware.org/bugzilla/> (raw)
In-Reply-To: <bug-28159-4717@http.sourceware.org/bugzilla/>

https://sourceware.org/bugzilla/show_bug.cgi?id=28159

--- Comment #2 from Tom de Vries <vries at gcc dot gnu.org> ---
(In reply to Tom de Vries from comment #0)
> This shows two problems:
> - gdb generates such an index

Fixed by:
...
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 4e00c716d91..5de07a6c07b 100644
--- a/gdb/dwarf2/index-write.c
+++ b/gdb/dwarf2/index-write.c
@@ -1385,6 +1385,9 @@ write_gdbindex (dwarf2_per_objfile *per_objfile, FILE
*out_file,
   uniquify_cu_indices (&symtab);

   data_buf symtab_vec, constant_pool;
+  if (symtab.n_elements == 0)
+    symtab.data.resize (0);
+
   write_hash_table (&symtab, symtab_vec, constant_pool);

   write_gdbindex_1(out_file, objfile_cu_list, types_cu_list, addr_vec,
...

-- 
You are receiving this mail because:
You are on the CC list for the bug.

  parent reply	other threads:[~2021-08-06 22:23 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-08-01 11:26 [Bug symtab/28159] New: " vries at gcc dot gnu.org
2021-08-06 19:52 ` [Bug symtab/28159] " cvs-commit at gcc dot gnu.org
2021-08-06 22:23 ` vries at gcc dot gnu.org [this message]
2021-08-14 21:35 ` tromey at sourceware dot org
2021-08-24 12:18 ` vries at gcc dot gnu.org
2021-08-26 12:39 ` vries at gcc dot gnu.org
2021-08-30 14:10 ` vries at gcc dot gnu.org
2021-08-30 14:11 ` vries at gcc dot gnu.org

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=bug-28159-4717-B5mCwd8NiX@http.sourceware.org/bugzilla/ \
    --to=sourceware-bugzilla@sourceware.org \
    --cc=gdb-prs@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).