Move the context stack to buildsym_compunit

This moves the context stack globals to be members of
buildsym_compunit, changing the type to a std::vector in the process.

Because the callers expect the context stack object to be valid after
being popped, at Simon's suggestion I've changed pop_context to return
the object rather than the pointer.

gdb/ChangeLog
2018-07-20  Tom Tromey  <tom@tromey.com>

	* coffread.c (coff_symtab_read): Update.
	* xcoffread.c (read_xcoff_symtab): Update.
	* dwarf2read.c (new_symbol): Update.
	(read_func_scope, read_lexical_block_scope): Update.
	* dbxread.c (process_one_symbol): Update.
	* buildsym.h (context_stack, context_stack_depth): Don't declare.
	(outermost_context_p): Remove macro.
	(outermost_context_p, get_current_context_stack)
	(get_context_stack_depth): Declare.
	(pop_context): Return struct context_stack.
	* buildsym.c (struct buildsym_compunit) <m_context_stack: New
	member.
	(context_stack_size): Remove.
	(INITIAL_CONTEXT_STACK_SIZE): Remove.
	(prepare_for_building, end_symtab_get_static_block)
	(augment_type_symtab, push_context): Update.
	(pop_context): Return struct context_stack.
	(outermost_context_p, get_current_context_stack)
	(get_context_stack_depth): New functions.
	(buildsym_init): Update.
This commit is contained in:
Tom Tromey 2018-05-20 23:58:35 -06:00
parent 56ba65a047
commit a60f3166aa
7 changed files with 160 additions and 119 deletions

View file

@ -1,3 +1,26 @@
2018-07-20 Tom Tromey <tom@tromey.com>
* coffread.c (coff_symtab_read): Update.
* xcoffread.c (read_xcoff_symtab): Update.
* dwarf2read.c (new_symbol): Update.
(read_func_scope, read_lexical_block_scope): Update.
* dbxread.c (process_one_symbol): Update.
* buildsym.h (context_stack, context_stack_depth): Don't declare.
(outermost_context_p): Remove macro.
(outermost_context_p, get_current_context_stack)
(get_context_stack_depth): Declare.
(pop_context): Return struct context_stack.
* buildsym.c (struct buildsym_compunit) <m_context_stack: New
member.
(context_stack_size): Remove.
(INITIAL_CONTEXT_STACK_SIZE): Remove.
(prepare_for_building, end_symtab_get_static_block)
(augment_type_symtab, push_context): Update.
(pop_context): Return struct context_stack.
(outermost_context_p, get_current_context_stack)
(get_context_stack_depth): New functions.
(buildsym_init): Update.
2018-07-20 Tom Tromey <tom@tromey.com> 2018-07-20 Tom Tromey <tom@tromey.com>
* rust-exp.y: Now a pure parser. Update all rules. * rust-exp.y: Now a pure parser. Update all rules.

View file

