From 3d548a532dd74f9bf5f2033541f0b504d96baf04 Mon Sep 17 00:00:00 2001 From: Tom Tromey Date: Mon, 30 Dec 2013 20:34:16 -0700 Subject: 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 * 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) : 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. --- gdb/objfiles.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) (limited to 'gdb/objfiles.h') diff --git a/gdb/objfiles.h b/gdb/objfiles.h index d448c9e..2de2f8d 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -203,6 +203,13 @@ struct objfile_per_bfd_storage containing the entry point, and the scope of the user's main() func. */ struct entry_info ei; + + /* The name and language of any "main" found in this objfile. The + name can be NULL, which means that the information was not + recorded. */ + + const char *name_of_main; + enum language language_of_main; }; /* Master structure for keeping track of each file from which @@ -691,4 +698,9 @@ void set_objfile_per_bfd (struct objfile *obj); const char *objfile_name (const struct objfile *objfile); +/* Set the objfile's notion of the "main" name and language. */ + +extern void set_objfile_main_name (struct objfile *objfile, + const char *name, enum language lang); + #endif /* !defined (OBJFILES_H) */ -- cgit v1.1