Subject: Re: PT_MEMMAP
To: Love <lha@stacken.kth.se>
From: Gregory McGarry <g.mcgarry@ieee.org>
List: tech-kern
Date: 07/21/2002 16:47:24
Love wrote:
 
> I want to add PT_MEMMAP to ptrace so gdb can get the memory mapping of a
> process. A implemation are available in [1]. Patches for current gdb are in
> [2].
> 
> My questions are:
> 
> - Do I export too much (its the same as the (linux) procfs interface
> - are the locking in vm_map_lock_read()/vm_map_unlock_read() done right wrt
>   uiomove() (since uiomove can sleep). I did the same way as procfs does,
>   but is it right ?
> - not all mapping are readable with the ptrace interface how come, they
>   have the read bit set (see warnings in the example file in [2])
> 
> [1] http://www.e.kth.se/~lha/patches/netbsd/gdb-core/ptrace-patch

Do you want the memory map of the traced process or the parent process?
You want:

struct vm_map *map = &t->p_vmspace->vm_map;

	-- Gregory McGarry <g.mcgarry@ieee.org>