move the entry point info into the per-bfd object
This moves the entry point information into the per-BFD object and arranges not to recompute it when it has already been computed. 2014-01-15 Tom Tromey <tromey@redhat.com> * symfile.c (init_entry_point_info): Use new "initialized" field. Update. * objfiles.h (struct entry_point) <initialized>: New field. (struct objfile_per_bfd_storage) <ei>: New field, moved from... (struct objfile) <ei>: ...here. Remove. * objfiles.c (entry_point_address_query): Update.
This commit is contained in:
parent
53eddfa606
commit
6ef55de768
@ -1,3 +1,12 @@
|
||||
2014-01-15 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* symfile.c (init_entry_point_info): Use new "initialized" field.
|
||||
Update.
|
||||
* objfiles.h (struct entry_point) <initialized>: New field.
|
||||
(struct objfile_per_bfd_storage) <ei>: New field, moved from...
|
||||
(struct objfile) <ei>: ...here. Remove.
|
||||
* objfiles.c (entry_point_address_query): Update.
|
||||
|
||||
2014-01-15 Tom Tromey <tromey@redhat.com>
|
||||
|
||||
* objfiles.c (entry_point_address_query): Relocate entry point
|
||||
|
@ -364,12 +364,12 @@ get_objfile_arch (struct objfile *objfile)
|
||||
int
|
||||
entry_point_address_query (CORE_ADDR *entry_p)
|
||||
{
|
||||
if (symfile_objfile == NULL || !symfile_objfile->ei.entry_point_p)
|
||||
if (symfile_objfile == NULL || !symfile_objfile->per_bfd->ei.entry_point_p)
|
||||
return 0;
|
||||
|
||||
*entry_p = (symfile_objfile->ei.entry_point
|
||||
*entry_p = (symfile_objfile->per_bfd->ei.entry_point
|
||||
+ ANOFFSET (symfile_objfile->section_offsets,
|
||||
symfile_objfile->ei.the_bfd_section_index));
|
||||
symfile_objfile->per_bfd->ei.the_bfd_section_index));
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
@ -109,6 +109,9 @@ struct entry_info
|
||||
|
||||
/* Set to 1 iff ENTRY_POINT contains a valid value. */
|
||||
unsigned entry_point_p : 1;
|
||||
|
||||
/* Set to 1 iff this object was initialized. */
|
||||
unsigned initialized : 1;
|
||||
};
|
||||
|
||||
/* Sections in an objfile. The section offsets are stored in the
|
||||
@ -195,6 +198,11 @@ struct objfile_per_bfd_storage
|
||||
name, and the second is the demangled name or just a zero byte
|
||||
if the name doesn't demangle. */
|
||||
struct htab *demangled_names_hash;
|
||||
|
||||
/* The per-objfile information about the entry point, the scope (file/func)
|
||||
containing the entry point, and the scope of the user's main() func. */
|
||||
|
||||
struct entry_info ei;
|
||||
};
|
||||
|
||||
/* Master structure for keeping track of each file from which
|
||||
@ -318,11 +326,6 @@ struct objfile
|
||||
|
||||
const struct sym_fns *sf;
|
||||
|
||||
/* The per-objfile information about the entry point, the scope (file/func)
|
||||
containing the entry point, and the scope of the user's main() func. */
|
||||
|
||||
struct entry_info ei;
|
||||
|
||||
/* Per objfile data-pointers required by other GDB modules. */
|
||||
|
||||
REGISTRY_FIELDS;
|
||||
|
@ -867,6 +867,12 @@ read_symbols (struct objfile *objfile, int add_flags)
|
||||
static void
|
||||
init_entry_point_info (struct objfile *objfile)
|
||||
{
|
||||
struct entry_info *ei = &objfile->per_bfd->ei;
|
||||
|
||||
if (ei->initialized)
|
||||
return;
|
||||
ei->initialized = 1;
|
||||
|
||||
/* Save startup file's range of PC addresses to help blockframe.c
|
||||
decide where the bottom of the stack is. */
|
||||
|
||||
@ -874,8 +880,8 @@ init_entry_point_info (struct objfile *objfile)
|
||||
{
|
||||
/* 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;
|
||||
ei->entry_point = bfd_get_start_address (objfile->obfd);
|
||||
ei->entry_point_p = 1;
|
||||
}
|
||||
else if (bfd_get_file_flags (objfile->obfd) & DYNAMIC
|
||||
&& bfd_get_start_address (objfile->obfd) != 0)
|
||||
@ -883,19 +889,19 @@ init_entry_point_info (struct objfile *objfile)
|
||||
/* 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;
|
||||
ei->entry_point = bfd_get_start_address (objfile->obfd);
|
||||
ei->entry_point_p = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
/* Examination of non-executable.o files. Short-circuit this stuff. */
|
||||
objfile->ei.entry_point_p = 0;
|
||||
ei->entry_point_p = 0;
|
||||
}
|
||||
|
||||
if (objfile->ei.entry_point_p)
|
||||
if (ei->entry_point_p)
|
||||
{
|
||||
struct obj_section *osect;
|
||||
CORE_ADDR entry_point = objfile->ei.entry_point;
|
||||
CORE_ADDR entry_point = ei->entry_point;
|
||||
int found;
|
||||
|
||||
/* Make certain that the address points at real code, and not a
|
||||
@ -907,7 +913,7 @@ init_entry_point_info (struct objfile *objfile)
|
||||
|
||||
/* Remove any ISA markers, so that this matches entries in the
|
||||
symbol table. */
|
||||
objfile->ei.entry_point
|
||||
ei->entry_point
|
||||
= gdbarch_addr_bits_remove (get_objfile_arch (objfile), entry_point);
|
||||
|
||||
found = 0;
|
||||
@ -919,7 +925,7 @@ init_entry_point_info (struct objfile *objfile)
|
||||
&& entry_point < (bfd_get_section_vma (objfile->obfd, sect)
|
||||
+ bfd_get_section_size (sect)))
|
||||
{
|
||||
objfile->ei.the_bfd_section_index
|
||||
ei->the_bfd_section_index
|
||||
= gdb_bfd_section_index (objfile->obfd, sect);
|
||||
found = 1;
|
||||
break;
|
||||
@ -927,7 +933,7 @@ init_entry_point_info (struct objfile *objfile)
|
||||
}
|
||||
|
||||
if (!found)
|
||||
objfile->ei.the_bfd_section_index = SECT_OFF_TEXT (objfile);
|
||||
ei->the_bfd_section_index = SECT_OFF_TEXT (objfile);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user