summaryrefslogtreecommitdiff
path: root/gdb/solib.c
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/solib.c')
-rw-r--r--gdb/solib.c26
1 files changed, 25 insertions, 1 deletions
diff --git a/gdb/solib.c b/gdb/solib.c
index aa2dd46ab13..2bd8a2ec794 100644
--- a/gdb/solib.c
+++ b/gdb/solib.c
@@ -1306,11 +1306,35 @@ solib_address (address)
/* Called by free_all_symtabs */
void
-clear_solib()
+clear_solib ()
{
struct so_list *next;
char *bfd_filename;
+ /* This function is expected to handle ELF shared libraries. It is
+ also used on Solaris, which can run either ELF or a.out binaries
+ (for compatibility with SunOS 4), both of which can use shared
+ libraries. So we don't know whether we have an ELF executable or
+ an a.out executable until the user chooses an executable file.
+
+ ELF shared libraries don't get mapped into the address space
+ until after the program starts, so we'd better not try to insert
+ breakpoints in them immediately. We have to wait until the
+ dynamic linker has loaded them; we'll hit a bp_shlib_event
+ breakpoint (look for calls to create_solib_event_breakpoint) when
+ it's ready.
+
+ SunOS shared libraries seem to be different --- they're present
+ as soon as the process begins execution, so there's no need to
+ put off inserting breakpoints. There's also nowhere to put a
+ bp_shlib_event breakpoint, so if we put it off, we'll never get
+ around to it.
+
+ So: disable breakpoints only if we're using ELF shared libs. */
+ if (exec_bfd != NULL
+ && bfd_get_flavour (exec_bfd) != bfd_target_aout_flavour)
+ disable_breakpoints_in_shlibs (1);
+
while (so_list_head)
{
if (so_list_head -> sections)