Subject: Re: ptrace() problems
To: None <current-users@sun-lamp.cs.berkeley.edu>
From: Andy Heffernan <ahh@netcom.com>
List: current-users
Date: 11/30/1993 21:54:28
I wrote:
> 	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(), like pwrite(), passes a pointer to an uninitialized
  variable to vm_map_find(), which is as likely to handle it
  "correctly" as it is to hand back a KERN_NO_SPACE error code ]

Incidentally, if I threw enough debug printfs into the code, it would
start working.  Gee, that kind of behavior sounds awfully familiar,
what kind of bug causes that to happen?  Let me see now...

Anyway, once I made this change, all is happy with gdb and ptrace():

*** kern/sys_process.c-orig	Sun Sep  5 19:06:20 1993
--- kern/sys_process.c	Tue Nov 30 21:16:28 1993
***************
*** 108,113 ****
--- 108,114 ----
  	vm_map_lookup_done(tmap, out_entry);
    
  	/* Find space in kernel_map for the page we're interested in */
+ 	kva = 0;
  	rv = vm_map_find(kernel_map, object, off, &kva, PAGE_SIZE, TRUE);
  
  	if (!rv) {
***************
*** 199,204 ****
--- 200,206 ----
  		rv = vm_fault(map, pageno, VM_PROT_WRITE, FALSE);
  
  	/* Find space in kernel_map for the page we're interested in */
+ 	kva = 0;
  	rv = vm_map_find(kernel_map, object, off, &kva, PAGE_SIZE, TRUE);
  
  	if (!rv) {

Does anyone know what the correct fix is?

Thanks.

--
------------------------------------------------------------------------
Andy Heffernan                                            ahh@netcom.com

------------------------------------------------------------------------------