This is the mail archive of the gdb-patches@sourceware.org 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]

[rfc] [6/7] Modernize AIX target: eliminate TARGET_CREATE_INFERIOR_HOOK


Hello,

this patch gets rid of the TARGET_CREATE_INFERIOR_HOOK hook by 
overriding to_create_inferior in rs6000-nat.c.

Tested on powerpc-ibm-aix5.3.0.0.

Bye,
Ulrich

ChangeLog:

	* config/rs6000/nm-rs6000.h (TARGET_CREATE_INFERIOR_HOOK): Remove.
	* fork-child.c (fork_inferior): Don't call TARGET_CREATE_INFERIOR_HOOK.
	* rs6000-nat.c (super_create_inferior): New variable.
	(rs6000_create_inferior): Make static.  Adapt argument list.  Call
	original version of create_inferior via super_create_inferior.
	(_initialize_core_rs6000): Install to_create_inferior target method.


diff -urNp gdb-orig/gdb/config/rs6000/nm-rs6000.h gdb-head/gdb/config/rs6000/nm-rs6000.h
--- gdb-orig/gdb/config/rs6000/nm-rs6000.h	Tue Apr 24 13:58:59 2007
+++ gdb-head/gdb/config/rs6000/nm-rs6000.h	Tue Apr 24 14:09:52 2007
@@ -64,8 +64,3 @@ extern char *xcoff_solib_address (CORE_A
   /* A normal waitstatus.  Let the usual macros deal with it.  */ \
   0)
 
-/* Notice when a new child process is started. */
-
-#define TARGET_CREATE_INFERIOR_HOOK rs6000_create_inferior
-extern void rs6000_create_inferior (int);
-
diff -urNp gdb-orig/gdb/fork-child.c gdb-head/gdb/fork-child.c
--- gdb-orig/gdb/fork-child.c	Wed Apr 18 16:17:19 2007
+++ gdb-head/gdb/fork-child.c	Tue Apr 24 14:10:35 2007
@@ -398,11 +398,6 @@ fork_inferior (char *exec_file_arg, char
   /* We are now in the child process of interest, having exec'd the
      correct program, and are poised at the first instruction of the
      new program.  */
-
-  /* Allow target dependent code to play with the new process.  This
-     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);
 }
 
 /* Accept NTRAPS traps from the inferior.  */
diff -urNp gdb-orig/gdb/rs6000-nat.c gdb-head/gdb/rs6000-nat.c
--- gdb-orig/gdb/rs6000-nat.c	Tue Apr 24 13:58:59 2007
+++ gdb-head/gdb/rs6000-nat.c	Tue Apr 24 14:09:38 2007
@@ -996,14 +996,18 @@ vmap_exec (void)
 /* Set the current architecture from the host running GDB.  Called when
    starting a child process. */
 
-void
-rs6000_create_inferior (int pid)
+static void (*super_create_inferior) (char *exec_file, char *allargs,
+				      char **env, int from_tty);
+static void
+rs6000_create_inferior (char *exec_file, char *allargs, char **env, int from_tty)
 {
   enum bfd_architecture arch;
   unsigned long mach;
   bfd abfd;
   struct gdbarch_info info;
 
+  super_create_inferior (exec_file, allargs, env, from_tty);
+
   if (__power_rs ())
     {
       arch = bfd_arch_rs6000;
@@ -1247,6 +1251,10 @@ _initialize_core_rs6000 (void)
   t->to_fetch_registers = rs6000_fetch_inferior_registers;
   t->to_store_registers = rs6000_store_inferior_registers;
   t->to_xfer_partial = rs6000_xfer_partial;
+
+  super_create_inferior = t->to_create_inferior;
+  t->to_create_inferior = rs6000_create_inferior;
+
   add_target (t);
 
   /* Initialize hook in rs6000-tdep.c for determining the TOC address
diff -urNp gdb-orig/gdb/target.h gdb-head/gdb/target.h
--- gdb-orig/gdb/target.h	Wed Apr 18 16:17:21 2007
+++ gdb-head/gdb/target.h	Tue Apr 24 14:10:16 2007
@@ -1112,12 +1112,6 @@ extern void (*deprecated_target_new_objf
 #define target_get_thread_local_address_p() \
     (target_get_thread_local_address != NULL)
 
-/* Hook to call target dependent code just after inferior target process has
-   started.  */
-
-#ifndef TARGET_CREATE_INFERIOR_HOOK
-#define TARGET_CREATE_INFERIOR_HOOK(PID)
-#endif
 
 /* Hardware watchpoint interfaces.  */
 
-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com


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