summaryrefslogtreecommitdiff
path: root/gdb
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
commit15eb8d6dc2e2d7d3aae160e80463907fb00357f7 (patch)
treee96765cc1cae8d8b9d03169538b9d12542f9a86a /gdb
parent2ce15c8af7e975a9d37304cccb20a1957fcde88e (diff)
downloadgdb-15eb8d6dc2e2d7d3aae160e80463907fb00357f7.tar.gz
* symfile.c (add_psymbol_to_bcache): Make 'psymbol' static again.
Zero the 'value' field.
Diffstat (limited to 'gdb')
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/symfile.c12
2 files changed, 14 insertions, 3 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index 659e9d12a6a..bf20ded4d37 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2009-11-05 Tom Tromey <tromey@redhat.com>
+
+ * symfile.c (add_psymbol_to_bcache): Make 'psymbol' static again.
+ Zero the 'value' field.
+
2009-11-05 Doug Evans <dje@google.com>
* amd64-tdep.c (amd64_init_frame_cache): Enhance comment describing
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 7461ed62888..117f17fb163 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)
{