From owner-freebsd-hackers@FreeBSD.ORG Sat May 8 12:36:34 2010 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [69.147.83.52]) by hub.freebsd.org (Postfix) with ESMTP id E1AF31065672 for ; Sat, 8 May 2010 12:36:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from mail.zoral.com.ua (mx0.zoral.com.ua [91.193.166.200]) by mx1.freebsd.org (Postfix) with ESMTP id 5D59E8FC08 for ; Sat, 8 May 2010 12:36:33 +0000 (UTC) Received: from deviant.kiev.zoral.com.ua (root@deviant.kiev.zoral.com.ua [10.1.1.148]) by mail.zoral.com.ua (8.14.2/8.14.2) with ESMTP id o48CaT9F071678 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Sat, 8 May 2010 15:36:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: from deviant.kiev.zoral.com.ua (kostik@localhost [127.0.0.1]) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4) with ESMTP id o48CaTmb096601; Sat, 8 May 2010 15:36:29 +0300 (EEST) (envelope-from kostikbel@gmail.com) Received: (from kostik@localhost) by deviant.kiev.zoral.com.ua (8.14.4/8.14.4/Submit) id o48CaQF8096600; Sat, 8 May 2010 15:36:26 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: deviant.kiev.zoral.com.ua: kostik set sender to kostikbel@gmail.com using -f Date: Sat, 8 May 2010 15:36:26 +0300 From: Kostik Belousov To: Ali Polatel Message-ID: <20100508123626.GC83316@deviant.kiev.zoral.com.ua> References: <20100508111509.GB8186@harikalardiyari> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="JgQwtEuHJzHdouWu" Content-Disposition: inline In-Reply-To: <20100508111509.GB8186@harikalardiyari> User-Agent: Mutt/1.4.2.3i X-Virus-Scanned: clamav-milter 0.95.2 at skuns.kiev.zoral.com.ua X-Virus-Status: Clean X-Spam-Status: No, score=-3.0 required=5.0 tests=ALL_TRUSTED,AWL,BAYES_05, DNS_FROM_OPENWHOIS autolearn=no version=3.2.5 X-Spam-Checker-Version: SpamAssassin 3.2.5 (2008-06-10) on skuns.kiev.zoral.com.ua Cc: freebsd-hackers@freebsd.org Subject: Re: Ability to tell the difference between normal and syscall traps X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 08 May 2010 12:36:35 -0000 --JgQwtEuHJzHdouWu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sat, May 08, 2010 at 02:15:09PM +0300, Ali Polatel wrote: > Does FreeBSD's ptrace have a way to tell the difference between normal > traps and those caused by a system call? >=20 > On Linux? this is possible by passing PTRACE_O_TRACESYSGOOD option to the > ptrace request PTRACE_SETOPTIONS which makes the kernel set bit 7 in the > syscall number when delivering system call traps, > (i.e., deliver (SIGTRAP | 0x80)). >=20 > I'm not sure if this is possible on FreeBSD. PT_LWPINFO request looks > related but can't be sure. >=20 > ?: http://linux.die.net/man/2/ptrace There is already procfs(5)-based interface to get a reason for stop. Look at the ioctl PIOCSTATUS. Yes, you have to mount procfs. The interface can be lifted to ptrace(2), but I think using the capacity of procfs is not wrong there. --JgQwtEuHJzHdouWu Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.10 (FreeBSD) iEYEARECAAYFAkvlWsoACgkQC3+MBN1Mb4ipZACcDTTw2Zy/whf/WscIEfyCiU35 5+gAoJz9AbZTCeR8KjW5wCJyIpLPJeMO =arWV -----END PGP SIGNATURE----- --JgQwtEuHJzHdouWu--