From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 10722 invoked by alias); 11 Feb 2011 20:17:08 -0000 Mailing-List: contact archer-help@sourceware.org; run by ezmlm Sender: Precedence: bulk List-Post: List-Help: List-Subscribe: List-Id: Received: (qmail 10711 invoked by uid 22791); 11 Feb 2011 20:17:07 -0000 X-SWARE-Spam-Status: No, hits=-6.3 required=5.0 tests=AWL,BAYES_00,RCVD_IN_DNSWL_HI,SPF_HELO_PASS,T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Date: Fri, 11 Feb 2011 20:17:00 -0000 From: Oleg Nesterov To: Roland McGrath Cc: Jan Kratochvil , Project Archer Subject: Re: hw_breakpoint userland interface Message-ID: <20110211200901.GA2006@redhat.com> References: <20110203223905.D0C77180081@magilla.sf.frob.com> <20110207211129.GA23277@host1.dyn.jankratochvil.net> <20110208015844.B994A1814A4@magilla.sf.frob.com> <20110208205953.GA15932@redhat.com> <20110208231846.EC8BA1814AA@magilla.sf.frob.com> <20110210205543.GA4590@redhat.com> <20110210211412.3A1151806E0@magilla.sf.frob.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20110210211412.3A1151806E0@magilla.sf.frob.com> User-Agent: Mutt/1.5.18 (2008-05-17) X-SW-Source: 2011-q1/txt/msg00045.txt.bz2 On 02/10, Roland McGrath wrote: > > > Do you have any plans to introduce something like per-process > > breakpoints, or (apart from inheriting) everything continues to > > be per-thread? > > I think we should look at doing what makes most sense for the users, > i.e. GDB. It's my impression that what is really desired is both options. > > In fact, I'm not altogether sure that anyone wants per-thread watchpoints > at all, that being data watchpoints. When the issue is finding how some > memory gets touched, then it doesn't make much sense to confine it to a > particular thread--you want to know when the memory changed, whatever > thread did it. Yes, agreed. But then we have some implementation problems, perf_event's are always per-thread (although they have the "group" notion). clone() should always inherit bps, probably not too hard to implement. There real problem is attach-the-new-bp-to-the-process, we don't have the sleeping lock to process all threads and protect the race with clone(). And ptrace_detach/release_task, we can't destroy perf_event under tasklist. (and the current task->ptrace_bps[] code is buggy and imho ugly). Of course, I am not saying this is impossible, I am just trying to understand the possible problems. Now, let's forget about the implementation details. First of all, we can't really make the per-process-bp API, bp shouldn't affect the threads we do not ptrace. So, per-process should mean the threads we do ptrace. In this case it is not clear what should represent the process. OK, I think this is minor. > If the hw_breakpoint interfaces also support (or will support) the > hardware-assisted code breakpoints, Looking at the code, I think it does... X86_BREAKPOINT_EXECUTE. But again, I didn't verify. > They are so limited that you always need > to fall back to traditional text-inserted breakpoints I forgot everything I learned when I reviewed uprobes patches. But iirc, they will have perf_event interface as well. To summarize: I still have no idea about how this API should look ;) Oleg.