* dwarf2read.c (read_func_scope): Restore list_in_scope properly
authorJim Blandy <jimb@codesourcery.com>
Fri, 8 Nov 2002 20:05:10 +0000 (20:05 +0000)
committerJim Blandy <jimb@codesourcery.com>
Fri, 8 Nov 2002 20:05:10 +0000 (20:05 +0000)
when we finish a function a context.
* buildsym.h (outermost_context_p): New macro.
(Bug analyzed by David Edelsohn.)

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

index 7985ef7e009e6d273239353d73b926984e2c2801..38edccb4cc9a54c9f3f4c3f82d0611b09f11df61 100644 (file)
@@ -1,3 +1,10 @@
+2002-11-08  Jim Blandy  <jimb@redhat.com>
+
+       * dwarf2read.c (read_func_scope): Restore list_in_scope properly
+       when we finish a function a context.
+       * buildsym.h (outermost_context_p): New macro.
+       (Bug analyzed by David Edelsohn.)
+
 2002-11-08  Andrew Cagney  <ac131313@redhat.com>
 
        * blockframe.c: Include "dummy-frame.h".
index 8a252cb2b4c63fbccf496f3df63efa004fbf8885..968a579384534fe316f72fc0cb068565fe1e4d69 100644 (file)
@@ -179,6 +179,9 @@ EXTERN int context_stack_size;
 
 #define        pop_context() (&context_stack[--context_stack_depth]);
 
+/* Non-zero if the context stack is empty.  */
+#define outermost_context_p() (context_stack_depth == 0)
+
 /* Nonzero if within a function (so symbols should be local, if
    nothing says specifically).  */
 
index 7e017c6dfc0c8e0377a58d3c08b5861ab6505e55..13ddaea6530e73005e3edee11d01919d96df3a8e 100644 (file)
@@ -2021,7 +2021,10 @@ read_func_scope (struct die_info *die, struct objfile *objfile,
   local_symbols = new->locals;
   param_symbols = new->params;
 
-  list_in_scope = &file_symbols;
+  /* If we've finished processing a top-level function, subsequent
+     symbols go in the file symbol list.  */
+  if (outermost_context_p ())
+    list_in_scope = &file_symbols;
 }
 
 /* Process all the DIES contained within a lexical block scope.  Start