This is the mail archive of the
gdb-patches@sourceware.org
mailing list for the GDB project.
Re: Regression for gdb.stabs/gdb11479.exp [Re: [patch 1/2] Use custom hash function with bcache]
On 09/01/2010 02:37 PM, Tom Tromey wrote:
"Doug" == Doug Evans<dje@google.com> writes:
Doug> One would expect the original code to have done a memset too, instead
Doug> of using "static". Presumably it didn't for performance reasons. Do
Doug> we know if the performance concerns were real?
No, we don't know.
It is safest to just revert to what it was before.
Sounds good to me. Patch attached.
Sami
Fix custom hash regression.
2010-09-01 Sami Wagiaalla <swagiaal@redhat.com>
* psymtab.c (add_psymbol_to_bcache): Declare psymbol
as static.
memset psymbol.ginfo.value to 0.
diff --git a/gdb/psymtab.c b/gdb/psymtab.c
index a5d2f98..24dd301 100644
--- a/gdb/psymtab.c
+++ b/gdb/psymtab.c
@@ -1376,7 +1376,15 @@ add_psymbol_to_bcache (char *name, int namelength, int copy_name,
enum language language, struct objfile *objfile,
int *added)
{
- struct partial_symbol psymbol;
+ /* psymbol is static so that there will be no uninitialized gaps in the
+ structure which might contain random data, causing cache misses in
+ bcache. */
+ static struct partial_symbol psymbol;
+
+ /* However, we must ensure that the entire 'value' field has been
+ zeroed before assigning to it, because an assignment may not
+ write the entire field. */
+ memset (&psymbol.ginfo.value, 0, sizeof (psymbol.ginfo.value));
/* val and coreaddr are mutually exclusive, one of them *will* be zero */
if (val != 0)