From owner-p4-projects@FreeBSD.ORG Thu Jul 1 01:13:02 2004 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id 4381716A4D0; Thu, 1 Jul 2004 01:13:02 +0000 (GMT) Delivered-To: perforce@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 07F9D16A4CE for ; Thu, 1 Jul 2004 01:13:02 +0000 (GMT) Received: from exchhz01.viatech.com.cn (ip-40-162-97-218.anlai.com [218.97.162.40]) by mx1.FreeBSD.org (Postfix) with ESMTP id 2D9DA43D31 for ; Thu, 1 Jul 2004 01:13:00 +0000 (GMT) (envelope-from davidxu@freebsd.org) Received: from freebsd.org (DAVIDWNT [10.4.1.99]) by exchhz01.viatech.com.cn with SMTP (Microsoft Exchange Internet Mail Service Version 5.5.2650.21) id NVXA68SY; Thu, 1 Jul 2004 09:12:29 +0800 Message-ID: <40E365CE.8070508@freebsd.org> Date: Thu, 01 Jul 2004 09:15:58 +0800 From: David Xu User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b) Gecko/20030723 Thunderbird/0.1 X-Accept-Language: en-us, en MIME-Version: 1.0 To: Marcel Moolenaar References: <200406302305.i5UN5Dtj055376@repoman.freebsd.org> <20040701000327.GA44174@dhcp50.pn.xcllnt.net> In-Reply-To: <20040701000327.GA44174@dhcp50.pn.xcllnt.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit cc: Perforce Change Reviews Subject: Re: PERFORCE change 56172 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 01 Jul 2004 01:13:02 -0000 Marcel Moolenaar wrote: > On Wed, Jun 30, 2004 at 11:05:13PM +0000, David Xu wrote: > >>http://perforce.freebsd.org/chv.cgi?CH=56172 >> >>Change 56172 by davidxu@davidxu_alona on 2004/06/30 23:04:22 >> >> Let ptrace deal with lwpid as pid. remove ttrace. > > > Excellent! Any complications with using ptrace(2) or did it all > fall out naturally as I hoped? > I think there is not important problem within this change, current if I PT_GETREGS with a pid but not lwpid, I just use first thread in the proc, this needs to be studied further whether we should reject the call for threaded process. also I allow PT_ATTACH etcs to use lwpid. > BTW: I'll copy this and libthread_db from your branch to mine. I'll > keep using my proc_service.h for now, so I'll have to tweak it a bit. > (I don't use the existing proc-service.c in GDB because we need to > rewrite the PTID to get this all working for us)... OK, feel free to do. I only have trouble with gdb_proc_service.h, gdb it defines proc service function prototypes and some other types. but libthread_db needs a proc_service.h, I don't want to let libthread_db depend on gdb_proc_service.h, so we need to keep our proc_service.h consistent with gdb, or we don't use gdb's proc_service.c at all, we write our version of proc_service.c as solaris thread db did. However, in my experience, gdb proc service works well. I only use it when I need to retrieve lwp's registers, the gdb's proc service really doing nothing, it just redirect all requests to current target, I implement fbsd_fetch/store_lwp_registers in my freebsd-thread.c, they will be called by gdb proc service, the code path in my libthread_db and freebsd-thread.c looks like following: libthread_db -> ps_lgetregs -> target_fetch_registers -> fbsd_thread_fetch_registers -> fbsd_fetch_lwp_registers -> -> ptrace(lwp)