summaryrefslogtreecommitdiff
path: root/gdb/infcmd.c
diff options
context:
space:
mode:
authorDaniel Jacobowitz <dan@debian.org>2006-01-24 22:34:34 +0000
committerDaniel Jacobowitz <dan@debian.org>2006-01-24 22:34:34 +0000
commite220fd5e580fee33e7ae2dd0269dfb3f2d5ec458 (patch)
treee850f0a03b07609b839011d0ac2028dad9fbd686 /gdb/infcmd.c
parent28081668934b48825a89ee1773d7751a9a29e309 (diff)
downloadgdb-e220fd5e580fee33e7ae2dd0269dfb3f2d5ec458.tar.gz
PR gdb/1914
* fork-child.c (fork_inferior): Don't call solib_create_inferior_hook. * infcmd.c (post_create_inferior): Call solib_add, solib_create_inferior_hook, and re_enable_breakpoints_in_shlibs. (attach_command): Don't call solib_add or re_enable_breakpoints_in_shlibs. Call post_create_inferior instead. * remote.c (remote_open_1): Don't call solib_create_inferior_hook or observer_notify_inferior_created. Call post_create_inferior instead. * corelow.c: Don't include "observer.h". (solib_add_stub): Deleted. (core_open): Don't call observer_notify_inferior_created or solib_add_stub. Call post_create_inferior instead. * inf-ptrace.c: Don't include "observer.h". (inf_ptrace_attach): Don't call observer_notify_inferior_created. * inf-ttrace.c: Don't include "observer.h". (inf_ttrace_attach): Don't call observer_notify_inferior_created. * inferior.h (solib_create_inferior_hook): Remove redundant prototype. * inftarg.c: Don't include "observer.h". (child_attach): Don't call observer_notify_inferior_created. * Makefile.in: Update dependencies.
Diffstat (limited to 'gdb/infcmd.c')
-rw-r--r--gdb/infcmd.c34
1 files changed, 26 insertions, 8 deletions
diff --git a/gdb/infcmd.c b/gdb/infcmd.c
index b7d0f65c8e2..58063476875 100644
--- a/gdb/infcmd.c
+++ b/gdb/infcmd.c
@@ -405,6 +405,30 @@ tty_command (char *file, int from_tty)
void
post_create_inferior (struct target_ops *target, int from_tty)
{
+ if (exec_bfd)
+ {
+ /* Sometimes the platform-specific hook loads initial shared
+ libraries, and sometimes it doesn't. Try to do so first, so
+ that we can add them with the correct value for FROM_TTY. */
+#ifdef SOLIB_ADD
+ SOLIB_ADD (NULL, from_tty, target, auto_solib_add);
+#else
+ solib_add (NULL, from_tty, target, auto_solib_add);
+#endif
+
+ /* Create the hooks to handle shared library load and unload
+ events. */
+#ifdef SOLIB_CREATE_INFERIOR_HOOK
+ SOLIB_CREATE_INFERIOR_HOOK (pid);
+#else
+ solib_create_inferior_hook ();
+#endif
+
+ /* Enable any breakpoints which were disabled when the
+ underlying shared library was deleted. */
+ re_enable_breakpoints_in_shlibs ();
+ }
+
observer_notify_inferior_created (target, from_tty);
}
@@ -1899,18 +1923,12 @@ attach_command (char *args, int from_tty)
reread_symbols ();
}
-#ifdef SOLIB_ADD
- /* Add shared library symbols from the newly attached process, if any. */
- SOLIB_ADD ((char *) 0, from_tty, &current_target, auto_solib_add);
-#else
- solib_add (NULL, from_tty, &current_target, auto_solib_add);
-#endif
- re_enable_breakpoints_in_shlibs ();
-
/* Take any necessary post-attaching actions for this platform.
*/
target_post_attach (PIDGET (inferior_ptid));
+ post_create_inferior (&current_target, from_tty);
+
/* Install inferior's terminal modes. */
target_terminal_inferior ();