/* Copyright (c) 1982 Regents of the University of California */
static char sccsid
[] = "@(#)rdwr.c 1.1 1/18/82";
* These routines are used to access the debuggee process from
* outside the "process" module.
* They invoke "pio" which eventually leads to a call to "ptrace".
* The system generates an I/O error when a ptrace fails, we catch
* that here and assume its due to a misguided address.
extern INTFUNC
*onsyserr();
* Read from the process' instruction area. For px, this is actually
iread(buff
, addr
, nbytes
)
f
= onsyserr(EIO
, &rwerr
);
pio(process
, PREAD
, DATASEG
, buff
, addr
+ ENDOFF
, nbytes
);
pio(process
, PREAD
, TEXTSEG
, buff
, addr
, nbytes
);
* Write to the process' instruction area, usually in order to set
iwrite(buff
, addr
, nbytes
)
f
= onsyserr(EIO
, &rwerr
);
pio(process
, PWRITE
, DATASEG
, buff
, addr
+ ENDOFF
, nbytes
);
pio(process
, PWRITE
, TEXTSEG
, buff
, addr
, nbytes
);
* Read for the process' data area.
dread(buff
, addr
, nbytes
)
f
= onsyserr(EIO
, &rwerr
);
pio(process
, PREAD
, DATASEG
, buff
, addr
, nbytes
);
* Write to the process' data area.
dwrite(buff
, addr
, nbytes
)
f
= onsyserr(EIO
, &rwerr
);
pio(process
, PWRITE
, DATASEG
, buff
, addr
, nbytes
);
error("bad read/write process address 0x%x", badaddr
);