diff options
author | Tom Tromey <tromey@redhat.com> | 2013-12-30 20:34:16 -0700 |
---|---|---|
committer | Tom Tromey <tromey@redhat.com> | 2014-01-15 12:06:04 -0700 |
commit | 3d548a532dd74f9bf5f2033541f0b504d96baf04 (patch) | |
tree | e9ee3226902f33e22bb7baef01bf81457cdb3dcc /gdb/objfiles.c | |
parent | 32ac0d11e648f4d5fa07c347ab109222a1162a0e (diff) | |
download | gdb-3d548a532dd74f9bf5f2033541f0b504d96baf04.zip gdb-3d548a532dd74f9bf5f2033541f0b504d96baf04.tar.gz gdb-3d548a532dd74f9bf5f2033541f0b504d96baf04.tar.bz2 |
move the "main" data into the per-BFD object
This adds the "main"-related data into the per-BFD. This is needed
because once symbol sharing across objfiles is complete, computing the
main name as a side effect of symbol reading will no longer work --
the symbols simply won't be re-read.
After this change, set_main_name is only used by the main_name
machinery itself, so this patch makes it static.
2014-01-15 Tom Tromey <tromey@redhat.com>
* dbxread.c (process_one_symbol): Use set_objfile_main_name.
* dwarf2read.c (read_partial_die): Use set_objfile_main_name.
* objfiles.c (get_objfile_bfd_data): Initialize language_of_main.
(set_objfile_main_name): New function.
* objfiles.h (struct objfile_per_bfd_storage) <name_of_main,
language_of_main>: New fields.
(set_objfile_main_name): Declare.
* symtab.c (find_main_name): Loop over objfiles to find the main
name and language.
(set_main_name): Now static.
(get_main_info): Add comment.
* symtab.h (set_main_name): Don't declare.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index c3f6e18..eccb44a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -152,6 +152,7 @@ get_objfile_bfd_data (struct objfile *objfile, struct bfd *abfd) obstack_init (&storage->storage_obstack); storage->filename_cache = bcache_xmalloc (NULL, NULL); storage->macro_cache = bcache_xmalloc (NULL, NULL); + storage->language_of_main = language_unknown; } return storage; @@ -186,6 +187,20 @@ set_objfile_per_bfd (struct objfile *objfile) objfile->per_bfd = get_objfile_bfd_data (objfile, objfile->obfd); } +/* Set the objfile's per-BFD notion of the "main" name and + language. */ + +void +set_objfile_main_name (struct objfile *objfile, + const char *name, enum language lang) +{ + if (objfile->per_bfd->name_of_main == NULL + || strcmp (objfile->per_bfd->name_of_main, name) != 0) + objfile->per_bfd->name_of_main + = obstack_copy0 (&objfile->per_bfd->storage_obstack, name, strlen (name)); + objfile->per_bfd->language_of_main = lang; +} + /* Called via bfd_map_over_sections to build up the section table that |