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]

[commit] Remove inftarg.c and infptrace.c


Hello,

here we go -- no target still uses inftarg.c and infptrace.c, so they
can finally go away.

In addition to the two files, the patch also removes the prototypes
for functions defined by them, and also the prototype for register_addr.

Tested on s390-ibm-linux.  Committed to mainline.

Bye,
Ulrich


ChangeLog:

	* inftarg.c, infptrace.c: Remove files.
	* Makefile.in (ALLDEPFILES): Remove inftarg.c and infptrace.c
	(inftarg.o, infptrace.o): Remove rules.
	* gdbcore.h (register_addr): Remove prototype.
	* inferior.h (kill_inferior, store_inferior_registers,
	fetch_inferior_registers, attach, detach, ptrace_wait, child_resume,
	call_ptrace, pre_fork_inferior): Remove prototypes.
	* target.h (child_xfer_memory, child_pid_to_exec_file, 
	child_core_file_to_sym_file, child_post_attach,
	child_post_startup_inferior, child_acknowledge_created_inferior,
	child_insert_fork_catchpoint, child_remove_fork_catchpoint,
	child_insert_vfork_catchpoint, child_remove_vfork_catchpoint,
	child_insert_exec_catchpoint, child_remove_exec_catchpoint,
	child_follow_fork, child_reported_exec_events_per_exec_call,
	child_has_exited, child_thread_alive): Remove prototypes.


