From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 13918 invoked by alias); 19 Mar 2010 16:36:43 -0000 Received: (qmail 13907 invoked by uid 22791); 19 Mar 2010 16:36:42 -0000 X-SWARE-Spam-Status: No, hits=-2.2 required=5.0 tests=AWL,BAYES_00 X-Spam-Check-By: sourceware.org Received: from aussmtpmrkps320.us.dell.com (HELO aussmtpmrkps320.us.dell.com) (143.166.224.254) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 19 Mar 2010 16:36:38 +0000 X-Loopcount0: from 12.110.134.31 Received: from unknown (HELO M31.equallogic.com) ([12.110.134.31]) by aussmtpmrkps320.us.dell.com with SMTP; 19 Mar 2010 11:36:36 -0500 Content-class: urn:content-classes:message MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable Subject: Threads support -- right way to extend ptrace() calls? Date: Fri, 19 Mar 2010 16:36:00 -0000 Message-ID: From: "Paul Koning" To: X-IsSubscribed: yes Mailing-List: contact gdb-help@sourceware.org; run by ezmlm Precedence: bulk List-Id: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: gdb-owner@sourceware.org X-SW-Source: 2010-03/txt/msg00172.txt.bz2 Gentlepeople, I'm working on NetBSD support for threads.=20 A lot of what is needed already exists in GDB, or exists with just small modifications needed. That brings me to the question: NetBSD uses ptrace, so inf-ptrace.c does a lot of the work. Some pieces are target architecture specific but common across BSD flavors, for example i386bsd-nat.c does ptrace() getregs and setregs calls. In NetBSD, a thread is an LWP which exists underneath a process, so a thread ID is a pair of PID and LWPID. The ptid datatype handles this nicely. In a number of ptrace calls, for example the PT_GETREGS and PT_SETREGS calls, the LWPID is now passed as the fourth argument, which was reserved and in existing code is passed as zero. The simple answer is to replace that 0 by TIDGET(ptid), and that works. But what is the right way to fit this into the bigger GDB? Copy those get/set register target functions, with that change, into NetBSD specific source files? Just change it in i386bsd-nat.c? In the latter case that means other *BSD targets would get the change too, which would be safe so long as they build ptid values with zero in the TID field or if ptrace still ignores the fourth argument there. I could verify the former fairly easily, but is that the right GDB way to proceed? paul=20