Annotation of 43BSD/ucb/pascal/pdx/process/rdwr.c, revision 1.1

1.1     ! root        1: /*
        !             2:  * Copyright (c) 1980 Regents of the University of California.
        !             3:  * All rights reserved.  The Berkeley software License Agreement
        !             4:  * specifies the terms and conditions for redistribution.
        !             5:  */
        !             6: 
        !             7: #ifndef lint
        !             8: static char sccsid[] = "@(#)rdwr.c     5.1 (Berkeley) 6/6/85";
        !             9: #endif not lint
        !            10: /*
        !            11:  * These routines are used to access the debuggee process from
        !            12:  * outside the "process" module.
        !            13:  *
        !            14:  * They invoke "pio" which eventually leads to a call to "ptrace".
        !            15:  * The system generates an I/O error when a ptrace fails, we catch
        !            16:  * that here and assume its due to a misguided address.
        !            17:  */
        !            18: 
        !            19: #include "defs.h"
        !            20: #include <errno.h>
        !            21: #include "process.h"
        !            22: #include "process.rep"
        !            23: 
        !            24: #      if (isvaxpx)
        !            25: #              include "pxinfo.h"
        !            26: #      endif
        !            27: 
        !            28: typedef int INTFUNC();
        !            29: 
        !            30: extern INTFUNC *onsyserr();
        !            31: 
        !            32: LOCAL badaddr;
        !            33: LOCAL rwerr();
        !            34: 
        !            35: /*
        !            36:  * Read from the process' instruction area.  For px, this is actually
        !            37:  * the data area.
        !            38:  */
        !            39: 
        !            40: iread(buff, addr, nbytes)
        !            41: char *buff;
        !            42: ADDRESS addr;
        !            43: int nbytes;
        !            44: {
        !            45:        INTFUNC *f;
        !            46: 
        !            47:        f = onsyserr(EIO, &rwerr);
        !            48: #      if (isvaxpx)
        !            49:                badaddr = addr + ENDOFF;
        !            50:                pio(process, PREAD, DATASEG, buff, addr + ENDOFF, nbytes);
        !            51: #      else
        !            52:                badaddr = addr;
        !            53:                pio(process, PREAD, TEXTSEG, buff, addr, nbytes);
        !            54: #      endif
        !            55:        onsyserr(EIO, f);
        !            56: }
        !            57: 
        !            58: /* 
        !            59:  * Write to the process' instruction area, usually in order to set
        !            60:  * or unset a breakpoint.
        !            61:  */
        !            62: 
        !            63: iwrite(buff, addr, nbytes)
        !            64: char *buff;
        !            65: ADDRESS addr;
        !            66: int nbytes;
        !            67: {
        !            68:        INTFUNC *f;
        !            69: 
        !            70:        f = onsyserr(EIO, &rwerr);
        !            71: #      if (isvaxpx)
        !            72:                badaddr = addr + ENDOFF;
        !            73:                pio(process, PWRITE, DATASEG, buff, addr + ENDOFF, nbytes);
        !            74: #      else
        !            75:                badaddr = addr;
        !            76:                pio(process, PWRITE, TEXTSEG, buff, addr, nbytes);
        !            77: #      endif
        !            78:        onsyserr(EIO, f);
        !            79: }
        !            80: 
        !            81: /*
        !            82:  * Read for the process' data area.
        !            83:  */
        !            84: 
        !            85: dread(buff, addr, nbytes)
        !            86: char *buff;
        !            87: ADDRESS addr;
        !            88: int nbytes;
        !            89: {
        !            90:        INTFUNC *f;
        !            91: 
        !            92:        f = onsyserr(EIO, &rwerr);
        !            93:        badaddr = addr;
        !            94:        pio(process, PREAD, DATASEG, buff, addr, nbytes);
        !            95:        onsyserr(EIO, f);
        !            96: }
        !            97: 
        !            98: /*
        !            99:  * Write to the process' data area.
        !           100:  */
        !           101: 
        !           102: dwrite(buff, addr, nbytes)
        !           103: char *buff;
        !           104: ADDRESS addr;
        !           105: int nbytes;
        !           106: {
        !           107:        INTFUNC *f;
        !           108: 
        !           109:        f = onsyserr(EIO, &rwerr);
        !           110:        badaddr = addr;
        !           111:        pio(process, PWRITE, DATASEG, buff, addr, nbytes);
        !           112:        onsyserr(EIO, f);
        !           113: }
        !           114: 
        !           115: /*
        !           116:  * Error handler.
        !           117:  */
        !           118: 
        !           119: LOCAL rwerr()
        !           120: {
        !           121:        error("bad read/write process address 0x%x", badaddr);
        !           122: }

unix.superglobalmegacorp.com

This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.