* buildsym.c (struct pending_block): Move from buildsym.h.
authorTom Tromey <tromey@redhat.com>
Mon, 10 Dec 2012 17:09:29 +0000 (17:09 +0000)
committerTom Tromey <tromey@redhat.com>
Mon, 10 Dec 2012 17:09:29 +0000 (17:09 +0000)
(pending_blocks): Likewise; now static.
(pending_block_obstack): New global.
(free_pending_blocks): Free blocks.
(record_pending_block): Use pending_block_obstack.
* buildsym.h (struct pending_block): Move definition to
buildsym.c.
(pending_blocks): Don't declare.

gdb/ChangeLog
gdb/buildsym.c
gdb/buildsym.h

index b3b02618b9c104325cdfbc47a93d5c97add50d2b..fc2678a10e730886f8ff926096ba6243a4b0d1d2 100644 (file)
@@ -1,3 +1,14 @@
+2012-12-10  Tom Tromey  <tromey@redhat.com>
+
+       * buildsym.c (struct pending_block): Move from buildsym.h.
+       (pending_blocks): Likewise; now static.
+       (pending_block_obstack): New global.
+       (free_pending_blocks): Free blocks.
+       (record_pending_block): Use pending_block_obstack.
+       * buildsym.h (struct pending_block): Move definition to
+       buildsym.c.
+       (pending_blocks): Don't declare.
+
 2012-12-10  Pedro Alves  <palves@redhat.com>
 
        * solib-svr4.c (svr4_solib_create_inferior_hook) [_SCO_DS]: Remove
index 8f2e7327aff67dbd4a3bd4542e0f548afce41ebd..c3e85162a86cbf44422a9db999704d173be18cf1 100644 (file)
@@ -83,6 +83,25 @@ static struct obstack pending_addrmap_obstack;
    the end, then we just toss the addrmap.  */
 static int pending_addrmap_interesting;
 
+/* An obstack used for allocating pending blocks.  */
+
+static struct obstack pending_block_obstack;
+
+/* List of blocks already made (lexical contexts already closed).
+   This is used at the end to make the blockvector.  */
+
+struct pending_block
+  {
+    struct pending_block *next;
+    struct block *block;
+  };
+
+/* Pointer to the head of a linked list of symbol blocks which have
+   already been finalized (lexical contexts already closed) and which
+   are just waiting to be built into a blockvector when finalizing the
+   associated symtab.  */
+
+static struct pending_block *pending_blocks;
 \f
 static int compare_line_numbers (const void *ln1p, const void *ln2p);
 
@@ -205,9 +224,11 @@ really_free_pendings (void *dummy)
 void
 free_pending_blocks (void)
 {
-  /* The links are made in the objfile_obstack, so we only need to
-     reset PENDING_BLOCKS.  */
-  pending_blocks = NULL;
+  if (pending_blocks != NULL)
+    {
+      obstack_free (&pending_block_obstack, NULL);
+      pending_blocks = NULL;
+    }
 }
 
 /* Take one of the lists of symbols and make a block from it.  Keep
@@ -418,8 +439,11 @@ record_pending_block (struct objfile *objfile, struct block *block,
 {
   struct pending_block *pblock;
 
+  if (pending_blocks == NULL)
+    obstack_init (&pending_block_obstack);
+
   pblock = (struct pending_block *)
-    obstack_alloc (&objfile->objfile_obstack, sizeof (struct pending_block));
+    obstack_alloc (&pending_block_obstack, sizeof (struct pending_block));
   pblock->block = block;
   if (opblock)
     {
index 0db96bf2f96878171796f7f401acf2911e648531..b7d4a76bc3b08b7aaaddac2abf4bd7b8e7ae9c44 100644 (file)
@@ -37,6 +37,7 @@ struct addrmap;
    this technique.  */
 
 struct block;
+struct pending_block;
 
 #ifndef EXTERN
 #define        EXTERN extern
@@ -177,21 +178,6 @@ EXTERN int context_stack_size;
 
 EXTERN int within_function;
 
-/* List of blocks already made (lexical contexts already closed).
-   This is used at the end to make the blockvector.  */
-
-struct pending_block
-  {
-    struct pending_block *next;
-    struct block *block;
-  };
-
-/* Pointer to the head of a linked list of symbol blocks which have
-   already been finalized (lexical contexts already closed) and which
-   are just waiting to be built into a blockvector when finalizing the
-   associated symtab.  */
-
-EXTERN struct pending_block *pending_blocks;
 \f
 
 struct subfile_stack