Remove INVALID_ENTRY_POINT.
	* frame.c (inside_entry_func): New variable entry_point.  Return 0 if
	the entry point is not known.
	* solib-irix.c (enable_break): Likewise.
	* objfiles.c (init_entry_point_info): Stop using INVALID_ENTRY_POINT.
	Initialize EI.ENTRY_POINT_P.
	(entry_point_address): Rename to ...
	(entry_point_address_query): ... a new function.  Use EI.ENTRY_POINT_P.
	(entry_point_address): New function.
	(objfile_relocate): Use EI.ENTRY_POINT_P.
	* objfiles.h (struct entry_info): Simplify entry_point comment.  New
	field entry_point_p.
	(INVALID_ENTRY_POINT): Remove.
	(entry_point_address_query): New prototype.
	* solib-frv.c (enable_break): Check for NULL SYMFILE_OBJFILE and its
	EI.ENTRY_POINT_P.  Return 0 if ".interp" is not found.
This commit is contained in:
Jan Kratochvil 2009-11-02 14:50:29 +00:00
parent 62f3b8c867
commit abd0a5fa91
6 changed files with 93 additions and 37 deletions

View file

@ -294,29 +294,34 @@ 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;
}
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);
{
/* 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 = INVALID_ENTRY_POINT;
objfile->ei.entry_point_p = 0;
}
}
/* Get current entry point address. */
/* If there is a valid and known entry point, function fills *ENTRY_P with it
and returns non-zero; otherwise it returns zero. */
CORE_ADDR
entry_point_address (void)
int
entry_point_address_query (CORE_ADDR *entry_p)
{
struct gdbarch *gdbarch;
CORE_ADDR entry_point;
if (symfile_objfile == NULL)
if (symfile_objfile == NULL || !symfile_objfile->ei.entry_point_p)
return 0;
gdbarch = get_objfile_arch (symfile_objfile);
@ -332,7 +337,21 @@ entry_point_address (void)
symbol table. */
entry_point = gdbarch_addr_bits_remove (gdbarch, entry_point);
return entry_point;
*entry_p = entry_point;
return 1;
}
/* Get current entry point address. Call error if it is not known. */
CORE_ADDR
entry_point_address (void)
{
CORE_ADDR retval;
if (!entry_point_address_query (&retval))
error (_("Entry point address is not known."));
return retval;
}
/* Create the terminating entry of OBJFILE's minimal symbol table.
@ -702,7 +721,7 @@ objfile_relocate (struct objfile *objfile, struct section_offsets *new_offsets)
to be out of order. */
msymbols_sort (objfile);
if (objfile->ei.entry_point != ~(CORE_ADDR) 0)
if (objfile->ei.entry_point_p)
{
/* Relocate ei.entry_point with its section offset, use SECT_OFF_TEXT
only as a fallback. */