diff -urNp gdb-orig/gdb/gdbcore.h gdb-head/gdb/gdbcore.h
--- gdb-orig/gdb/gdbcore.h	2007-05-06 16:32:54.000000000 +0200
+++ gdb-head/gdb/gdbcore.h	2007-05-07 01:54:01.699177935 +0200
@@ -129,8 +129,6 @@ extern void exec_file_clear (int from_tt
 
 extern void validate_files (void);
 
-extern CORE_ADDR register_addr (int regno, CORE_ADDR blockend);
-
 /* The target vector for core files. */
 
 extern struct target_ops core_ops;
diff -urNp gdb-orig/gdb/inferior.h gdb-head/gdb/inferior.h
--- gdb-orig/gdb/inferior.h	2007-05-06 16:33:43.000000000 +0200
+++ gdb-head/gdb/inferior.h	2007-05-07 01:51:07.697810578 +0200
@@ -158,8 +158,6 @@ extern void proceed (CORE_ADDR, enum tar
    over such function.  */
 extern int step_stop_if_no_debug;
 
-extern void kill_inferior (void);
-
 extern void generic_mourn_inferior (void);
 
 extern void terminal_save_ours (void);
@@ -209,10 +207,6 @@ extern void default_print_registers_info
 					  struct frame_info *frame,
 					  int regnum, int all);
 
-extern void store_inferior_registers (struct regcache *, int);
-
-extern void fetch_inferior_registers (struct regcache *, int);
-
 extern void child_terminal_info (char *, int);
 
 extern void term_info (char *, int);
@@ -225,21 +219,6 @@ extern void terminal_init_inferior (void
 
 extern void terminal_init_inferior_with_pgrp (int pgrp);
 
-/* From infptrace.c or infttrace.c */
-
-extern int attach (int);
-
-extern void detach (int);
-
-/* PTRACE method of waiting for inferior process.  */
-int ptrace_wait (ptid_t, int *);
-
-extern void child_resume (ptid_t, int, enum target_signal);
-
-extern int call_ptrace (int, int, PTRACE_TYPE_ARG3, int);
-
-extern void pre_fork_inferior (void);
-
 /* From procfs.c */
 
 extern int proc_iterate_over_mappings (int (*)(int, CORE_ADDR));
diff -urNp gdb-orig/gdb/infptrace.c gdb-head/gdb/infptrace.c
--- gdb-orig/gdb/infptrace.c	2007-05-06 16:33:43.000000000 +0200
+++ gdb-head/gdb/infptrace.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,513 +0,0 @@
-/* Low level Unix child interface to ptrace, for GDB when running under Unix.
-   Copyright (C) 1988, 1989, 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998,
-   1999, 2000, 2001, 2002, 2004, 2007 Free Software Foundation, Inc.
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
-
-#include "defs.h"
-#include "command.h"
-#include "frame.h"
-#include "gdbcore.h"
-#include "inferior.h"
-#include "regcache.h"
-#include "target.h"
-
-#include "gdb_assert.h"
-#include "gdb_wait.h"
-#include "gdb_string.h"
-
-#include <sys/param.h>
-#include "gdb_dirent.h"
-#include <signal.h>
-#include <sys/ioctl.h>
-
-#include "gdb_ptrace.h"
-
-#ifdef HAVE_SYS_FILE_H
-#include <sys/file.h>
-#endif
-
-#if !defined (FETCH_INFERIOR_REGISTERS)
-#include <sys/user.h>		/* Probably need to poke the user structure */
-#endif /* !FETCH_INFERIOR_REGISTERS */
-
-#if !defined (CHILD_XFER_MEMORY)
-static void udot_info (char *, int);
-#endif
-
-void _initialize_infptrace (void);
-
-
-int
-call_ptrace (int request, int pid, PTRACE_TYPE_ARG3 addr, int data)
-{
-  return ptrace (request, pid, addr, data);
-}
-
-/* Wait for a process to finish, possibly running a target-specific
-   hook before returning.  */
-
-/* NOTE: cagney: 2004-09-29: Dependant on the native configuration,
-   "hppah-nat.c" may either call this or infttrace.c's implementation
-   of ptrace_wait.  See "hppahpux.mh".  */
-
-int
-ptrace_wait (ptid_t ptid, int *status)
-{
-  int wstate;
-
-  wstate = wait (status);
-  return wstate;
-}
-
-#ifndef DEPRECATED_KILL_INFERIOR
-/* NOTE: cagney/2004-09-12: Instead of definining this macro, code
-   should call inf_ptrace_target to get a basic ptrace target and then
-   locally update any necessary methods.  See ppcnbsd-nat.c.  */
-
-void
-kill_inferior (void)
-{
-  int status;
-  int pid =  PIDGET (inferior_ptid);
-
-  if (pid == 0)
-    return;
-
-  /* This once used to call "kill" to kill the inferior just in case
-     the inferior was still running.  As others have noted in the past
-     (kingdon) there shouldn't be any way to get here if the inferior
-     is still running -- else there's a major problem elsewere in gdb
-     and it needs to be fixed.
-
-     The kill call causes problems under hpux10, so it's been removed;
-     if this causes problems we'll deal with them as they arise.  */
-  ptrace (PT_KILL, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  wait (&status);
-  target_mourn_inferior ();
-}
-#endif /* DEPRECATED_KILL_INFERIOR */
-
-#ifndef DEPRECATED_CHILD_RESUME
-/* NOTE: cagney/2004-09-12: Instead of definining this macro, code
-   should call inf_ptrace_target to get a basic ptrace target and then
-   locally update any necessary methods.  See ppcnbsd-nat.c.  */
-
-/* Resume execution of the inferior process.
-   If STEP is nonzero, single-step it.
-   If SIGNAL is nonzero, give it that signal.  */
-
-void
-child_resume (ptid_t ptid, int step, enum target_signal signal)
-{
-  int request = PT_CONTINUE;
-  int pid = PIDGET (ptid);
-
-  if (pid == -1)
-    /* Resume all threads.  */
-    /* I think this only gets used in the non-threaded case, where "resume
-       all threads" and "resume inferior_ptid" are the same.  */
-    pid = PIDGET (inferior_ptid);
-
-  if (step)
-    {
-      /* If this system does not support PT_STEP, a higher level
-	 function will have called single_step() to transmute the step
-	 request into a continue request (by setting breakpoints on
-	 all possible successor instructions), so we don't have to
-	 worry about that here.  */
-
-      gdb_assert (!SOFTWARE_SINGLE_STEP_P ());
-      request = PT_STEP;
-    }
-
-  /* An address of (PTRACE_TYPE_ARG3)1 tells ptrace to continue from
-     where it was.  If GDB wanted it to start some other way, we have
-     already written a new PC value to the child.  */
-
-  errno = 0;
-  ptrace (request, pid, (PTRACE_TYPE_ARG3)1, target_signal_to_host (signal));
-  if (errno != 0)
-    perror_with_name (("ptrace"));
-}
-#endif /* DEPRECATED_CHILD_RESUME */
-
-
-/* Start debugging the process whose number is PID.  */
-
-int
-attach (int pid)
-{
-#ifdef PT_ATTACH
-  errno = 0;
-  ptrace (PT_ATTACH, pid, (PTRACE_TYPE_ARG3) 0, 0);
-  if (errno != 0)
-    perror_with_name (("ptrace"));
-  attach_flag = 1;
-  return pid;
-#else
-  error (_("This system does not support attaching to a process"));
-#endif
-}
-
-/* Stop debugging the process whose number is PID and continue it with
-   signal number SIGNAL.  SIGNAL = 0 means just continue it.  */
-
-void
-detach (int signal)
-{
-#ifdef PT_DETACH
-  int pid = PIDGET (inferior_ptid);
-
-  errno = 0;
-  ptrace (PT_DETACH, pid, (PTRACE_TYPE_ARG3) 1, signal);
-  if (errno != 0)
-    perror_with_name (("ptrace"));
-  attach_flag = 0;
-#else
-  error (_("This system does not support detaching from a process"));
-#endif
-}
-
-
-#ifndef FETCH_INFERIOR_REGISTERS
-
-/* U_REGS_OFFSET is the offset of the registers within the u area.  */
-#ifndef U_REGS_OFFSET
-
-#ifndef offsetof
-#define offsetof(TYPE, MEMBER) ((unsigned long) &((TYPE *)0)->MEMBER)
-#endif
-
-#define U_REGS_OFFSET \
-  ptrace (PT_READ_U, PIDGET (inferior_ptid), \
-	  (PTRACE_TYPE_ARG3) (offsetof (struct user, u_ar0)), 0) \
-    - KERNEL_U_ADDR
-#endif
-
-/* Fetch register REGNUM from the inferior.  */
-
-static void
-fetch_register (struct regcache *regcache, int regnum)
-{
-  CORE_ADDR addr;
-  size_t size;
-  PTRACE_TYPE_RET *buf;
-  int tid, i;
-
-  if (CANNOT_FETCH_REGISTER (regnum))
-    {
-      regcache_raw_supply (regcache, regnum, NULL);
-      return;
-    }
-
-  /* GNU/Linux LWP ID's are process ID's.  */
-  tid = TIDGET (inferior_ptid);
-  if (tid == 0)
-    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
-
-  /* This isn't really an address.  But ptrace thinks of it as one.  */
-  addr = register_addr (regnum, U_REGS_OFFSET);
-  size = register_size (current_gdbarch, regnum);
-
-  gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
-  buf = alloca (size);
-
-  /* Read the register contents from the inferior a chuck at the time.  */
-  for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
-    {
-      errno = 0;
-      buf[i] = ptrace (PT_READ_U, tid, (PTRACE_TYPE_ARG3) addr, 0);
-      if (errno != 0)
-	error (_("Couldn't read register %s (#%d): %s."), REGISTER_NAME (regnum),
-	       regnum, safe_strerror (errno));
-
-      addr += sizeof (PTRACE_TYPE_RET);
-    }
-  regcache_raw_supply (regcache, regnum, buf);
-}
-
-/* Fetch register REGNUM from the inferior.  If REGNUM is -1, do this
-   for all registers.  */
-
-void
-fetch_inferior_registers (struct regcache *regcache, int regnum)
-{
-  if (regnum == -1)
-    for (regnum = 0; regnum < NUM_REGS; regnum++)
-      fetch_register (regcache, regnum);
-  else
-    fetch_register (regcache, regnum);
-}
-
-/* Store register REGNUM into the inferior.  */
-
-static void
-store_register (const struct regcache *regcache, int regnum)
-{
-  CORE_ADDR addr;
-  size_t size;
-  PTRACE_TYPE_RET *buf;
-  int tid, i;
-
-  if (CANNOT_STORE_REGISTER (regnum))
-    return;
-
-  /* GNU/Linux LWP ID's are process ID's.  */
-  tid = TIDGET (inferior_ptid);
-  if (tid == 0)
-    tid = PIDGET (inferior_ptid); /* Not a threaded program.  */
-
-  /* This isn't really an address.  But ptrace thinks of it as one.  */
-  addr = register_addr (regnum, U_REGS_OFFSET);
-  size = register_size (current_gdbarch, regnum);
-
-  gdb_assert ((size % sizeof (PTRACE_TYPE_RET)) == 0);
-  buf = alloca (size);
-
-  /* Write the register contents into the inferior a chunk at the time.  */
-  regcache_raw_collect (regcache, regnum, buf);
-  for (i = 0; i < size / sizeof (PTRACE_TYPE_RET); i++)
-    {
-      errno = 0;
-      ptrace (PT_WRITE_U, tid, (PTRACE_TYPE_ARG3) addr, buf[i]);
-      if (errno != 0)
-	error (_("Couldn't write register %s (#%d): %s."),
-	       REGISTER_NAME (regnum), regnum, safe_strerror (errno));
-
-      addr += sizeof (PTRACE_TYPE_RET);
-    }
-}
-
-/* Store register REGNUM back into the inferior.  If REGNUM is -1, do
-   this for all registers (including the floating point registers).  */
-
-void
-store_inferior_registers (struct regcache *regcache, int regnum)
-{
-  if (regnum == -1)
-    for (regnum = 0; regnum < NUM_REGS; regnum++)
-      store_register (regcache, regnum);
-  else
-    store_register (regcache, regnum);
-}
-
-#endif /* not FETCH_INFERIOR_REGISTERS.  */
-
-
-/* Set an upper limit on alloca.  */
-#ifndef GDB_MAX_ALLOCA
-#define GDB_MAX_ALLOCA 0x1000
-#endif
-
-#if !defined (CHILD_XFER_MEMORY)
-/* NOTE! I tried using PTRACE_READDATA, etc., to read and write memory
-   in the NEW_SUN_PTRACE case.  It ought to be straightforward.  But
-   it appears that writing did not write the data that I specified.  I
-   cannot understand where it got the data that it actually did write.  */
-
-/* Copy LEN bytes to or from inferior's memory starting at MEMADDR to
-   debugger memory starting at MYADDR.  Copy to inferior if WRITE is
-   nonzero.  TARGET is ignored.
-
-   Returns the length copied, which is either the LEN argument or
-   zero.  This xfer function does not do partial moves, since
-   deprecated_child_ops doesn't allow memory operations to cross below
-   us in the target stack anyway.  */
-
-int
-child_xfer_memory (CORE_ADDR memaddr, gdb_byte *myaddr, int len, int write,
-		   struct mem_attrib *attrib, struct target_ops *target)
-{
-  int i;
-  /* Round starting address down to longword boundary.  */
-  CORE_ADDR addr = memaddr & -(CORE_ADDR) sizeof (PTRACE_TYPE_RET);
-  /* Round ending address up; get number of longwords that makes.  */
-  int count = ((((memaddr + len) - addr) + sizeof (PTRACE_TYPE_RET) - 1)
-	       / sizeof (PTRACE_TYPE_RET));
-  int alloc = count * sizeof (PTRACE_TYPE_RET);
-  PTRACE_TYPE_RET *buffer;
-  struct cleanup *old_chain = NULL;
-
-#ifdef PT_IO
-  /* OpenBSD 3.1, NetBSD 1.6 and FreeBSD 5.0 have a new PT_IO request
-     that promises to be much more efficient in reading and writing
-     data in the traced process's address space.  */
-
-  {
-    struct ptrace_io_desc piod;
-
-    /* NOTE: We assume that there are no distinct address spaces for
-       instruction and data.  */
-    piod.piod_op = write ? PIOD_WRITE_D : PIOD_READ_D;
-    piod.piod_offs = (void *) memaddr;
-    piod.piod_addr = myaddr;
-    piod.piod_len = len;
-
-    if (ptrace (PT_IO, PIDGET (inferior_ptid), (caddr_t) &piod, 0) == -1)
-      {
-	/* If the PT_IO request is somehow not supported, fallback on
-           using PT_WRITE_D/PT_READ_D.  Otherwise we will return zero
-           to indicate failure.  */
-	if (errno != EINVAL)
-	  return 0;
-      }
-    else
-      {
-	/* Return the actual number of bytes read or written.  */
-	return piod.piod_len;
-      }
-  }
-#endif
-
-  /* Allocate buffer of that many longwords.  */
-  if (len < GDB_MAX_ALLOCA)
-    {
-      buffer = (PTRACE_TYPE_RET *) alloca (alloc);
-    }
-  else
-    {
-      buffer = (PTRACE_TYPE_RET *) xmalloc (alloc);
-      old_chain = make_cleanup (xfree, buffer);
-    }
-
-  if (write)
-    {
-      /* Fill start and end extra bytes of buffer with existing memory
-         data.  */
-      if (addr != memaddr || len < (int) sizeof (PTRACE_TYPE_RET))
-	{
-	  /* Need part of initial word -- fetch it.  */
-	  buffer[0] = ptrace (PT_READ_I, PIDGET (inferior_ptid), 
-			      (PTRACE_TYPE_ARG3) addr, 0);
-	}
-
-      if (count > 1)		/* FIXME, avoid if even boundary.  */
-	{
-	  buffer[count - 1] =
-	    ptrace (PT_READ_I, PIDGET (inferior_ptid),
-		    ((PTRACE_TYPE_ARG3)
-		     (addr + (count - 1) * sizeof (PTRACE_TYPE_RET))), 0);
-	}
-
-      /* Copy data to be written over corresponding part of buffer.  */
-      memcpy ((char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
-	      myaddr, len);
-
-      /* Write the entire buffer.  */
-      for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
-	{
-	  errno = 0;
-	  ptrace (PT_WRITE_D, PIDGET (inferior_ptid), 
-		  (PTRACE_TYPE_ARG3) addr, buffer[i]);
-	  if (errno)
-	    {
-	      /* Using the appropriate one (I or D) is necessary for
-	         Gould NP1, at least.  */
-	      errno = 0;
-	      ptrace (PT_WRITE_I, PIDGET (inferior_ptid), 
-		      (PTRACE_TYPE_ARG3) addr, buffer[i]);
-	    }
-	  if (errno)
-	    return 0;
-	}
-    }
-  else
-    {
-      /* Read all the longwords.  */
-      for (i = 0; i < count; i++, addr += sizeof (PTRACE_TYPE_RET))
-	{
-	  errno = 0;
-	  buffer[i] = ptrace (PT_READ_I, PIDGET (inferior_ptid),
-			      (PTRACE_TYPE_ARG3) addr, 0);
-	  if (errno)
-	    return 0;
-	  QUIT;
-	}
-
-      /* Copy appropriate bytes out of the buffer.  */
-      memcpy (myaddr,
-	      (char *) buffer + (memaddr & (sizeof (PTRACE_TYPE_RET) - 1)),
-	      len);
-    }
-
-  if (old_chain != NULL)
-    do_cleanups (old_chain);
-  return len;
-}
-
-
-static void
-udot_info (char *dummy1, int dummy2)
-{
-#if defined (KERNEL_U_SIZE)
-  long udot_off;			/* Offset into user struct */
-  int udot_val;			/* Value from user struct at udot_off */
-  char mess[128];		/* For messages */
-#endif
-
-  if (!target_has_execution)
-    {
-      error (_("The program is not being run."));
-    }
-
-#if !defined (KERNEL_U_SIZE)
-
-  /* Adding support for this command is easy.  Typically you just add a
-     routine, called "kernel_u_size" that returns the size of the user
-     struct, to the appropriate *-nat.c file and then add to the native
-     config file "#define KERNEL_U_SIZE kernel_u_size()" */
-  error (_("Don't know how large ``struct user'' is in this version of gdb."));
-
-#else
-
-  for (udot_off = 0; udot_off < KERNEL_U_SIZE; udot_off += sizeof (udot_val))
-    {
-      if ((udot_off % 24) == 0)
-	{
-	  if (udot_off > 0)
-	    {
-	      printf_filtered ("\n");
-	    }
-	  printf_filtered ("%s:", paddr (udot_off));
-	}
-      udot_val = ptrace (PT_READ_U, PIDGET (inferior_ptid), (PTRACE_TYPE_ARG3) udot_off, 0);
-      if (errno != 0)
-	{
-	  sprintf (mess, "\nreading user struct at offset 0x%s",
-		   paddr_nz (udot_off));
-	  perror_with_name (mess);
-	}
-      /* Avoid using nonportable (?) "*" in print specs */
-      printf_filtered (sizeof (int) == 4 ? " 0x%08x" : " 0x%16x", udot_val);
-    }
-  printf_filtered ("\n");
-
-#endif
-}
-#endif /* !defined (CHILD_XFER_MEMORY).  */
-
-
-void
-_initialize_infptrace (void)
-{
-#if !defined (CHILD_XFER_MEMORY)
-  add_info ("udot", udot_info,
-	    _("Print contents of kernel ``struct user'' for current child."));
-#endif
-}
diff -urNp gdb-orig/gdb/inftarg.c gdb-head/gdb/inftarg.c
--- gdb-orig/gdb/inftarg.c	2007-05-06 16:42:41.000000000 +0200
+++ gdb-head/gdb/inftarg.c	1970-01-01 01:00:00.000000000 +0100
@@ -1,640 +0,0 @@
-/* Target-vector operations for controlling Unix child processes, for GDB.
-
-   Copyright (C) 1990, 1991, 1992, 1993, 1994, 1995, 1996, 1998, 1999, 2000,
-   2002, 2003, 2004, 2005, 2006, 2007 Free Software Foundation, Inc.
-
-   Contributed by Cygnus Support.
-
-   ## Contains temporary hacks..
-
-   This file is part of GDB.
-
-   This program is free software; you can redistribute it and/or modify
-   it under the terms of the GNU General Public License as published by
-   the Free Software Foundation; either version 2 of the License, or
-   (at your option) any later version.
-
-   This program is distributed in the hope that it will be useful,
-   but WITHOUT ANY WARRANTY; without even the implied warranty of
-   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-   GNU General Public License for more details.
-
-   You should have received a copy of the GNU General Public License
-   along with this program; if not, write to the Free Software
-   Foundation, Inc., 51 Franklin Street, Fifth Floor,
-   Boston, MA 02110-1301, USA.  */
-
-#include "defs.h"
-#include "frame.h"		/* required by inferior.h */
-#include "inferior.h"
-#include "target.h"
-#include "gdbcore.h"
-#include "command.h"
-#include "gdb_stat.h"
-#include <signal.h>
-#include <sys/types.h>
-#include <fcntl.h>
-#include "gdb_wait.h"
-#include "inflow.h"
-
-extern struct symtab_and_line *child_enable_exception_callback (enum
-								exception_event_kind,
-								int);
-
-extern struct exception_event_record
-  *child_get_current_exception_event (void);
-
-extern void _initialize_inftarg (void);
-
-static void child_prepare_to_store (struct regcache *);
-
-#ifndef CHILD_WAIT
-static ptid_t child_wait (ptid_t, struct target_waitstatus *);
-#endif /* CHILD_WAIT */
-
-static void child_open (char *, int);
-
-static void child_files_info (struct target_ops *);
-
-static void child_detach (char *, int);
-
-static void child_attach (char *, int);
-
-#if !defined(CHILD_POST_ATTACH)
-extern void child_post_attach (int);
-#endif
-
-static void ptrace_me (void);
-
-static void ptrace_him (int);
-
-static void child_create_inferior (char *, char *, char **, int);
-
-static void child_mourn_inferior (void);
-
-static int child_can_run (void);
-
-static void child_stop (void);
-
-#ifndef CHILD_THREAD_ALIVE
-int child_thread_alive (ptid_t);
-#endif
-
-static void init_child_ops (void);
-
-extern char **environ;
-
-int child_suppress_run = 0;	/* Non-zero if inftarg should pretend not to
-				   be a runnable target.  Used by targets
-				   that can sit atop inftarg, such as HPUX
-				   thread support.  */
-
-#ifndef CHILD_WAIT
-
-/* Wait for child to do something.  Return pid of child, or -1 in case
-   of error; store status through argument pointer OURSTATUS.  */
-
-static ptid_t
-child_wait (ptid_t ptid, struct target_waitstatus *ourstatus)
-{
-  int save_errno;
-  int status;
-  char *execd_pathname = NULL;
-  int exit_status;
-  int syscall_id;
-  enum target_waitkind kind;
-  int pid;
-
-  do
-    {
-      set_sigint_trap ();	/* Causes SIGINT to be passed on to the
-				   attached process. */
-      set_sigio_trap ();
-
-      pid = wait (&status);
-
-      save_errno = errno;
-
-      clear_sigio_trap ();
-
-      clear_sigint_trap ();
-
-      if (pid == -1)
-	{
-	  if (save_errno == EINTR)
-	    continue;
-
-	  fprintf_unfiltered (gdb_stderr, "Child process unexpectedly missing: %s.\n",
-			      safe_strerror (save_errno));
-
-	  /* Claim it exited with unknown signal.  */
-	  ourstatus->kind = TARGET_WAITKIND_SIGNALLED;
-	  ourstatus->value.sig = TARGET_SIGNAL_UNKNOWN;
-	  return pid_to_ptid (-1);
-	}
-
-      /* Did it exit?
-       */
-      if (target_has_exited (pid, status, &exit_status))
-	{
-	  /* ??rehrauer: For now, ignore this. */
-	  continue;
-	}
-
-      if (!target_thread_alive (pid_to_ptid (pid)))
-	{
-	  ourstatus->kind = TARGET_WAITKIND_SPURIOUS;
-	  return pid_to_ptid (pid);
-	}
-      } while (pid != PIDGET (inferior_ptid)); /* Some other child died or stopped */
-
-  store_waitstatus (ourstatus, status);
-  return pid_to_ptid (pid);
-}
-#endif /* CHILD_WAIT */
-
-#ifndef CHILD_THREAD_ALIVE
-
-/* Check to see if the given thread is alive.
-
-   FIXME: Is kill() ever the right way to do this?  I doubt it, but
-   for now we're going to try and be compatable with the old thread
-   code.  */
-int
-child_thread_alive (ptid_t ptid)
-{
-  pid_t pid = PIDGET (ptid);
-
-  return (kill (pid, 0) != -1);
-}
-
-#endif
-
-/* Attach to process PID, then initialize for debugging it.  */
-
-static void
-child_attach (char *args, int from_tty)
-{
-  char *exec_file;
-  int pid;
-  char *dummy;
-
-  if (!args)
-    error_no_arg (_("process-id to attach"));
-
-  dummy = args;
-  pid = strtol (args, &dummy, 0);
-  /* Some targets don't set errno on errors, grrr! */
-  if ((pid == 0) && (args == dummy))
-      error (_("Illegal process-id: %s."), args);
-  
-  if (pid == getpid ())	/* Trying to masturbate? */
-    error (_("I refuse to debug myself!"));
-  
-  if (from_tty)
-    {
-      exec_file = (char *) get_exec_file (0);
-      
-      if (exec_file)
-	printf_unfiltered (_("Attaching to program: %s, %s\n"), exec_file,
-			   target_pid_to_str (pid_to_ptid (pid)));
-      else
-	printf_unfiltered (_("Attaching to %s\n"),
-			   target_pid_to_str (pid_to_ptid (pid)));
-      
-      gdb_flush (gdb_stdout);
-    }
-
-  attach (pid);
-  
-  inferior_ptid = pid_to_ptid (pid);
-  push_target (&deprecated_child_ops);
-}
-
-#if !defined(CHILD_POST_ATTACH)
-void
-child_post_attach (int pid)
-{
-  /* This version of Unix doesn't require a meaningful "post attach"
-     operation by a debugger.  */
-}
-#endif
-
-/* Take a program previously attached to and detaches it.
-   The program resumes execution and will no longer stop
-   on signals, etc.  We'd better not have left any breakpoints
-   in the program or it'll die when it hits one.  For this
-   to work, it may be necessary for the process to have been
-   previously attached.  It *might* work if the program was
-   started via the normal ptrace (PTRACE_TRACEME).  */
-
-static void
-child_detach (char *args, int from_tty)
-{
-  int siggnal = 0;
-  int pid = PIDGET (inferior_ptid);
-  
-  if (from_tty)
-    {
-      char *exec_file = get_exec_file (0);
-      if (exec_file == 0)
-	exec_file = "";
-      printf_unfiltered (_("Detaching from program: %s, %s\n"), exec_file,
-			 target_pid_to_str (pid_to_ptid (pid)));
-      gdb_flush (gdb_stdout);
-    }
-  if (args)
-    siggnal = atoi (args);
-  
-  detach (siggnal);
-  
-  inferior_ptid = null_ptid;
-  unpush_target (&deprecated_child_ops);
-}
-
-/* Get ready to modify the registers array.  On machines which store
-   individual registers, this doesn't need to do anything.  On machines
-   which store all the registers in one fell swoop, this makes sure
-   that registers contains all the registers from the program being
-   debugged.  */
-
-static void
-child_prepare_to_store (struct regcache *regcache)
-{
-}
-
-/* Print status information about what we're accessing.  */
-
-static void
-child_files_info (struct target_ops *ignore)
-{
-  printf_unfiltered (_("\tUsing the running image of %s %s.\n"),
-      attach_flag ? "attached" : "child", target_pid_to_str (inferior_ptid));
-}
-
-static void
-child_open (char *arg, int from_tty)
-{
-  error (_("Use the \"run\" command to start a Unix child process."));
-}
-
-/* Stub function which causes the inferior that runs it, to be ptrace-able
-   by its parent process.  */
-
-static void
-ptrace_me (void)
-{
-  /* "Trace me, Dr. Memory!" */
-  call_ptrace (0, 0, (PTRACE_TYPE_ARG3) 0, 0);
-}
-
-/* Stub function which causes the GDB that runs it, to start ptrace-ing
-   the child process.  */
-
-static void
-ptrace_him (int pid)
-{
-  push_target (&deprecated_child_ops);
-
-  /* On some targets, there must be some explicit synchronization
-     between the parent and child processes after the debugger
-     forks, and before the child execs the debuggee program.  This
-     call basically gives permission for the child to exec.
-   */
-
-  target_acknowledge_created_inferior (pid);
-
-  /* START_INFERIOR_TRAPS_EXPECTED is defined in inferior.h,
-   * and will be 1 or 2 depending on whether we're starting
-   * without or with a shell.
-   */
-  startup_inferior (START_INFERIOR_TRAPS_EXPECTED);
-
-  /* On some targets, there must be some explicit actions taken after
-     the inferior has been started up.
-   */
-  target_post_startup_inferior (pid_to_ptid (pid));
-}
-
-/* Start an inferior Unix child process and sets inferior_ptid to its pid.
-   EXEC_FILE is the file to run.
-   ALLARGS is a string containing the arguments to the program.
-   ENV is the environment vector to pass.  Errors reported with error().  */
-
-static void
-child_create_inferior (char *exec_file, char *allargs, char **env,
-		       int from_tty)
-{
-  fork_inferior (exec_file, allargs, env, ptrace_me, ptrace_him, NULL, NULL);
-}
-
-#if !defined(CHILD_POST_STARTUP_INFERIOR)
-void
-child_post_startup_inferior (ptid_t ptid)
-{
-  /* This version of Unix doesn't require a meaningful "post startup inferior"
-     operation by a debugger.
-   */
-}
-#endif
-
-#if !defined(CHILD_ACKNOWLEDGE_CREATED_INFERIOR)
-void
-child_acknowledge_created_inferior (int pid)
-{
-  /* This version of Unix doesn't require a meaningful "acknowledge created inferior"
-     operation by a debugger.
-   */
-}
-#endif
-
-
-#if !defined(CHILD_INSERT_FORK_CATCHPOINT)
-void
-child_insert_fork_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of fork
-     events.  */
-}
-#endif
-
-#if !defined(CHILD_REMOVE_FORK_CATCHPOINT)
-int
-child_remove_fork_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of fork events.  */
-  return 0;
-}
-#endif
-
-#if !defined(CHILD_INSERT_VFORK_CATCHPOINT)
-void
-child_insert_vfork_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of vfork
-     events.  */
-}
-#endif
-
-#if !defined(CHILD_REMOVE_VFORK_CATCHPOINT)
-int
-child_remove_vfork_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of vfork events.  */
-  return 0;
-}
-#endif
-
-#if !defined(CHILD_FOLLOW_FORK)
-int
-child_follow_fork (struct target_ops *ops, int follow_child)
-{
-  /* This version of Unix doesn't support following fork or vfork events.  */
-  return 0;
-}
-#endif
-
-#if !defined(CHILD_INSERT_EXEC_CATCHPOINT)
-void
-child_insert_exec_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of exec
-     events.  */
-}
-#endif
-
-#if !defined(CHILD_REMOVE_EXEC_CATCHPOINT)
-int
-child_remove_exec_catchpoint (int pid)
-{
-  /* This version of Unix doesn't support notification of exec events.  */
-  return 0;
-}
-#endif
-
-#if !defined(CHILD_REPORTED_EXEC_EVENTS_PER_EXEC_CALL)
-int
-child_reported_exec_events_per_exec_call (void)
-{
-  /* This version of Unix doesn't support notification of exec events.
-   */
-  return 1;
-}
-#endif
-
-#if !defined(CHILD_HAS_EXITED)
-int
-child_has_exited (int pid, int wait_status, int *exit_status)
-{
-  if (WIFEXITED (wait_status))
-    {
-      *exit_status = WEXITSTATUS (wait_status);
-      return 1;
-    }
-
-  if (WIFSIGNALED (wait_status))
-    {
-      *exit_status = 0;		/* ?? Don't know what else to say here. */
-      return 1;
-    }
-
-  /* ?? Do we really need to consult the event state, too?  Assume the
-     wait_state alone suffices.
-   */
-  return 0;
-}
-#endif
-
-
-static void
-child_mourn_inferior (void)
-{
-  unpush_target (&deprecated_child_ops);
-  generic_mourn_inferior ();
-}
-
-static int
-child_can_run (void)
-{
-  /* This variable is controlled by modules that sit atop inftarg that may layer
-     their own process structure atop that provided here.  hpux-thread.c does
-     this because of the Hpux user-mode level thread model.  */
-
-  return !child_suppress_run;
-}
-
-/* Send a SIGINT to the process group.  This acts just like the user typed a
-   ^C on the controlling terminal.
-
-   XXX - This may not be correct for all systems.  Some may want to use
-   killpg() instead of kill (-pgrp). */
-
-static void
-child_stop (void)
-{
-  kill (-inferior_process_group, SIGINT);
-}
-
-#if !defined(CHILD_ENABLE_EXCEPTION_CALLBACK)
-struct symtab_and_line *
-child_enable_exception_callback (enum exception_event_kind kind, int enable)
-{
-  return (struct symtab_and_line *) NULL;
-}
-#endif
-
-#if !defined(CHILD_GET_CURRENT_EXCEPTION_EVENT)
-struct exception_event_record *
-child_get_current_exception_event (void)
-{
-  return (struct exception_event_record *) NULL;
-}
-#endif
-
-
-#if !defined(CHILD_PID_TO_EXEC_FILE)
-char *
-child_pid_to_exec_file (int pid)
-{
-  /* This version of Unix doesn't support translation of a process ID
-     to the filename of the executable file.
-   */
-  return NULL;
-}
-#endif
-
-char *
-child_core_file_to_sym_file (char *core)
-{
-  /* The target stratum for a running executable need not support
-     this operation.
-   */
-  return NULL;
-}
-
-/* Perform a partial transfer to/from the specified object.  For
-   memory transfers, fall back to the old memory xfer functions.  */
-
-static LONGEST
-child_xfer_partial (struct target_ops *ops, enum target_object object,
-		    const char *annex, gdb_byte *readbuf,
-		    const gdb_byte *writebuf, ULONGEST offset, LONGEST len)
-{
-  switch (object)
-    {
-    case TARGET_OBJECT_MEMORY:
-      if (readbuf)
-	return child_xfer_memory (offset, readbuf, len, 0/*write*/,
-				  NULL, ops);
-      if (writebuf)
-	return child_xfer_memory (offset, (void *) writebuf, len, 1/*write*/,
-				  NULL, ops);
-      return -1;
-
-    case TARGET_OBJECT_UNWIND_TABLE:
-#ifndef NATIVE_XFER_UNWIND_TABLE
-#define NATIVE_XFER_UNWIND_TABLE(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
-#endif
-      return NATIVE_XFER_UNWIND_TABLE (ops, object, annex, readbuf, writebuf,
-				       offset, len);
-
-    case TARGET_OBJECT_AUXV:
-#ifndef NATIVE_XFER_AUXV
-#define NATIVE_XFER_AUXV(OPS,OBJECT,ANNEX,WRITEBUF,READBUF,OFFSET,LEN) (-1)
-#endif
-      return NATIVE_XFER_AUXV (ops, object, annex, readbuf, writebuf,
-			       offset, len);
-
-    default:
-      return -1;
-    }
-}
-
-#if !defined(CHILD_PID_TO_STR)
-char *
-child_pid_to_str (ptid_t ptid)
-{
-  return normal_pid_to_str (ptid);
-}
-#endif
-
-static void
-init_child_ops (void)
-{
-  deprecated_child_ops.to_shortname = "child";
-  deprecated_child_ops.to_longname = "Unix child process";
-  deprecated_child_ops.to_doc = "Unix child process (started by the \"run\" command).";
-  deprecated_child_ops.to_open = child_open;
-  deprecated_child_ops.to_attach = child_attach;
-  deprecated_child_ops.to_post_attach = child_post_attach;
-  deprecated_child_ops.to_detach = child_detach;
-  deprecated_child_ops.to_resume = child_resume;
-  deprecated_child_ops.to_wait = child_wait;
-  deprecated_child_ops.to_fetch_registers = fetch_inferior_registers;
-  deprecated_child_ops.to_store_registers = store_inferior_registers;
-  deprecated_child_ops.to_prepare_to_store = child_prepare_to_store;
-  deprecated_child_ops.deprecated_xfer_memory = child_xfer_memory;
-  deprecated_child_ops.to_xfer_partial = child_xfer_partial;
-  deprecated_child_ops.to_files_info = child_files_info;
-  deprecated_child_ops.to_insert_breakpoint = memory_insert_breakpoint;
-  deprecated_child_ops.to_remove_breakpoint = memory_remove_breakpoint;
-  deprecated_child_ops.to_terminal_init = terminal_init_inferior;
-  deprecated_child_ops.to_terminal_inferior = terminal_inferior;
-  deprecated_child_ops.to_terminal_ours_for_output = terminal_ours_for_output;
-  deprecated_child_ops.to_terminal_save_ours = terminal_save_ours;
-  deprecated_child_ops.to_terminal_ours = terminal_ours;
-  deprecated_child_ops.to_terminal_info = child_terminal_info;
-  deprecated_child_ops.to_kill = kill_inferior;
-  deprecated_child_ops.to_create_inferior = child_create_inferior;
-  deprecated_child_ops.to_post_startup_inferior = child_post_startup_inferior;
-  deprecated_child_ops.to_acknowledge_created_inferior = child_acknowledge_created_inferior;
-  deprecated_child_ops.to_insert_fork_catchpoint = child_insert_fork_catchpoint;
-  deprecated_child_ops.to_remove_fork_catchpoint = child_remove_fork_catchpoint;
-  deprecated_child_ops.to_insert_vfork_catchpoint = child_insert_vfork_catchpoint;
-  deprecated_child_ops.to_remove_vfork_catchpoint = child_remove_vfork_catchpoint;
-  deprecated_child_ops.to_follow_fork = child_follow_fork;
-  deprecated_child_ops.to_insert_exec_catchpoint = child_insert_exec_catchpoint;
-  deprecated_child_ops.to_remove_exec_catchpoint = child_remove_exec_catchpoint;
-  deprecated_child_ops.to_reported_exec_events_per_exec_call = child_reported_exec_events_per_exec_call;
-  deprecated_child_ops.to_has_exited = child_has_exited;
-  deprecated_child_ops.to_mourn_inferior = child_mourn_inferior;
-  deprecated_child_ops.to_can_run = child_can_run;
-  deprecated_child_ops.to_thread_alive = child_thread_alive;
-  deprecated_child_ops.to_pid_to_str = child_pid_to_str;
-  deprecated_child_ops.to_stop = child_stop;
-  deprecated_child_ops.to_enable_exception_callback = child_enable_exception_callback;
-  deprecated_child_ops.to_get_current_exception_event = child_get_current_exception_event;
-  deprecated_child_ops.to_pid_to_exec_file = child_pid_to_exec_file;
-  deprecated_child_ops.to_stratum = process_stratum;
-  deprecated_child_ops.to_has_all_memory = 1;
-  deprecated_child_ops.to_has_memory = 1;
-  deprecated_child_ops.to_has_stack = 1;
-  deprecated_child_ops.to_has_registers = 1;
-  deprecated_child_ops.to_has_execution = 1;
-  deprecated_child_ops.to_magic = OPS_MAGIC;
-}
-
-void
-_initialize_inftarg (void)
-{
-#ifdef HAVE_OPTIONAL_PROC_FS
-  char procname[32];
-  int fd;
-
-  /* If we have an optional /proc filesystem (e.g. under OSF/1),
-     don't add ptrace support if we can access the running GDB via /proc.  */
-#ifndef PROC_NAME_FMT
-#define PROC_NAME_FMT "/proc/%05d"
-#endif
-  sprintf (procname, PROC_NAME_FMT, getpid ());
-  fd = open (procname, O_RDONLY);
-  if (fd >= 0)
-    {
-      close (fd);
-      return;
-    }
-#endif
-
-  init_child_ops ();
-  add_target (&deprecated_child_ops);
-}
diff -urNp gdb-orig/gdb/Makefile.in gdb-head/gdb/Makefile.in
--- gdb-orig/gdb/Makefile.in	2007-05-06 16:32:03.000000000 +0200
+++ gdb-head/gdb/Makefile.in	2007-05-07 01:49:13.842943863 +0200
@@ -1452,7 +1452,7 @@ ALLDEPFILES = \
 	i386gnu-nat.c i386gnu-tdep.c \
 	ia64-linux-nat.c ia64-linux-tdep.c ia64-tdep.c \
 	inf-ptrace.c inf-ttrace.c \
