79 lines
2.1 KiB
Plaintext
79 lines
2.1 KiB
Plaintext
*** debugger/memory.c.orig Sat Jun 13 05:30:46 1998
|
|
--- debugger/memory.c Sun Jul 5 23:31:40 1998
|
|
***************
|
|
*** 19,25 ****
|
|
* write (rwflag == 0)
|
|
************************************************************/
|
|
|
|
! #ifdef linux
|
|
BOOL32 DEBUG_checkmap_bad( const char *addr, size_t size, int rwflag)
|
|
{
|
|
FILE *fp;
|
|
--- 19,25 ----
|
|
* write (rwflag == 0)
|
|
************************************************************/
|
|
|
|
! #if defined(linux) || defined(__FreeBSD__) || defined(__OpenBSD__)
|
|
BOOL32 DEBUG_checkmap_bad( const char *addr, size_t size, int rwflag)
|
|
{
|
|
FILE *fp;
|
|
***************
|
|
*** 28,33 ****
|
|
--- 28,34 ----
|
|
char *start, *end;
|
|
int ret = TRUE;
|
|
|
|
+ #ifdef linux
|
|
/*
|
|
The entries in /proc/self/maps are of the form:
|
|
08000000-08002000 r-xp 00000000 03:41 2361
|
|
***************
|
|
*** 41,52 ****
|
|
|
|
Only permissions start and end are used here
|
|
*/
|
|
!
|
|
if (!(fp = fopen("/proc/self/maps", "r")))
|
|
return FALSE;
|
|
|
|
while (fgets( buf, 79, fp)) {
|
|
sscanf(buf, "%x-%x %3s", (int *) &start, (int *) &end, prot);
|
|
if ( end <= addr)
|
|
continue;
|
|
if (start <= addr && addr+size < end) {
|
|
--- 42,75 ----
|
|
|
|
Only permissions start and end are used here
|
|
*/
|
|
! #else
|
|
! /*
|
|
! % cat /proc/curproc/map
|
|
! start end resident private perm type
|
|
! 0x1000 0xe000 12 0 r-x COW vnode
|
|
! 0xe000 0x10000 2 2 rwx COW vnode
|
|
! 0x10000 0x27000 4 4 rwx default
|
|
! 0x800e000 0x800f000 1 1 rw- default
|
|
! 0xefbde000 0xefbfe000 1 1 rwx default
|
|
!
|
|
! COW = "copy on write"
|
|
! */
|
|
! #endif
|
|
!
|
|
! #ifdef linux
|
|
if (!(fp = fopen("/proc/self/maps", "r")))
|
|
+ #else
|
|
+ if (!(fp = fopen("/proc/curproc/map", "r")))
|
|
+ #endif
|
|
+
|
|
return FALSE;
|
|
|
|
while (fgets( buf, 79, fp)) {
|
|
+ #ifdef linux
|
|
sscanf(buf, "%x-%x %3s", (int *) &start, (int *) &end, prot);
|
|
+ #else
|
|
+ sscanf(buf, "%x %x %*d %*d %3s", (int *) &start, (int *) &end, prot);
|
|
+ #endif
|
|
if ( end <= addr)
|
|
continue;
|
|
if (start <= addr && addr+size < end) {
|