4.4BSD snapshot (revision 8.1); add 1993 to copyright
[unix-history] / usr / src / usr.bin / pascal / pdx / process / rdwr.c
index e7c6fb0..83281d8 100644 (file)
@@ -1,14 +1,16 @@
-/*
- * Copyright (c) 1980 Regents of the University of California.
- * All rights reserved.  The Berkeley software License Agreement
- * specifies the terms and conditions for redistribution.
+/*-
+ * Copyright (c) 1980, 1993
+ *     The Regents of the University of California.  All rights reserved.
+ *
+ * %sccs.include.redist.c%
  */
 
 #ifndef lint
  */
 
 #ifndef lint
-static char sccsid[] = "@(#)rdwr.c     5.1 (Berkeley) %G%";
-#endif not lint
+static char sccsid[] = "@(#)rdwr.c     8.1 (Berkeley) %G%";
+#endif /* not lint */
+
 /*
 /*
- * These routines are used to access the debuggee process from
+ * This routine is used to access the debuggee process from
  * outside the "process" module.
  *
  * They invoke "pio" which eventually leads to a call to "ptrace".
  * outside the "process" module.
  *
  * They invoke "pio" which eventually leads to a call to "ptrace".
@@ -21,94 +23,32 @@ static char sccsid[] = "@(#)rdwr.c  5.1 (Berkeley) %G%";
 #include "process.h"
 #include "process.rep"
 
 #include "process.h"
 #include "process.rep"
 
-#      if (isvaxpx)
-#              include "pxinfo.h"
-#      endif
+#      include "pxinfo.h"
 
 typedef int INTFUNC();
 
 extern INTFUNC *onsyserr();
 
 LOCAL badaddr;
 
 typedef int INTFUNC();
 
 extern INTFUNC *onsyserr();
 
 LOCAL badaddr;
+LOCAL PIO_OP rwflg;
 LOCAL rwerr();
 
 /*
 LOCAL rwerr();
 
 /*
- * Read from the process' instruction area.  For px, this is actually
- * the data area.
- */
-
-iread(buff, addr, nbytes)
-char *buff;
-ADDRESS addr;
-int nbytes;
-{
-       INTFUNC *f;
-
-       f = onsyserr(EIO, &rwerr);
-#      if (isvaxpx)
-               badaddr = addr + ENDOFF;
-               pio(process, PREAD, DATASEG, buff, addr + ENDOFF, nbytes);
-#      else
-               badaddr = addr;
-               pio(process, PREAD, TEXTSEG, buff, addr, nbytes);
-#      endif
-       onsyserr(EIO, f);
-}
-
-/* 
- * Write to the process' instruction area, usually in order to set
- * or unset a breakpoint.
- */
-
-iwrite(buff, addr, nbytes)
-char *buff;
-ADDRESS addr;
-int nbytes;
-{
-       INTFUNC *f;
-
-       f = onsyserr(EIO, &rwerr);
-#      if (isvaxpx)
-               badaddr = addr + ENDOFF;
-               pio(process, PWRITE, DATASEG, buff, addr + ENDOFF, nbytes);
-#      else
-               badaddr = addr;
-               pio(process, PWRITE, TEXTSEG, buff, addr, nbytes);
-#      endif
-       onsyserr(EIO, f);
-}
-
-/*
- * Read for the process' data area.
- */
-
-dread(buff, addr, nbytes)
-char *buff;
-ADDRESS addr;
-int nbytes;
-{
-       INTFUNC *f;
-
-       f = onsyserr(EIO, &rwerr);
-       badaddr = addr;
-       pio(process, PREAD, DATASEG, buff, addr, nbytes);
-       onsyserr(EIO, f);
-}
-
-/*
- * Write to the process' data area.
+ * Read/Write to the process' data area.
  */
 
  */
 
-dwrite(buff, addr, nbytes)
+drdwr(rw, buff, addr, nbytes)
+PIO_OP rw;
 char *buff;
 ADDRESS addr;
 int nbytes;
 {
        INTFUNC *f;
 
 char *buff;
 ADDRESS addr;
 int nbytes;
 {
        INTFUNC *f;
 
-       f = onsyserr(EIO, &rwerr);
+       f = onsyserr(EIO, rwerr);
        badaddr = addr;
        badaddr = addr;
-       pio(process, PWRITE, DATASEG, buff, addr, nbytes);
+       rwflg = rw;
+       pio(process, rw, DATASEG, buff, addr, nbytes);
        onsyserr(EIO, f);
 }
 
        onsyserr(EIO, f);
 }
 
@@ -118,5 +58,6 @@ int nbytes;
 
 LOCAL rwerr()
 {
 
 LOCAL rwerr()
 {
-       error("bad read/write process address 0x%x", badaddr);
+       error("bad %s process address 0x%x",
+               rwflg == PREAD ? "read" : "write", badaddr);
 }
 }