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:
parent
56ba65a047
commit
a60f3166aa
7 changed files with 160 additions and 119 deletions
|
@ -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. */
|
||||
typedef void (record_line_ftype) (struct subfile *subfile, int line,
|
||||
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 *pop_context (void);
|
||||
extern struct context_stack pop_context ();
|
||||
|
||||
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 ();
|
||||
|
||||
/* 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
|
||||
|
||||
#endif /* defined (BUILDSYM_H) */
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue