aboutsummaryrefslogtreecommitdiff
path: root/gdb/dbxread.c
diff options
context:
space:
mode:
authorTom Tromey <tom@tromey.com>2018-05-20 23:58:35 -0600
committerTom Tromey <tom@tromey.com>2018-07-20 09:42:41 -0600
commita60f3166aa946336c68e7a873d5eed6061b5733c (patch)
tree21da694fb78e8893f2cbb256330907c77998cafd /gdb/dbxread.c
parent56ba65a04713fd8ff23908d4c57f75427317b8bb (diff)
downloadgdb-a60f3166aa946336c68e7a873d5eed6061b5733c.zip
gdb-a60f3166aa946336c68e7a873d5eed6061b5733c.tar.gz
gdb-a60f3166aa946336c68e7a873d5eed6061b5733c.tar.bz2
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.
Diffstat (limited to 'gdb/dbxread.c')
-rw-r--r--gdb/dbxread.c43
1 files changed, 22 insertions, 21 deletions
diff --git a/gdb/dbxread.c b/gdb/dbxread.c
index 996da27..ad3f2a9 100644
--- a/gdb/dbxread.c
+++ b/gdb/dbxread.c
@@ -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 context_stack *newobj;
+ struct context_stack cstk;
/* 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
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;
- newobj = pop_context ();
+ cstk = pop_context ();
/* Make a block for the local symbols within. */
- block = finish_block (newobj->name, &local_symbols,
- newobj->old_blocks, NULL,
- newobj->start_addr, newobj->start_addr + valu);
+ block = finish_block (cstk.name, &local_symbols,
+ cstk.old_blocks, NULL,
+ cstk.start_addr, cstk.start_addr + valu);
/* For C++, set the block's scope. */
- if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
- cp_set_block_scope (newobj->name, block, &objfile->objfile_obstack);
+ if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
+ cp_set_block_scope (cstk.name, block, &objfile->objfile_obstack);
/* May be switching to an assembler file which may not be using
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;
}
- newobj = pop_context ();
- if (desc != newobj->depth)
+ cstk = pop_context ();
+ if (desc != cstk.depth)
lbrac_mismatch_complaint (symnum);
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 "
"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
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.
??? Which compilers? Is this ever harmful?. */
- if (newobj->start_addr > valu)
+ if (cstk.start_addr > valu)
{
complaint (_("block start larger than block end"));
- newobj->start_addr = valu;
+ cstk.start_addr = valu;
}
/* Make a block for the local symbols within. */
- finish_block (0, &local_symbols, newobj->old_blocks, NULL,
- newobj->start_addr, valu);
+ finish_block (0, &local_symbols, cstk.old_blocks, NULL,
+ cstk.start_addr, valu);
}
}
else
@@ -2876,7 +2877,7 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
within_function = 1;
- if (context_stack_depth > 1)
+ if (get_context_stack_depth () > 1)
{
complaint (_("unmatched N_LBRAC before symtab pos %d"),
symnum);
@@ -2887,15 +2888,15 @@ process_one_symbol (int type, int desc, CORE_ADDR valu, const char *name,
{
struct block *block;
- newobj = pop_context ();
+ cstk = pop_context ();
/* Make a block for the local symbols within. */
- block = finish_block (newobj->name, &local_symbols,
- newobj->old_blocks, NULL,
- newobj->start_addr, valu);
+ block = finish_block (cstk.name, &local_symbols,
+ cstk.old_blocks, NULL,
+ cstk.start_addr, valu);
/* For C++, set the block's scope. */
- if (SYMBOL_LANGUAGE (newobj->name) == language_cplus)
- cp_set_block_scope (newobj->name, block,
+ if (SYMBOL_LANGUAGE (cstk.name) == language_cplus)
+ cp_set_block_scope (cstk.name, block,
&objfile->objfile_obstack);
}