Re: [PATCH] Let gcore use ptrace interface rather than the procfs

From: Ed Maste <emaste_at_freebsd.org>
Date: Tue, 17 Nov 2009 09:17:13 -0500
On Tue, Nov 17, 2009 at 11:21:52AM +0000, Robert Watson wrote:

> On Mon, 16 Nov 2009, Attilio Rao wrote:
> 
> >This patch allows gcore to use the ptrace interface rather than procfs: 
> >http://www.freebsd.org/~attilio/Sandvine/STABLE_8/gcore/gcore.diff
> >
> >The main visible effect of that is that gcore can now work on a per-thread 
> >scope, offering a granularity procfs can't reach. A downside, though, is 
> >that the process to be targeted is going to be stopped with ptrace. This 
> >patch has been contributed back by Sandvine Incorporated. Comments, 
> >reviews and testing are welcome.
> 
> Am I right in thinking that this may run into a number of other issues that 
> the procfs version didn't:
> 
> - gcore may no longer work on processes that are actively being debugged 
>   with gdb or traced with truss.
> 
> - gcore may cause interruptible system calls in the target process to
>   return EINTR, and interfere with signal delivery.
> 
> If so, these aren't show-stoppers, but we should make sure they're 
> documented in the gcore man page.  Fixing gcore would be excellent, it got 
> missed in the initial sweep of things broken by disabling procfs by default.

Our original motivation for doing this was to make gcore work with
threaded apps, not avoiding procfs, but that's a useful side-effect of
the work.  Note though that for that purpose it isn't complete; procfs
is still used in readmap to read the process' memory map.  It looks like
we need to find a way to implement readmap without procfs.

Thanks,
Ed
Received on Tue Nov 17 2009 - 13:17:14 UTC

This archive was generated by hypermail 2.4.0 : Wed May 19 2021 - 11:39:58 UTC