@ -210,6 +210,10 @@ struct buildsym_compunit
/* Global "using" directives. */ /* Global "using" directives. */
struct using_direct *m_global_using_directives = nullptr; struct using_direct *m_global_using_directives = nullptr;
/* The stack of contexts that are pushed by push_context and popped
by pop_context. */
std::vector<struct context_stack> m_context_stack;
}; };
/* The work-in-progress of the compunit we are building. /* The work-in-progress of the compunit we are building.
@ -257,10 +261,6 @@ struct pending_block
static struct pending_block *pending_blocks; static struct pending_block *pending_blocks;
/* Currently allocated size of context stack. */
static int context_stack_size;
static void free_buildsym_compunit (void); static void free_buildsym_compunit (void);
static int compare_line_numbers (const void *ln1p, const void *ln2p); static int compare_line_numbers (const void *ln1p, const void *ln2p);
@ -275,7 +275,6 @@ static void free_pending_blocks ();
needed, and realloc'd down to the size actually used, when needed, and realloc'd down to the size actually used, when
completed. */ completed. */
#define INITIAL_CONTEXT_STACK_SIZE 10
#define INITIAL_LINE_VECTOR_LENGTH 1000 #define INITIAL_LINE_VECTOR_LENGTH 1000
@ -1025,8 +1024,6 @@ prepare_for_building ()
{ {
local_symbols = NULL; local_symbols = NULL;
context_stack_depth = 0;
/* These should have been reset either by successful completion of building /* These should have been reset either by successful completion of building
a symtab, or by the scoped_free_pendings destructor. */ a symtab, or by the scoped_free_pendings destructor. */
gdb_assert (file_symbols == NULL); gdb_assert (file_symbols == NULL);
@ -1215,15 +1212,15 @@ end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
/* Finish the lexical context of the last function in the file; pop /* Finish the lexical context of the last function in the file; pop
the context stack. */ the context stack. */
if (context_stack_depth > 0) if (!buildsym_compunit->m_context_stack.empty ())
{ {
struct context_stack *cstk = pop_context (); struct context_stack cstk = pop_context ();
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
finish_block (cstk->name, &local_symbols, cstk->old_blocks, NULL, finish_block (cstk.name, &local_symbols, cstk.old_blocks, NULL,
cstk->start_addr, end_addr); cstk.start_addr, end_addr);
if (context_stack_depth > 0) if (!buildsym_compunit->m_context_stack.empty ())
{ {
/* This is said to happen with SCO. The old coffread.c /* This is said to happen with SCO. The old coffread.c
code simply emptied the context stack, so we do the code simply emptied the context stack, so we do the
@ -1231,7 +1228,7 @@ end_symtab_get_static_block (CORE_ADDR end_addr, int expandable, int required)
believed to happen in most cases (even for coffread.c); believed to happen in most cases (even for coffread.c);
it used to be an abort(). */ it used to be an abort(). */
complaint (_("Context stack not empty in end_symtab")); complaint (_("Context stack not empty in end_symtab"));
context_stack_depth = 0; buildsym_compunit->m_context_stack.clear ();
} }
} }
@ -1575,11 +1572,8 @@ augment_type_symtab (void)
struct compunit_symtab *cust = buildsym_compunit->compunit_symtab; struct compunit_symtab *cust = buildsym_compunit->compunit_symtab;
const struct blockvector *blockvector = COMPUNIT_BLOCKVECTOR (cust); const struct blockvector *blockvector = COMPUNIT_BLOCKVECTOR (cust);
if (context_stack_depth > 0) if (!buildsym_compunit->m_context_stack.empty ())
{
complaint (_("Context stack not empty in augment_type_symtab")); complaint (_("Context stack not empty in augment_type_symtab"));
context_stack_depth = 0;
}
if (pending_blocks != NULL) if (pending_blocks != NULL)
complaint (_("Blocks in a type symtab")); complaint (_("Blocks in a type symtab"));
if (buildsym_compunit->m_pending_macros != NULL) if (buildsym_compunit->m_pending_macros != NULL)
@ -1619,17 +1613,11 @@ augment_type_symtab (void)
struct context_stack * struct context_stack *
push_context (int desc, CORE_ADDR valu) push_context (int desc, CORE_ADDR valu)
{ {
struct context_stack *newobj; gdb_assert (buildsym_compunit != nullptr);
if (context_stack_depth == context_stack_size) buildsym_compunit->m_context_stack.emplace_back ();
{ struct context_stack *newobj = &buildsym_compunit->m_context_stack.back ();
context_stack_size *= 2;
context_stack = (struct context_stack *)
xrealloc ((char *) context_stack,
(context_stack_size * sizeof (struct context_stack)));
}
newobj = &context_stack[context_stack_depth++];
newobj->depth = desc; newobj->depth = desc;
newobj->locals = local_symbols; newobj->locals = local_symbols;
newobj->old_blocks = pending_blocks; newobj->old_blocks = pending_blocks;
@ -1647,11 +1635,14 @@ push_context (int desc, CORE_ADDR valu)
/* Pop a context block. Returns the address of the context block just /* Pop a context block. Returns the address of the context block just
popped. */ popped. */
struct context_stack * struct context_stack
pop_context (void) pop_context ()
{ {
gdb_assert (context_stack_depth > 0); gdb_assert (buildsym_compunit != nullptr);
return (&context_stack[--context_stack_depth]); gdb_assert (!buildsym_compunit->m_context_stack.empty ());
struct context_stack result = buildsym_compunit->m_context_stack.back ();
buildsym_compunit->m_context_stack.pop_back ();
return result;
} }
@ -1735,6 +1726,35 @@ get_global_using_directives ()
return &buildsym_compunit->m_global_using_directives; return &buildsym_compunit->m_global_using_directives;
} }
/* See buildsym.h. */
bool
outermost_context_p ()
{
gdb_assert (buildsym_compunit != nullptr);
return buildsym_compunit->m_context_stack.empty ();
}
/* See buildsym.h. */
struct context_stack *
get_current_context_stack ()
{
gdb_assert (buildsym_compunit != nullptr);
if (buildsym_compunit->m_context_stack.empty ())
return nullptr;
return &buildsym_compunit->m_context_stack.back ();
}
/* See buildsym.h. */
int
get_context_stack_depth ()
{
gdb_assert (buildsym_compunit != nullptr);
return buildsym_compunit->m_context_stack.size ();
}
/* Initialize anything that needs initializing when starting to read a /* Initialize anything that needs initializing when starting to read a
@ -1746,14 +1766,6 @@ buildsym_init ()
{ {
pending_addrmap_interesting = 0; pending_addrmap_interesting = 0;
/* Context stack is initially empty. Allocate first one with room
for a few levels; reuse it forever afterward. */
if (context_stack == NULL)
{
context_stack_size = INITIAL_CONTEXT_STACK_SIZE;
context_stack = XNEWVEC (struct context_stack, context_stack_size);
}
/* Ensure the scoped_free_pendings destructor was called after /* Ensure the scoped_free_pendings destructor was called after
the last time. */ the last time. */
gdb_assert (free_pendings == NULL); gdb_assert (free_pendings == NULL);

View file

@ -133,15 +133,6 @@ struct context_stack
}; };
EXTERN struct context_stack *context_stack;
/* Index of first unused entry in context stack. */
EXTERN int context_stack_depth;
/* Non-zero if the context stack is empty. */
#define outermost_context_p() (context_stack_depth == 0)
/* The type of the record_line function. */ /* The type of the record_line function. */
typedef void (record_line_ftype) (struct subfile *subfile, int line, typedef void (record_line_ftype) (struct subfile *subfile, int line,
CORE_ADDR pc); CORE_ADDR pc);
@ -201,7 +192,7 @@ extern void buildsym_init ();
extern struct context_stack *push_context (int desc, CORE_ADDR valu); extern struct context_stack *push_context (int desc, CORE_ADDR valu);
extern struct context_stack *pop_context (void); extern struct context_stack pop_context ();
extern record_line_ftype record_line; extern record_line_ftype record_line;
@ -270,6 +261,19 @@ extern void set_local_using_directives (struct using_direct *new_local);
extern struct using_direct **get_global_using_directives (); extern struct using_direct **get_global_using_directives ();
/* True if the context stack is empty. */
extern bool outermost_context_p ();
/* Return the top of the context stack, or nullptr if there is an
entry. */
extern struct context_stack *get_current_context_stack ();
/* Return the context stack depth. */
extern int get_context_stack_depth ();
#undef EXTERN #undef EXTERN
#endif /* defined (BUILDSYM_H) */ #endif /* defined (BUILDSYM_H) */