-	infptrace.c inftarg.c irix5-nat.c \
+	irix5-nat.c \
 	libunwind-frame.c \
 	linux-fork.c \
 	m68hc11-tdep.c \
@@ -2172,18 +2172,12 @@ inflow.o: inflow.c $(defs_h) $(frame_h) 
 inf-ptrace.o: inf-ptrace.c $(defs_h) $(command_h) $(inferior_h) $(inflow_h) \
 	$(gdbcore_h) $(regcache_h) $(gdb_stdint_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) \
-	$(gdb_wait_h) $(gdb_string_h) $(gdb_dirent_h) $(gdb_ptrace_h)
 infrun.o: infrun.c $(defs_h) $(gdb_string_h) $(symtab_h) $(frame_h) \
 	$(inferior_h) $(exceptions_h) $(breakpoint_h) $(gdb_wait_h) \
 	$(gdbcore_h) $(gdbcmd_h) $(cli_script_h) $(target_h) $(gdbthread_h) \
 	$(annotate_h) $(symfile_h) $(top_h) $(inf_loop_h) $(regcache_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) $(gdb_wait_h) \
-	$(inflow_h)
 inf-ttrace.o: inf-ttrace.c $(defs_h) $(command_h) $(gdbcore_h) \
 	$(gdbthread_h) $(inferior_h) $(target_h) \
 	$(gdb_assert_h) $(gdb_string_h) $(inf_child_h) $(inf_ttrace_h)
