summaryrefslogtreecommitdiff
path: root/gdb/symfile.c
diff options
context:
space:
mode:
authorJoel Brobecker <brobecker@gnat.com>2012-12-15 13:11:18 +0000
committerJoel Brobecker <brobecker@gnat.com>2012-12-15 13:11:18 +0000
commit3d6e24f0505c5c0ee62454b1c9c27cffe17a6b3b (patch)
tree8cb2ff4a5f3342bacdec4639a1b7b9b49a487177 /gdb/symfile.c
parent36e4d0683b478479f9eb07bef34a21fd8007c3ef (diff)
downloadbinutils-gdb-3d6e24f0505c5c0ee62454b1c9c27cffe17a6b3b.tar.gz
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.
Diffstat (limited to 'gdb/symfile.c')
-rw-r--r--gdb/symfile.c48
1 files changed, 48 insertions, 0 deletions
diff --git a/gdb/symfile.c b/gdb/symfile.c
index 2a152938980..fc908b3caab 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,
+ &current_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.