From owner-freebsd-threads@FreeBSD.ORG Fri Jun 17 01:53:41 2011 Return-Path: Delivered-To: freebsd-threads@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 73B8B1065673 for ; Fri, 17 Jun 2011 01:53:41 +0000 (UTC) (envelope-from schumjs@gmail.com) Received: from mail-iw0-f182.google.com (mail-iw0-f182.google.com [209.85.214.182]) by mx1.freebsd.org (Postfix) with ESMTP id 3F7DF8FC0A for ; Fri, 17 Jun 2011 01:53:40 +0000 (UTC) Received: by iwr19 with SMTP id 19so1116434iwr.13 for ; Thu, 16 Jun 2011 18:53:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=Hw7n9mFB3nWh4qQts+mBENr8+rWASc7a8WGEfPQc07U=; b=Sq8d16L0LX6FShBtgzT+q1F8h0W/ScbhXrsfWU2SEtg8Cu/1mX5iQ9ejPGxZNgVPUc 512EMk53iXe+JeU5LeVwdsFXvU9kdZ+zbMLdlJt1/ep4z3Dk8GzTu8oMCu0wrDOVO9Y2 PqwmsJmf/AhxwIxFZVEj1vIY5//H4Ry2T+V+M= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=tS5msWJYEt+/Umv9206YaT0O51OlpSEq/X1cBaoMqhTOJ8ogrYKBqbykhFWFMS76za iyX8OWcrOQvoEBiIoD855ORLqllEKsCupcTx+u+CZ0buyxSXxsQVLzKT1NTWT1zAUUHD Rb426/vqbp+qvnAhMvXOqWojdxlpv/cs6END8= MIME-Version: 1.0 Received: by 10.231.63.83 with SMTP id a19mr1339723ibi.104.1308274219690; Thu, 16 Jun 2011 18:30:19 -0700 (PDT) Received: by 10.231.91.199 with HTTP; Thu, 16 Jun 2011 18:30:19 -0700 (PDT) Date: Thu, 16 Jun 2011 20:30:19 -0500 Message-ID: From: John Schumacher To: freebsd-threads@freebsd.org Content-Type: text/plain; charset=ISO-8859-1 X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: ptrace and threads (libthr) X-BeenThere: freebsd-threads@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Threading on FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 17 Jun 2011 01:53:41 -0000 Does anybody know if FreeBSD allow for ptracing to be done on threads ex. PT_ATTACH, or PT_SUSPEND? I recall this being impossible before, http://lists.freebsd.org/pipermail/freebsd-threads/2004-January/001511.html but maybe this has changed now. Is there a viable alternative to getting around this? if (ptrace (PT_ATTACH, ikipp->ki_tid, 0, 0) != 0) { fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n", tid,strerror (errno), errno); fflush (stderr); } if (ptrace (PT_SUSPEND, ikipp->ki_tid, 0, 0) != 0) { fprintf (stderr, "Cannot attach to lwp %ld: %s (%d)\n",tid,strerror (errno), errno); fflush (stderr); } both yield: Cannot suspend lwp 100167: Device busy (16) Cannot attach to lwp 100167: Device busy (16) In my understanding how ptrace works, the thread or process to be traced must be 'stopped'. Is there a way to pause threads to allow an attach to occur(SIGSTOP)? Is thread the correct term in this case? Or is anything the kernel can manipulate via signals and pt_methods technically a light-weight-process or kernel thread 'mapped' to that user-thread (pthread)? This is FreeBSD 8.1 with the libthr library. Thanks ! -- John Schumacher University of Minnesota (TC) Electrical Engineering