aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2009-03-24 01:32:46 +0000
committerJoel Brobecker <brobecker@gnat.com>2009-03-24 01:32:46 +0000
commit24be086dc45e40b381af7b5c565002f47161305a (patch)
tree120950c00d62aece5ac8ac182ea9df24fe2ecfca
parentcb01cfba2cd4edd8533f948d8dbf78027a6507a7 (diff)
downloadgdb-24be086dc45e40b381af7b5c565002f47161305a.zip
gdb-24be086dc45e40b381af7b5c565002f47161305a.tar.gz
gdb-24be086dc45e40b381af7b5c565002f47161305a.tar.bz2
* buildsym.c (end_symtab): If we ignore the subfiles, then
unlink the associated symtabs if they were already allocated.
-rw-r--r--gdb/ChangeLog5
-rw-r--r--gdb/buildsym.c26
2 files changed, 31 insertions, 0 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog
index cf0b123..1a34fb2 100644
--- a/gdb/ChangeLog
+++ b/gdb/ChangeLog
@@ -1,3 +1,8 @@
+2009-03-23 Joel Brobecker <brobecker@adacore.com>
+
+ * buildsym.c (end_symtab): If we ignore the subfiles, then
+ unlink the associated symtabs if they were already allocated.
+
2009-03-23 Jerome Guitton <guitton@adacore.com>
Provide a way to force building of GDB with libcurses.
diff --git a/gdb/buildsym.c b/gdb/buildsym.c
index 55ace15..6de817f 100644
--- a/gdb/buildsym.c
+++ b/gdb/buildsym.c
@@ -1118,6 +1118,32 @@ end_symtab (CORE_ADDR end_addr, struct objfile *objfile, int section)
symtab->primary = 0;
}
+ else
+ {
+ if (subfile->symtab)
+ {
+ /* Since we are ignoring that subfile, we also need
+ to unlink the associated empty symtab that we created.
+ Otherwise, we can into trouble because various parts
+ such as the block-vector are uninitialized whereas
+ the rest of the code assumes that they are.
+
+ We can only unlink the symtab because it was allocated
+ on the objfile obstack. */
+ struct symtab *s;
+
+ if (objfile->symtabs == subfile->symtab)
+ objfile->symtabs = objfile->symtabs->next;
+ else
+ ALL_OBJFILE_SYMTABS (objfile, s)
+ if (s->next == subfile->symtab)
+ {
+ s->next = s->next->next;
+ break;
+ }
+ subfile->symtab = NULL;
+ }
+ }
if (subfile->name != NULL)
{
xfree ((void *) subfile->name);