Subject: ptrace() problems
To: NetBSD Current Users Mailing List <>
From: Andy Heffernan <>
List: current-users
Date: 11/29/1993 22:05:05
	The Amiga port recently synced with the current tree and I'm
having some trouble getting gdb working again with the new ptrace()
code in kern/sys_process.c.

	In debugging, I notice the following code in pread():

pread(procp, addr, retval)
	struct proc *procp;
	unsigned int addr;
	unsigned int *retval;
	vm_offset_t	kva;
	/* Find space in kernel_map for the page we're interested in */
	rv = vm_map_find(kernel_map, object, off, &kva, PAGE_SIZE, TRUE);

	What I'm trying to highlight here is that pread() is passing a
pointer to a local variable which is never initialized to anything.
vm_map_find() will dereference the passed pointer and use the resulting
value for various compares.  This may explain the somewhat random
behavior I am seeing.

	The other thing worth noting is that pread() passes back a
VM-system error code (the value in rv) to ptrace(), which in turn
returns it to the caller.  These numbers are in different error-code
spaces, which seems somewhat problematical (KERN_NO_SPACE turns into
ESRCH, for example).

	Have I missed something important here?


Andy Heffernan