Fix custom hash regression. 2010-09-01 Sami Wagiaalla * 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)