This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
FYI: fix minor .gdb_index bug
- From: Tom Tromey <tromey at redhat dot com>
- To: gdb-patches at sourceware dot org
- Date: Fri, 15 Apr 2011 09:04:51 -0600
- Subject: FYI: fix minor .gdb_index bug
I'm checking this in.
In the .gdb_index creation code, the logic for detecting a duplicate CU
was wrong. This caused the index to be a bit bigger than strictly
necessary.
This patch fixes the problem. It saved a miniscule amount of space
(2052 bytes for libstdc++, or 0.6% of the size of the index).
Thanks go to Mark Wielaard for discovering this bug.
Tom
2011-04-15 Tom Tromey <tromey@redhat.com>
* dwarf2read.c (add_index_entry): Use VEC_last, not VEC_length.
Index: dwarf2read.c
===================================================================
RCS file: /cvs/src/src/gdb/dwarf2read.c,v
retrieving revision 1.523
diff -u -r1.523 dwarf2read.c
--- dwarf2read.c 9 Apr 2011 15:20:38 -0000 1.523
+++ dwarf2read.c 15 Apr 2011 15:03:23 -0000
@@ -15491,7 +15491,7 @@
/* Don't push an index twice. Due to how we add entries we only
have to check the last one. */
if (VEC_empty (offset_type, (*slot)->cu_indices)
- || VEC_length (offset_type, (*slot)->cu_indices) != cu_index)
+ || VEC_last (offset_type, (*slot)->cu_indices) != cu_index)
VEC_safe_push (offset_type, (*slot)->cu_indices, cu_index);
}