View file

@ -1100,7 +1100,7 @@ coff_symtab_read (minimal_symbol_reader &reader,
break; break;
} }
newobj = pop_context (); struct context_stack cstk = pop_context ();
/* Stack must be empty now. */ /* Stack must be empty now. */
if (!outermost_context_p () || newobj == NULL) if (!outermost_context_p () || newobj == NULL)
{ {
@ -1135,8 +1135,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
enter_linenos (fcn_line_ptr, fcn_first_line, enter_linenos (fcn_line_ptr, fcn_first_line,
fcn_last_line, objfile); fcn_last_line, objfile);
finish_block (newobj->name, &local_symbols, newobj->old_blocks, finish_block (cstk.name, &local_symbols, cstk.old_blocks,
NULL, newobj->start_addr, NULL, cstk.start_addr,
fcn_cs_saved.c_value fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize + fcn_aux_saved.x_sym.x_misc.x_fsize
+ ANOFFSET (objfile->section_offsets, + ANOFFSET (objfile->section_offsets,
@ -1163,8 +1163,8 @@ coff_symtab_read (minimal_symbol_reader &reader,
break; break;
} }
newobj = pop_context (); struct context_stack cstk = pop_context ();
if (depth-- != newobj->depth) if (depth-- != cstk.depth)
{ {
complaint (_("Mismatched .eb symbol ignored " complaint (_("Mismatched .eb symbol ignored "
"starting at symnum %d"), "starting at symnum %d"),
@ -1177,11 +1177,11 @@ coff_symtab_read (minimal_symbol_reader &reader,
cs->c_value + ANOFFSET (objfile->section_offsets, cs->c_value + ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile)); SECT_OFF_TEXT (objfile));
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
finish_block (0, &local_symbols, newobj->old_blocks, NULL, finish_block (0, &local_symbols, cstk.old_blocks, NULL,
newobj->start_addr, tmpaddr); cstk.start_addr, tmpaddr);
} }
/* Now pop locals of block just finished. */ /* Now pop locals of block just finished. */
local_symbols = newobj->locals; local_symbols = cstk.locals;
} }
break; break;

View file

@ -2448,6 +2448,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
{ {
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct context_stack *newobj; struct context_stack *newobj;
struct context_stack cstk;
/* This remembers the address of the start of a function. It is /* This remembers the address of the start of a function. It is
used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries used because in Solaris 2, N_LBRAC, N_RBRAC, and N_SLINE entries
are relative to the current function's start address. On systems are relative to the current function's start address. On systems
@ -2512,16 +2513,16 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
} }
within_function = 0; within_function = 0;
newobj = pop_context (); cstk = pop_context ();
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
block = finish_block (newobj->name, &local_symbols, block = finish_block (cstk.name, &local_symbols,
newobj->old_blocks, NULL, cstk.old_blocks, NULL,
newobj->start_addr, newobj->start_addr + valu); cstk.start_addr, cstk.start_addr + valu);
/* For C++, set the block's scope. */ /* For C++, set the block's scope. */
if (SYMBOL_LANGUAGE (newobj->name) == language_cplus) if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
cp_set_block_scope (newobj->name, block, &objfile->objfile_obstack); cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack);
/* May be switching to an assembler file which may not be using /* May be switching to an assembler file which may not be using
block relative stabs, so reset the offset. */ block relative stabs, so reset the offset. */
@ -2568,8 +2569,8 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
break; break;
} }
newobj = pop_context (); cstk = pop_context ();
if (desc != newobj->depth) if (desc != cstk.depth)
lbrac_mismatch_complaint (symnum); lbrac_mismatch_complaint (symnum);
if (local_symbols != NULL) if (local_symbols != NULL)
@ -2581,9 +2582,9 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
complaint (_("misplaced N_LBRAC entry; discarding local " complaint (_("misplaced N_LBRAC entry; discarding local "
"symbols which have no enclosing block")); "symbols which have no enclosing block"));
} }
local_symbols = newobj->locals; local_symbols = cstk.locals;
if (context_stack_depth > 1) if (get_context_stack_depth () > 1)
{ {
/* This is not the outermost LBRAC...RBRAC pair in the /* This is not the outermost LBRAC...RBRAC pair in the
function, its local symbols preceded it, and are the ones function, its local symbols preceded it, and are the ones
@ -2596,14 +2597,14 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
/* Muzzle a compiler bug that makes end < start. /* Muzzle a compiler bug that makes end < start.
??? Which compilers? Is this ever harmful?. */ ??? Which compilers? Is this ever harmful?. */
if (newobj->start_addr > valu) if (cstk.start_addr > valu)
{ {
complaint (_("block start larger than block end")); complaint (_("block start larger than block end"));
newobj->start_addr = valu; cstk.start_addr = valu;
} }
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
finish_block (0, &local_symbols, newobj->old_blocks, NULL, finish_block (0, &local_symbols, cstk.old_blocks, NULL,
newobj->start_addr, valu); cstk.start_addr, valu);
} }
} }
else else
@ -2876,7 +2877,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
within_function = 1; within_function = 1;
if (context_stack_depth > 1) if (get_context_stack_depth () > 1)
{ {
complaint (_("unmatched N_LBRAC before symtab pos %d"), complaint (_("unmatched N_LBRAC before symtab pos %d"),
symnum); symnum);
@ -2887,15 +2888,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
{ {
struct block *block; struct block *block;
newobj = pop_context (); cstk = pop_context ();
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
block = finish_block (newobj->name, &local_symbols, block = finish_block (cstk.name, &local_symbols,
newobj->old_blocks, NULL, cstk.old_blocks, NULL,
newobj->start_addr, valu); cstk.start_addr, valu);
/* For C++, set the block's scope. */ /* For C++, set the block's scope. */
if (SYMBOL_LANGUAGE (newobj->name) == language_cplus) if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
cp_set_block_scope (newobj->name, block, cp_set_block_scope (cstk.name, block,
&objfile->objfile_obstack); &objfile->objfile_obstack);
} }

View file

@ -13683,10 +13683,10 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
} }
} }
newobj = pop_context (); struct context_stack cstk = pop_context ();
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
block = finish_block (newobj->name, &local_symbols, newobj->old_blocks, block = finish_block (cstk.name, &local_symbols, cstk.old_blocks,
newobj->static_link, lowpc, highpc); cstk.static_link, lowpc, highpc);
/* For C++, set the block's scope. */ /* For C++, set the block's scope. */
if ((cu->language == language_cplus if ((cu->language == language_cplus
@ -13700,7 +13700,7 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
/* If we have address ranges, record them. */ /* If we have address ranges, record them. */
dwarf2_record_block_ranges (die, block, baseaddr, cu); dwarf2_record_block_ranges (die, block, baseaddr, cu);
gdbarch_make_symbol_special (gdbarch, newobj->name, objfile); gdbarch_make_symbol_special (gdbarch, cstk.name, objfile);
/* Attach template arguments to function. */ /* Attach template arguments to function. */
if (!template_args.empty ()) if (!template_args.empty ())
@ -13720,8 +13720,8 @@ read_func_scope (struct die_info *die, struct dwarf2_cu *cu)
a function declares a class that has methods). This means that a function declares a class that has methods). This means that
when we finish processing a function scope, we may need to go when we finish processing a function scope, we may need to go
back to building a containing block's symbol lists. */ back to building a containing block's symbol lists. */
local_symbols = newobj->locals; local_symbols = cstk.locals;
set_local_using_directives (newobj->local_using_directives); set_local_using_directives (cstk.local_using_directives);
/* If we've finished processing a top-level function, subsequent /* If we've finished processing a top-level function, subsequent
symbols go in the file symbol list. */ symbols go in the file symbol list. */
@ -13737,7 +13737,6 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
{ {
struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile; struct objfile *objfile = cu->per_cu->dwarf2_per_objfile->objfile;
struct gdbarch *gdbarch = get_objfile_arch (objfile); struct gdbarch *gdbarch = get_objfile_arch (objfile);
struct context_stack *newobj;
CORE_ADDR lowpc, highpc; CORE_ADDR lowpc, highpc;
struct die_info *child_die; struct die_info *child_die;
CORE_ADDR baseaddr; CORE_ADDR baseaddr;
@ -13777,13 +13776,13 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
} }
} }
inherit_abstract_dies (die, cu); inherit_abstract_dies (die, cu);
newobj = pop_context (); struct context_stack cstk = pop_context ();
if (local_symbols != NULL || (*get_local_using_directives ()) != NULL) if (local_symbols != NULL || (*get_local_using_directives ()) != NULL)
{ {
struct block *block struct block *block
= finish_block (0, &local_symbols, newobj->old_blocks, NULL, = finish_block (0, &local_symbols, cstk.old_blocks, NULL,
newobj->start_addr, highpc); cstk.start_addr, highpc);
/* Note that recording ranges after traversing children, as we /* Note that recording ranges after traversing children, as we
do here, means that recording a parent's ranges entails do here, means that recording a parent's ranges entails
@ -13797,8 +13796,8 @@ read_lexical_block_scope (struct die_info *die, struct dwarf2_cu *cu)
to do. */ to do. */
dwarf2_record_block_ranges (die, block, baseaddr, cu); dwarf2_record_block_ranges (die, block, baseaddr, cu);
} }
local_symbols = newobj->locals; local_symbols = cstk.locals;
set_local_using_directives (newobj->local_using_directives); set_local_using_directives (cstk.local_using_directives);
} }
/* Read in DW_TAG_call_site and insert it to CU->call_site_htab. */ /* Read in DW_TAG_call_site and insert it to CU->call_site_htab. */
@ -21348,13 +21347,14 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
} }
break; break;
case DW_TAG_formal_parameter: case DW_TAG_formal_parameter:
{
/* If we are inside a function, mark this as an argument. If /* If we are inside a function, mark this as an argument. If
not, we might be looking at an argument to an inlined function not, we might be looking at an argument to an inlined function
when we do not have enough information to show inlined frames; when we do not have enough information to show inlined frames;
pretend it's a local variable in that case so that the user can pretend it's a local variable in that case so that the user can
still see it. */ still see it. */
if (!outermost_context_p () struct context_stack *curr = get_current_context_stack ();
&& context_stack[context_stack_depth - 1].name != NULL) if (curr != nullptr && curr->name != nullptr)
SYMBOL_IS_ARGUMENT (sym) = 1; SYMBOL_IS_ARGUMENT (sym) = 1;
attr = dwarf2_attr (die, DW_AT_location, cu); attr = dwarf2_attr (die, DW_AT_location, cu);
if (attr) if (attr)
@ -21368,6 +21368,7 @@ new_symbol (struct die_info *die, struct type *type, struct dwarf2_cu *cu,
} }
list_to_add = cu->list_in_scope; list_to_add = cu->list_in_scope;
}
break; break;
case DW_TAG_unspecified_parameters: case DW_TAG_unspecified_parameters:
/* From varargs functions; gdb doesn't seem to have any /* From varargs functions; gdb doesn't seem to have any

View file

@ -1397,17 +1397,17 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
within_function = 0; within_function = 0;
break; break;
} }
newobj = pop_context (); struct context_stack cstk = pop_context ();
/* Stack must be empty now. */ /* Stack must be empty now. */
if (!outermost_context_p () || newobj == NULL) if (!outermost_context_p ())
{ {
ef_complaint (cs->c_symnum); ef_complaint (cs->c_symnum);
within_function = 0; within_function = 0;
break; break;
} }
finish_block (newobj->name, &local_symbols, newobj->old_blocks, finish_block (cstk.name, &local_symbols, cstk.old_blocks,
NULL, newobj->start_addr, NULL, cstk.start_addr,
(fcn_cs_saved.c_value (fcn_cs_saved.c_value
+ fcn_aux_saved.x_sym.x_misc.x_fsize + fcn_aux_saved.x_sym.x_misc.x_fsize
+ ANOFFSET (objfile->section_offsets, + ANOFFSET (objfile->section_offsets,
@ -1488,8 +1488,8 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
eb_complaint (cs->c_symnum); eb_complaint (cs->c_symnum);
break; break;
} }
newobj = pop_context (); struct context_stack cstk = pop_context ();
if (depth-- != newobj->depth) if (depth-- != cstk.depth)
{ {
eb_complaint (cs->c_symnum); eb_complaint (cs->c_symnum);
break; break;
@ -1497,14 +1497,14 @@ read_xcoff_symtab (struct objfile *objfile, struct partial_symtab *pst)
if (local_symbols && !outermost_context_p ()) if (local_symbols && !outermost_context_p ())
{ {
/* Make a block for the local symbols within. */ /* Make a block for the local symbols within. */
finish_block (newobj->name, &local_symbols, finish_block (cstk.name, &local_symbols,
newobj->old_blocks, NULL, cstk.old_blocks, NULL,
newobj->start_addr, cstk.start_addr,
(cs->c_value (cs->c_value
+ ANOFFSET (objfile->section_offsets, + ANOFFSET (objfile->section_offsets,
SECT_OFF_TEXT (objfile)))); SECT_OFF_TEXT (objfile))));
} }
local_symbols = newobj->locals; local_symbols = cstk.locals;
} }
break; break;