aboutsummaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorTom Tromey <tromey@redhat.com>2009-11-05 22:19:09 +0000
committerTom Tromey <tromey@redhat.com>2009-11-05 22:19:09 +0000
commit69a943f00538328c36e1d1005f5357a61a71c7fc (patch)
treeb8d56745224f18f8b254046c15060743d719d1d1 /gdb/symfile.c
parentbba66b87eff7244120daed405cf524916e1652a4 (diff)
downloadgdb-69a943f00538328c36e1d1005f5357a61a71c7fc.zip
gdb-69a943f00538328c36e1d1005f5357a61a71c7fc.tar.gz
gdb-69a943f00538328c36e1d1005f5357a61a71c7fc.tar.bz2
* symfile.c (add_psymbol_to_bcache): Make 'psymbol' static again.
Zero the 'value' field.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7461ed6..117f17f 100644
--- a/gdb/symfile.c
+++ b/gdb/symfile.c
@@ -3105,9 +3105,15 @@ add_psymbol_to_bcache (char *name, int namelength, domain_enum domain,
enum language language, struct objfile *objfile,
int *added)
{
- struct partial_symbol psymbol;
-
- memset (&psymbol, 0, sizeof (struct partial_symbol));
+ /* 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)
{