diff options
author | Tom Tromey <tom@tromey.com> | 2018-05-21 00:15:12 -0600 |
---|---|---|
committer | Tom Tromey <tom@tromey.com> | 2018-07-20 09:42:42 -0600 |
commit | 3c65e5b31cb5587773deff979099435b9687a0f4 (patch) | |
tree | b13e4e32406f0d0ef00600828133d4b564f7f7df /gdb/buildsym.c | |
parent | a60f3166aa946336c68e7a873d5eed6061b5733c (diff) | |
download | gdb-3c65e5b31cb5587773deff979099435b9687a0f4.zip gdb-3c65e5b31cb5587773deff979099435b9687a0f4.tar.gz gdb-3c65e5b31cb5587773deff979099435b9687a0f4.tar.bz2 |
Move current_subfile to buildsym_compunit
This moves the global current_subfile into buildsym_compunit.
gdb/ChangeLog
2018-07-20 Tom Tromey <tom@tromey.com>
* xcoffread.c (process_linenos): Update.
* stabsread.c (define_symbol, read_type, read_enum_type): Update.
* mdebugread.c (psymtab_to_symtab_1): Update.
* dwarf2read.c (setup_type_unit_groups)
(lnp_state_machine::handle_set_file, dwarf_record_line_p)
(lnp_state_machine::record_line, dwarf_decode_lines): Update.
* dbxread.c (process_one_symbol): Update.
* coffread.c (coff_symtab_read, enter_linenos)
(process_coff_symbol): Update.
* buildsym.h (current_subfile): Don't declare.
(get_current_subfile): Declare.
* buildsym.c (struct buildsym_compunit) <m_current_subfile>: New
member.
(start_subfile, free_buildsym_compunit, push_subfile)
(prepare_for_building, start_symtab): Update.
(get_current_subfile): New function.
Diffstat (limited to 'gdb/buildsym.c')
-rw-r--r-- | gdb/buildsym.c | 25 |
1 files changed, 18 insertions, 7 deletions
diff --git a/gdb/buildsym.c b/gdb/buildsym.c index aa7191d..620f252 100644 --- a/gdb/buildsym.c +++ b/gdb/buildsym.c @@ -214,6 +214,8 @@ struct buildsym_compunit /* The stack of contexts that are pushed by push_context and popped by pop_context. */ std::vector<struct context_stack> m_context_stack; + + struct subfile *m_current_subfile = nullptr; }; /* The work-in-progress of the compunit we are building. @@ -761,7 +763,7 @@ start_subfile (const char *name) if (FILENAME_CMP (subfile_name, name) == 0) { - current_subfile = subfile; + buildsym_compunit->m_current_subfile = subfile; if (subfile_name != subfile->name) xfree (subfile_name); return; @@ -779,7 +781,7 @@ start_subfile (const char *name) subfile->next = buildsym_compunit->subfiles; buildsym_compunit->subfiles = subfile; - current_subfile = subfile; + buildsym_compunit->m_current_subfile = subfile; subfile->name = xstrdup (name); @@ -839,7 +841,6 @@ free_buildsym_compunit (void) return; delete buildsym_compunit; buildsym_compunit = NULL; - current_subfile = NULL; } /* For stabs readers, the first N_SO symbol is assumed to be the @@ -895,8 +896,10 @@ void push_subfile () { gdb_assert (buildsym_compunit != nullptr); - gdb_assert (current_subfile != NULL && current_subfile->name != NULL); - buildsym_compunit->m_subfile_stack.push_back (current_subfile->name); + gdb_assert (buildsym_compunit->m_current_subfile != NULL); + gdb_assert (buildsym_compunit->m_current_subfile->name != NULL); + buildsym_compunit->m_subfile_stack.push_back + (buildsym_compunit->m_current_subfile->name); } const char * @@ -1029,7 +1032,6 @@ prepare_for_building () gdb_assert (file_symbols == NULL); gdb_assert (global_symbols == NULL); gdb_assert (pending_addrmap == NULL); - gdb_assert (current_subfile == NULL); gdb_assert (buildsym_compunit == nullptr); } @@ -1068,7 +1070,7 @@ start_symtab (struct objfile *objfile, const char *name, const char *comp_dir, start_subfile (name); /* Save this so that we don't have to go looking for it at the end of the subfiles list. */ - buildsym_compunit->main_subfile = current_subfile; + buildsym_compunit->main_subfile = buildsym_compunit->m_current_subfile; return buildsym_compunit->compunit_symtab; } @@ -1755,6 +1757,15 @@ get_context_stack_depth () return buildsym_compunit->m_context_stack.size (); } +/* See buildsym.h. */ + +struct subfile * +get_current_subfile () +{ + gdb_assert (buildsym_compunit != nullptr); + return buildsym_compunit->m_current_subfile; +} + /* Initialize anything that needs initializing when starting to read a |