From: Tom de Vries via Gdb-patches <gdb-patches@sourceware.org>
To: gdb-patches@sourceware.org
Subject: [PATCH][gdb/symtab] Don't write .gdb_index symbol table with empty entries
Date: Thu, 26 Aug 2021 14:38:29 +0200 [thread overview]
Message-ID: <20210826123827.GA29487@delia> (raw)
Hi,
When comparing the sizes of the index files generated for shlib
outputs/gdb.dwarf2/dw2-zero-range/shr1.sl, I noticed a large difference
between .debug_names:
...
$ gdb -q -batch $shlib -ex "save gdb-index -dwarf-5 ."
$ du -b -h shr1.sl.debug_names shr1.sl.debug_str
61 shr1.sl.debug_names
0 shr1.sl.debug_str
...
and .gdb_index:
...
$ gdb -q -batch $shlib -ex "save gdb-index ."
$ du -b -h shr1.sl.gdb-index
8.2K shr1.sl.gdb-index
...
The problem is that the .gdb_index contains a non-empty symbol table with only
empty entries.
Fix this by making the symbol table empty, such that we have instead:
...
$ du -b -h shr1.sl.gdb-index
184 shr1.sl.gdb-index
...
Tested on x86_64-linux.
Any comments?
Thanks,
- Tom
[gdb/symtab] Don't write .gdb_index symbol table with empty entries
---
gdb/dwarf2/index-write.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/gdb/dwarf2/index-write.c b/gdb/dwarf2/index-write.c
index 0fe2bc4dd05..0318b7a81b2 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,
next reply other threads:[~2021-08-26 12:39 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-08-26 12:38 Tom de Vries via Gdb-patches [this message]
2021-08-27 13:52 ` Tom Tromey
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=20210826123827.GA29487@delia \
--to=gdb-patches@sourceware.org \
--cc=tdevries@suse.de \
/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