This is the mail archive of the gdb-patches@sources.redhat.com mailing list for the GDB project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[commit] Add notify inferior-created calls


Hello,

Ref: http://sources.redhat.com/ml/gdb-patches/2004-05/msg00169.html

This patch adds the needed calls to notify inferior-created observers of that event (now that from_tty is available where needed).

I've covered all the cases I could identify while testing GDB on GNU/Linux native. I suspect, due to the way GDB is currently structured, that further calls may need to be scattered through the code. That can be done on an as-identified basis (unless I happen to re-structure GDB fixing this problem first :-).

committed,
Andrew
2004-05-25  Andrew Cagney  <cagney@gnu.org>

	* inftarg.c: Include "observer.h".
	(child_attach, child_create_inferior): Notify inferior_created.
	* corelow.c: Include "observer.h".
	(core_open): Notify inferior_created.
	* Makefile.in (inftarg.o, corelow.o): Update
	dependencies.

Index: Makefile.in
===================================================================
RCS file: /cvs/src/src/gdb/Makefile.in,v
retrieving revision 1.578
diff -p -u -r1.578 Makefile.in
--- Makefile.in	24 May 2004 21:00:08 -0000	1.578
+++ Makefile.in	25 May 2004 15:58:32 -0000
@@ -1658,7 +1658,7 @@ corefile.o: corefile.c $(defs_h) $(gdb_s
 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) $(gdb_assert_h)
+	$(exec_h) $(readline_h) $(gdb_assert_h) $(observer_h)
 core-regset.o: core-regset.c $(defs_h) $(command_h) $(gdbcore_h) \
 	$(inferior_h) $(target_h) $(gdb_string_h) $(gregset_h)
 cp-abi.o: cp-abi.c $(defs_h) $(value_h) $(cp_abi_h) $(command_h) $(gdbcmd_h) \
@@ -1944,7 +1944,8 @@ infrun.o: infrun.c $(defs_h) $(gdb_strin
 	$(symfile_h) $(top_h) $(inf_loop_h) $(regcache_h) $(value_h) \
 	$(observer_h) $(language_h) $(gdb_assert_h)
 inftarg.o: inftarg.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
-	$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h)
+	$(gdbcore_h) $(command_h) $(gdb_stat_h) $(gdb_wait_h) $(inflow_h) \
+	$(observer_h)
 infttrace.o: infttrace.c $(defs_h) $(frame_h) $(inferior_h) $(target_h) \
 	$(gdb_string_h) $(gdb_wait_h) $(command_h) $(gdbthread_h) \
 	$(gdbcore_h) $(infttrace_h)
Index: corelow.c
===================================================================
RCS file: /cvs/src/src/gdb/corelow.c,v
retrieving revision 1.39
diff -p -u -r1.39 corelow.c
--- corelow.c	28 Apr 2004 16:36:25 -0000	1.39
+++ corelow.c	25 May 2004 15:58:32 -0000
@@ -43,7 +43,7 @@
 #include "symfile.h"
 #include "exec.h"
 #include "readline/readline.h"
-
+#include "observer.h"
 #include "gdb_assert.h"
 
 #ifndef O_BINARY
@@ -355,6 +355,10 @@ core_open (char *filename, int from_tty)
   ontop = !push_target (&core_ops);
   discard_cleanups (old_chain);
 
+  /* 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);
+
   p = bfd_core_file_failing_command (core_bfd);
   if (p)
     printf_filtered ("Core was generated by `%s'.\n", p);
Index: inftarg.c
===================================================================
RCS file: /cvs/src/src/gdb/inftarg.c,v
retrieving revision 1.24
diff -p -u -r1.24 inftarg.c
--- inftarg.c	25 May 2004 14:58:27 -0000	1.24
+++ inftarg.c	25 May 2004 15:58:32 -0000
@@ -34,7 +34,7 @@
 #include <signal.h>
 #include <sys/types.h>
 #include <fcntl.h>
-
+#include "observer.h"
 #include "gdb_wait.h"
 #include "inflow.h"
 
@@ -232,6 +232,10 @@ child_attach (char *args, int from_tty)
 
     inferior_ptid = pid_to_ptid (pid);
     push_target (&child_ops);
+
+    /* Do this first, before anything has had a chance to query the
+       inferiors symbol table or similar.  */
+    observer_notify_inferior_created (&current_target, from_tty);
   }
 #endif /* ATTACH_DETACH */
 }
@@ -365,6 +369,7 @@ child_create_inferior (char *exec_file, 
   fork_inferior (exec_file, allargs, env, ptrace_me, ptrace_him, NULL, NULL);
 #endif
   /* We are at the first instruction we care about.  */
+  observer_notify_inferior_created (&current_target, from_tty);
   /* Pedal to the metal... */
   proceed ((CORE_ADDR) -1, TARGET_SIGNAL_0, 0);
 }

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]