diff options
author | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-11-02 14:50:29 +0000 |
---|---|---|
committer | Jan Kratochvil <jan.kratochvil@redhat.com> | 2009-11-02 14:50:29 +0000 |
commit | abd0a5fa917322975ca664878f29de21fa878e21 (patch) | |
tree | 6d589ca1a511d6f8633d523498418394425e4d45 /gdb/objfiles.c | |
parent | 62f3b8c86784407e864ddf7698b9852cb76aa339 (diff) | |
download | fsf-binutils-gdb-abd0a5fa917322975ca664878f29de21fa878e21.zip fsf-binutils-gdb-abd0a5fa917322975ca664878f29de21fa878e21.tar.gz fsf-binutils-gdb-abd0a5fa917322975ca664878f29de21fa878e21.tar.bz2 |
gdb/
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.
Diffstat (limited to 'gdb/objfiles.c')
-rw-r--r-- | gdb/objfiles.c | 41 |
1 files changed, 30 insertions, 11 deletions
diff --git a/gdb/objfiles.c b/gdb/objfiles.c index 760aced..0425d7a 100644 --- a/gdb/objfiles.c +++ b/gdb/objfiles.c @@ -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. */ |