|
|
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.3 (Berkeley) 4/7/87"; ! 9: #endif not lint ! 10: ! 11: /* ! 12: * This routine is used to access the debuggee process from ! 13: * outside the "process" module. ! 14: * ! 15: * They invoke "pio" which eventually leads to a call to "ptrace". ! 16: * The system generates an I/O error when a ptrace fails, we catch ! 17: * that here and assume its due to a misguided address. ! 18: */ ! 19: ! 20: #include "defs.h" ! 21: #include <errno.h> ! 22: #include "process.h" ! 23: #include "process.rep" ! 24: ! 25: # include "pxinfo.h" ! 26: ! 27: typedef int INTFUNC(); ! 28: ! 29: extern INTFUNC *onsyserr(); ! 30: ! 31: LOCAL badaddr; ! 32: LOCAL PIO_OP rwflg; ! 33: LOCAL rwerr(); ! 34: ! 35: /* ! 36: * Read/Write to the process' data area. ! 37: */ ! 38: ! 39: drdwr(rw, buff, addr, nbytes) ! 40: PIO_OP rw; ! 41: char *buff; ! 42: ADDRESS addr; ! 43: int nbytes; ! 44: { ! 45: INTFUNC *f; ! 46: ! 47: f = onsyserr(EIO, rwerr); ! 48: badaddr = addr; ! 49: rwflg = rw; ! 50: pio(process, rw, DATASEG, buff, addr, nbytes); ! 51: onsyserr(EIO, f); ! 52: } ! 53: ! 54: /* ! 55: * Error handler. ! 56: */ ! 57: ! 58: LOCAL rwerr() ! 59: { ! 60: error("bad %s process address 0x%x", ! 61: rwflg == PREAD ? "read" : "write", badaddr); ! 62: }
This archive runs on limited infrastructure. Preserving old code on modern bandwidth. Automated agents are requested to crawl responsibly.