diff -urNp gdb-orig/gdb/target.h gdb-head/gdb/target.h
--- gdb-orig/gdb/target.h	2007-05-06 16:42:41.000000000 +0200
+++ gdb-head/gdb/target.h	2007-05-07 01:53:34.617960421 +0200
@@ -621,9 +621,6 @@ extern int target_write_memory (CORE_ADD
 extern int xfer_memory (CORE_ADDR, gdb_byte *, int, int,
 			struct mem_attrib *, struct target_ops *);
 
-extern int child_xfer_memory (CORE_ADDR, gdb_byte *, int, int,
-			      struct mem_attrib *, struct target_ops *);
-
 /* Fetches the target's memory map.  If one is found it is sorted
    and returned, after some consistency checking.  Otherwise, NULL
    is returned.  */
@@ -678,41 +675,6 @@ int target_write_memory_blocks (VEC(memo
 				enum flash_preserve_mode preserve_flash_p,
 				void (*progress_cb) (ULONGEST, void *));
 
-
-extern char *child_pid_to_exec_file (int);
-
-extern char *child_core_file_to_sym_file (char *);
-
-#if defined(CHILD_POST_ATTACH)
-extern void child_post_attach (int);
-#endif
-
-extern void child_post_startup_inferior (ptid_t);
-
-extern void child_acknowledge_created_inferior (int);
-
-extern void child_insert_fork_catchpoint (int);
-
-extern int child_remove_fork_catchpoint (int);
-
-extern void child_insert_vfork_catchpoint (int);
-
-extern int child_remove_vfork_catchpoint (int);
-
-extern void child_acknowledge_created_inferior (int);
-
-extern int child_follow_fork (struct target_ops *, int);
-
-extern void child_insert_exec_catchpoint (int);
-
-extern int child_remove_exec_catchpoint (int);
-
-extern int child_reported_exec_events_per_exec_call (void);
-
-extern int child_has_exited (int, int, int *);
-
-extern int child_thread_alive (ptid_t);
-
 /* From infrun.c.  */
 
 extern int inferior_has_forked (int pid, int *child_pid);
-- 
  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]