diff options
author | Daniel Jacobowitz <drow@false.org> | 2006-01-24 22:34:34 +0000 |
---|---|---|
committer | Daniel Jacobowitz <drow@false.org> | 2006-01-24 22:34:34 +0000 |
commit | 9353355fa3d730a3ffa21e35fef78cfb6475effa (patch) | |
tree | b911676afdc03d4e71d3c113c9c190eaf71308f6 | |
parent | 281b533b6ced43d45f4630a47e998ec82c42e2aa (diff) | |
download | gdb-9353355fa3d730a3ffa21e35fef78cfb6475effa.zip gdb-9353355fa3d730a3ffa21e35fef78cfb6475effa.tar.gz gdb-9353355fa3d730a3ffa21e35fef78cfb6475effa.tar.bz2 |
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.
-rw-r--r-- | gdb/ChangeLog | 27 | ||||
-rw-r--r-- | gdb/Makefile.in | 8 | ||||
-rw-r--r-- | gdb/corelow.c | 23 | ||||
-rw-r--r-- | gdb/fork-child.c | 8 | ||||
-rw-r--r-- | gdb/inf-ptrace.c | 5 | ||||
-rw-r--r-- | gdb/inf-ttrace.c | 5 | ||||
-rw-r--r-- | gdb/infcmd.c | 34 | ||||
-rw-r--r-- | gdb/inferior.h | 2 | ||||
-rw-r--r-- | gdb/inftarg.c | 5 | ||||
-rw-r--r-- | gdb/remote.c | 18 |
10 files changed, 62 insertions, 73 deletions
diff --git a/gdb/ChangeLog b/gdb/ChangeLog index 0c92205..c2f6686 100644 --- a/gdb/ChangeLog +++ b/gdb/ChangeLog @@ -1,5 +1,32 @@ 2006-01-24 Daniel Jacobowitz <dan@codesourcery.com> + 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. + +2006-01-24 Daniel Jacobowitz <dan@codesourcery.com> + * infcmd.c: Include "observer.h". (post_create_inferior): New function. (run_command_1): Call it. Also call proceed. diff --git a/gdb/Makefile.in b/gdb/Makefile.in index 004d591..3ac4697 100644 --- a/gdb/Makefile.in +++ b/gdb/Makefile.in @@ -1831,7 +1831,7 @@ corefile.o: corefile.c $(defs_h) $(gdb_string_h) $(inferior_h) $(symtab_h) \ corelow.o: corelow.c $(defs_h) $(arch_utils_h) $(gdb_string_h) $(frame_h) \ $(inferior_h) $(symtab_h) $(command_h) $(bfd_h) $(target_h) \ $(gdbcore_h) $(gdbthread_h) $(regcache_h) $(regset_h) $(symfile_h) \ - $(exec_h) $(readline_h) $(observer_h) $(gdb_assert_h) \ + $(exec_h) $(readline_h) $(gdb_assert_h) \ $(exceptions_h) $(solib_h) core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \ $(inferior_h) $(target_h) $(gdb_string_h) $(gregset_h) @@ -2129,7 +2129,7 @@ inflow.o: inflow.c $(defs_h) $(frame_h) $(inferior_h) $(command_h) \ $(serial_h) $(terminal_h) $(target_h) $(gdbthread_h) $(gdb_string_h) \ $(inflow_h) inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \ - $(gdbcore_h) $(observer_h) $(regcache_h) $(gdb_assert_h) \ + $(gdbcore_h) $(regcache_h) $(gdb_assert_h) \ $(gdb_string_h) $(gdb_ptrace_h) $(gdb_wait_h) $(inf_child_h) infptrace.o: infptrace.c $(defs_h) $(command_h) $(frame_h) $(gdbcore_h) \ $(inferior_h) $(regcache_h) $(target_h) $(gdb_assert_h) \ @@ -2141,10 +2141,10 @@ infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \ $(value_h) $(observer_h) $(language_h) $(solib_h) $(gdb_assert_h) \ $(mi_common_h) $(main_h) inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \ - $(gdbcore_h) $(command_h) $(gdb_stat_h) $(observer_h) $(gdb_wait_h) \ + $(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) \ $(inflow_h) inf-ttrace.o: inf-ttrace.c $(defs_h) $(command_h) $(gdbcore_h) \ - $(gdbthread_h) $(inferior_h) $(observer_h) $(target_h) \ + $(gdbthread_h) $(inferior_h) $(target_h) \ $(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h) interps.o: interps.c $(defs_h) $(gdbcmd_h) $(ui_out_h) $(event_loop_h) \ $(event_top_h) $(interps_h) $(completer_h) $(gdb_string_h) \ diff --git a/gdb/corelow.c b/gdb/corelow.c index 591680d..2ccbd5b 100644 --- a/gdb/corelow.c +++ b/gdb/corelow.c @@ -1,7 +1,7 @@ /* Core dump and executable file functions below target vector, for GDB. Copyright (C) 1986, 1987, 1989, 1991, 1992, 1993, 1994, 1995, 1996, - 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005 + 1997, 1998, 1999, 2000, 2001, 2003, 2004, 2005, 2006 Free Software Foundation, Inc. This file is part of GDB. @@ -43,7 +43,6 @@ #include "symfile.h" #include "exec.h" #include "readline/readline.h" -#include "observer.h" #include "gdb_assert.h" #include "exceptions.h" #include "solib.h" @@ -236,21 +235,6 @@ core_close_cleanup (void *ignore) core_close (0/*ignored*/); } -/* Stub function for catch_errors around shared library hacking. FROM_TTYP - is really an int * which points to from_tty. */ - -static int -solib_add_stub (void *from_ttyp) -{ -#ifdef SOLIB_ADD - SOLIB_ADD (NULL, *(int *) from_ttyp, ¤t_target, auto_solib_add); -#else - solib_add (NULL, *(int *)from_ttyp, ¤t_target, auto_solib_add); -#endif - re_enable_breakpoints_in_shlibs (); - return 0; -} - /* Look for sections whose names start with `.reg/' so that we can extract the list of threads in a core file. */ @@ -372,7 +356,7 @@ core_open (char *filename, int from_tty) /* This is done first, before anything has a chance to query the inferior for information such as symbols. */ - observer_notify_inferior_created (&core_ops, from_tty); + post_create_inferior (&core_ops, from_tty); p = bfd_core_file_failing_command (core_bfd); if (p) @@ -398,9 +382,6 @@ core_open (char *filename, int from_tty) /* Fetch all registers from core file. */ target_fetch_registers (-1); - /* Add symbols and section mappings for any shared libraries. */ - catch_errors (solib_add_stub, &from_tty, (char *) 0, RETURN_MASK_ALL); - /* Now, set up the frame cache, and print the top of stack. */ flush_cached_frames (); select_frame (get_current_frame ()); diff --git a/gdb/fork-child.c b/gdb/fork-child.c index 4b9051e..8940151 100644 --- a/gdb/fork-child.c +++ b/gdb/fork-child.c @@ -1,7 +1,7 @@ /* Fork a Unix child process, and set up to debug it, for GDB. Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, - 2000, 2001, 2004 Free Software Foundation, Inc. + 2000, 2001, 2004, 2005, 2006 Free Software Foundation, Inc. Contributed by Cygnus Support. @@ -403,12 +403,6 @@ fork_inferior (char *exec_file_arg, char *allargs, char **env, might be used to have target-specific code initialize a variable in the new process prior to executing the first instruction. */ TARGET_CREATE_INFERIOR_HOOK (pid); - -#ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (pid); -#else - solib_create_inferior_hook (); -#endif } /* Accept NTRAPS traps from the inferior. */ diff --git a/gdb/inf-ptrace.c b/gdb/inf-ptrace.c index ec5d9a8..04e6d47 100644 --- a/gdb/inf-ptrace.c +++ b/gdb/inf-ptrace.c @@ -26,7 +26,6 @@ #include "inferior.h" #include "inflow.h" #include "gdbcore.h" -#include "observer.h" #include "regcache.h" #include "gdb_assert.h" @@ -222,10 +221,6 @@ inf_ptrace_attach (char *args, int from_tty) inferior_ptid = pid_to_ptid (pid); push_target (ptrace_ops_hack); - - /* Do this first, before anything has had a chance to query the - inferior's symbol table or similar. */ - observer_notify_inferior_created (¤t_target, from_tty); } #ifdef PT_GET_PROCESS_STATE diff --git a/gdb/inf-ttrace.c b/gdb/inf-ttrace.c index c13eea4..d9c3bba 100644 --- a/gdb/inf-ttrace.c +++ b/gdb/inf-ttrace.c @@ -29,7 +29,6 @@ #include "gdbcore.h" #include "gdbthread.h" #include "inferior.h" -#include "observer.h" #include "target.h" #include "gdb_assert.h" @@ -721,10 +720,6 @@ inf_ttrace_attach (char *args, int from_tty) inferior_ptid = pid_to_ptid (pid); push_target (ttrace_ops_hack); - - /* Do this first, before anything has had a chance to query the - inferior's symbol table or similar. */ - observer_notify_inferior_created (¤t_target, from_tty); } static void diff --git a/gdb/infcmd.c b/gdb/infcmd.c index b7d0f65..5806347 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, ¤t_target, auto_solib_add); -#else - solib_add (NULL, from_tty, ¤t_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 (¤t_target, from_tty); + /* Install inferior's terminal modes. */ target_terminal_inferior (); diff --git a/gdb/inferior.h b/gdb/inferior.h index 4f1b71f..b3a5f55 100644 --- a/gdb/inferior.h +++ b/gdb/inferior.h @@ -213,8 +213,6 @@ extern void store_inferior_registers (int); extern void fetch_inferior_registers (int); -extern void solib_create_inferior_hook (void); - extern void child_terminal_info (char *, int); extern void term_info (char *, int); diff --git a/gdb/inftarg.c b/gdb/inftarg.c index 2160373..2e3d88e 100644 --- a/gdb/inftarg.c +++ b/gdb/inftarg.c @@ -34,7 +34,6 @@ #include <signal.h> #include <sys/types.h> #include <fcntl.h> -#include "observer.h" #include "gdb_wait.h" #include "inflow.h" @@ -210,10 +209,6 @@ child_attach (char *args, int from_tty) inferior_ptid = pid_to_ptid (pid); push_target (&deprecated_child_ops); - - /* Do this first, before anything has had a chance to query the - inferior's symbol table or similar. */ - observer_notify_inferior_created (¤t_target, from_tty); } #if !defined(CHILD_POST_ATTACH) diff --git a/gdb/remote.c b/gdb/remote.c index 9fe9f9a..3318fb3 100644 --- a/gdb/remote.c +++ b/gdb/remote.c @@ -2295,24 +2295,10 @@ remote_open_1 (char *name, int from_tty, struct target_ops *target, getpkt (buf, rs->remote_packet_size, 0); } - /* FIXME: need a master target_open vector from which all - remote_opens can be called, so that stuff like this can - go there. Failing that, the following code must be copied - to the open function for any remote target that wants to - support svr4 shared libraries. */ + post_create_inferior (¤t_target, from_tty); - /* Set up to detect and load shared libraries. */ if (exec_bfd) /* No use without an exec file. */ - { -#ifdef SOLIB_CREATE_INFERIOR_HOOK - SOLIB_CREATE_INFERIOR_HOOK (PIDGET (inferior_ptid)); -#else - solib_create_inferior_hook (); -#endif - remote_check_symbols (symfile_objfile); - } - - observer_notify_inferior_created (¤t_target, from_tty); + remote_check_symbols (symfile_objfile); } /* This takes a program previously attached to and detaches it. After |