diff options
author | Kevin Buettner <kevinb@redhat.com> | 2003-04-15 00:28:23 +0000 |
---|---|---|
committer | Kevin Buettner <kevinb@redhat.com> | 2003-04-15 00:28:23 +0000 |
commit | 7edc78b36f4b14ba982854f0a759e7372abf361b (patch) | |
tree | f9c524bd31277f12822c2221d3e41f05da8193c0 | |
parent | 74d9bfffc63d6e9ff179b76b986a6db38013b6ea (diff) | |
download | gdb-7edc78b36f4b14ba982854f0a759e7372abf361b.tar.gz |
* solib-svr4.c (svr4_have_link_map_offsets): New function.
(locate_base): Return early if there aren't any link map offsets.
(svr4_solib_create_inferior_hook): Warn if shared library support
is unavailable.
-rw-r--r-- | gdb/ChangeLog | 7 | ||||
-rw-r--r-- | gdb/solib-svr4.c | 27 |
2 files changed, 32 insertions, 2 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 8cb7af17150..9d04f925901 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,3 +1,10 @@ +2003-04-14 Kevin Buettner <kevinb@redhat.com> + + * solib-svr4.c (svr4_have_link_map_offsets): New function. + (locate_base): Return early if there aren't any link map offsets. + (svr4_solib_create_inferior_hook): Warn if shared library support + is unavailable. + 2003-04-14 David Carlton <carlton@math.stanford.edu> * symtab.c (symbol_set_names): Add prefix when storing Java names diff --git a/gdb/solib-svr4.c b/gdb/solib-svr4.c index 1b0a43e97d4..6c4c10ae013 100644 --- a/gdb/solib-svr4.c +++ b/gdb/solib-svr4.c @@ -43,6 +43,7 @@ static struct link_map_offsets *svr4_fetch_link_map_offsets (void); static struct link_map_offsets *legacy_fetch_link_map_offsets (void); +static int svr4_have_link_map_offsets (void); /* fetch_link_map_offsets_gdbarch_data is a handle used to obtain the architecture specific link map offsets fetching function. */ @@ -542,9 +543,10 @@ locate_base (void) /* Check to see if we have a currently valid address, and if so, avoid doing all this work again and just return the cached address. If we have no cached address, try to locate it in the dynamic info - section for ELF executables. */ + section for ELF executables. There's no point in doing any of this + though if we don't have some link map offsets to work with. */ - if (debug_base == 0) + if (debug_base == 0 && svr4_have_link_map_offsets ()) { if (exec_bfd != NULL && bfd_get_flavour (exec_bfd) == bfd_target_elf_flavour) @@ -1273,6 +1275,13 @@ svr4_solib_create_inferior_hook (void) /* Relocate the main executable if necessary. */ svr4_relocate_main_executable (); + if (!svr4_have_link_map_offsets ()) + { + warning ("no shared library support for this OS / ABI"); + return; + + } + if (!enable_break ()) { warning ("shared library handler failed to enable breakpoint"); @@ -1392,6 +1401,20 @@ svr4_fetch_link_map_offsets (void) return (flmo ()); } +/* Return 1 if a link map offset fetcher has been defined, 0 otherwise. */ +static int +svr4_have_link_map_offsets (void) +{ + struct link_map_offsets *(*flmo)(void) = + gdbarch_data (current_gdbarch, fetch_link_map_offsets_gdbarch_data); + if (flmo == NULL + || (flmo == legacy_fetch_link_map_offsets + && legacy_svr4_fetch_link_map_offsets_hook == NULL)) + return 0; + else + return 1; +} + /* set_solib_svr4_fetch_link_map_offsets() is intended to be called by a <arch>_gdbarch_init() function. It is used to establish an architecture specific link_map_offsets fetcher for the architecture |