From 3d6e24f0505c5c0ee62454b1c9c27cffe17a6b3b Mon Sep 17 00:00:00 2001 From: Joel Brobecker Date: Sat, 15 Dec 2012 13:11:18 +0000 Subject: [PATCH] Move init_entry_point_info to symfile.c and make it static. gdb/ChangeLog: * objfiles.c (init_entry_point_info): Move function from here... * symfile.c (init_entry_point_info): ... to there. Make static. * objfiles.h (objfiles.h): Delete declaration. --- gdb/ChangeLog | 6 ++++++ gdb/objfiles.c | 48 ------------------------------------------------ gdb/objfiles.h | 2 -- gdb/symfile.c | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 54 insertions(+), 50 deletions(-) diff --git a/gdb/ChangeLog b/gdb/ChangeLog index aeb7b49..ae4a926 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,11 @@ 2012-12-15 Joel Brobecker + * objfiles.c (init_entry_point_info): Move function from here... + * symfile.c (init_entry_point_info): ... to there. Make static. + * objfiles.h (objfiles.h): Delete declaration. + +2012-12-15 Joel Brobecker + * symfile.c (syms_from_objfile_1): Renames syms_from_objfile. Remove call to init_entry_point_info. Add OBJFILE's section_offsets and num_sections initialization. Add note diff --git a/gdb/objfiles.c b/gdb/objfiles.c index e5681fa..feb387b 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -324,54 +324,6 @@ get_objfile_arch (struct objfile *objfile) return objfile->gdbarch; } -/* Initialize entry point information for this objfile. */ - -void -init_entry_point_info (struct objfile *objfile) -{ - /* Save startup file's range of PC addresses to help blockframe.c - decide where the bottom of the stack is. */ - - if (bfd_get_file_flags (objfile->obfd) & EXEC_P) - { - /* Executable file -- record its entry point so we'll recognize - the startup file because it contains the entry point. */ - objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); - objfile->ei.entry_point_p = 1; - } - else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC - && bfd_get_start_address (objfile->obfd) != 0) - { - /* Some shared libraries may have entry points set and be - runnable. There's no clear way to indicate this, so just check - for values other than zero. */ - objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); - objfile->ei.entry_point_p = 1; - } - else - { - /* Examination of non-executable.o files. Short-circuit this stuff. */ - objfile->ei.entry_point_p = 0; - } - - if (objfile->ei.entry_point_p) - { - CORE_ADDR entry_point = objfile->ei.entry_point; - - /* Make certain that the address points at real code, and not a - function descriptor. */ - entry_point - = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch, - entry_point, - ¤t_target); - - /* Remove any ISA markers, so that this matches entries in the - symbol table. */ - objfile->ei.entry_point - = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point); - } -} - /* If there is a valid and known entry point, function fills *ENTRY_P with it and returns non-zero; otherwise it returns zero. */ diff --git a/gdb/objfiles.h b/gdb/objfiles.h index 877c9e0..c794598 100644 --- a/gdb/objfiles.h +++ b/gdb/objfiles.h @@ -443,8 +443,6 @@ extern struct objfile *allocate_objfile (bfd *, int); extern struct gdbarch *get_objfile_arch (struct objfile *); -extern void init_entry_point_info (struct objfile *); - extern int entry_point_address_query (CORE_ADDR *entry_p); extern CORE_ADDR entry_point_address (void); diff --git a/gdb/symfile.c b/gdb/symfile.c index 2a15293..fc908b3 100644 --- a/gdb/symfile.c +++ b/gdb/symfile.c @@ -893,6 +893,54 @@ read_symbols (struct objfile *objfile, int add_flags) require_partial_symbols (objfile, 0); } +/* Initialize entry point information for this objfile. */ + +static void +init_entry_point_info (struct objfile *objfile) +{ + /* Save startup file's range of PC addresses to help blockframe.c + decide where the bottom of the stack is. */ + + if (bfd_get_file_flags (objfile->obfd) & EXEC_P) + { + /* Executable file -- record its entry point so we'll recognize + the startup file because it contains the entry point. */ + objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); + objfile->ei.entry_point_p = 1; + } + else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC + && bfd_get_start_address (objfile->obfd) != 0) + { + /* Some shared libraries may have entry points set and be + runnable. There's no clear way to indicate this, so just check + for values other than zero. */ + objfile->ei.entry_point = bfd_get_start_address (objfile->obfd); + objfile->ei.entry_point_p = 1; + } + else + { + /* Examination of non-executable.o files. Short-circuit this stuff. */ + objfile->ei.entry_point_p = 0; + } + + if (objfile->ei.entry_point_p) + { + CORE_ADDR entry_point = objfile->ei.entry_point; + + /* Make certain that the address points at real code, and not a + function descriptor. */ + entry_point + = gdbarch_convert_from_func_ptr_addr (objfile->gdbarch, + entry_point, + ¤t_target); + + /* Remove any ISA markers, so that this matches entries in the + symbol table. */ + objfile->ei.entry_point + = gdbarch_addr_bits_remove (objfile->gdbarch, entry_point); + } +} + /* Process a symbol file, as either the main file or as a dynamically loaded file. -- 2.7.4