Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Aug 2014 15:30:34 -0700
From:      John-Mark Gurney <jmg@funkthat.com>
To:        John Baldwin <jhb@freebsd.org>
Cc:        svn-src-head@freebsd.org, svn-src-all@freebsd.org, Mateusz Guzik <mjguzik@gmail.com>, src-committers@freebsd.org, Mateusz Guzik <mjg@freebsd.org>
Subject:   Re: svn commit: r270444 - in head/sys: kern sys
Message-ID:  <20140825223034.GE71691@funkthat.com>
In-Reply-To: <1815651.yxLDiBYvJT@ralph.baldwin.cx>
References:  <201408240904.s7O949sI083660@svn.freebsd.org> <1724027.iWxFDWcg2R@ralph.baldwin.cx> <20140825170241.GA23088@dft-labs.eu> <1815651.yxLDiBYvJT@ralph.baldwin.cx>

next in thread | previous in thread | raw e-mail | index | archive | help
John Baldwin wrote this message on Mon, Aug 25, 2014 at 13:35 -0400:
> On Monday, August 25, 2014 07:02:41 PM Mateusz Guzik wrote:
> > On Mon, Aug 25, 2014 at 10:23:19AM -0400, John Baldwin wrote:
> > > On Sunday, August 24, 2014 09:04:09 AM Mateusz Guzik wrote:
> > > > Author: mjg
> > > > Date: Sun Aug 24 09:04:09 2014
> > > > New Revision: 270444
> > > > URL: http://svnweb.freebsd.org/changeset/base/270444
> > > > 
> > > > Log:
> > > >   Fix getppid for traced processes.
> > > >   
> > > >   Traced processes always have the tracer set as the parent.
> > > >   Utilize proc_realparent to obtain the right process when needed.
> > > 
> > > Are you sure this won't break things?  I know of several applications that
> > > expect a debugger to be the parent when attached and change behavior as a
> > > result (e.g. inserting a breakpoint on an assertion failure rather than
> > > generating a core).
> > 
> > Well, this is what linux and solaris do.
> 
> Interesting.
> 
> > I don't feel strongly about this change. If you really want I'm happy to
> > revert.
> 
> In general I'd like to someday have the debugger-debuggee relationship not 
> override parent-child and this is a step in that direction.  However, this 
> will break existing applications, so this needs to be clearly documented in 
> the release notes.  In addition, we should probably advertise how a process 
> can correctly determine if it is being run under a debugger (right now you can 
> do 'getppid()' and use strcmp or strstr on the p_comm of that pid so you can 
> do different things for "gdb" vs "gcore", etc. so just checking P_TRACED from 
> kinfo_proc wouldn't be equivalent in functionality)

But what about when you attach gdb to a running process...  That
doesn't magicly make the now debugged process a child of gdb does it?

-- 
  John-Mark Gurney				Voice: +1 415 225 5579

     "All that I will do, has been done, All that I have, has not."



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20140825223034.GE71691>