From owner-freebsd-hackers@FreeBSD.ORG Sun May 9 05:33:06 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 1A8CA1065670 for ; Sun, 9 May 2010 05:33:06 +0000 (UTC) (envelope-from alip@exherbo.org) Received: from bach.exherbo.org (bach.exherbo.org [78.47.197.147]) by mx1.freebsd.org (Postfix) with ESMTP id CB7BA8FC12 for ; Sun, 9 May 2010 05:33:05 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=harikalardiyari ident=alip) by bach.exherbo.org with esmtp (Exim 4.69) (envelope-from ) id 1OAz8S-0007kO-Oh; Sun, 09 May 2010 05:33:04 +0000 Date: Sun, 9 May 2010 08:33:03 +0300 From: Ali Polatel To: Kostik Belousov Message-ID: <20100509053303.GD8186@harikalardiyari> References: <20100508111509.GB8186@harikalardiyari> <20100508123626.GC83316@deviant.kiev.zoral.com.ua> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="+KJYzRxRHjYqLGl5" Content-Disposition: inline In-Reply-To: <20100508123626.GC83316@deviant.kiev.zoral.com.ua> User-Agent: Mutt/1.5.20 (2009-06-14) 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: Sun, 09 May 2010 05:33:06 -0000 --+KJYzRxRHjYqLGl5 Content-Type: text/plain; charset=iso-8859-9 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Kostik Belousov yazm=FD=FE: > 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 t= he > > 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 >=20 > There is already procfs(5)-based interface to get a reason for stop. > Look at the ioctl PIOCSTATUS. Yes, you have to mount procfs. >=20 > The interface can be lifted to ptrace(2), but I think using the capacity > of procfs is not wrong there. Hmm ok, I've been playing around with PIOCSTATUS but it doesn't seem to work, there's not much documentation about it either so I figured I'll just ask. The code is here: http://alip.github.com/code/piocstatus.c The traced child is stopped at the beginning of a system call. I await that the PIOCSTATUS request sets ps.why to S_SCE but it's always zero. Can you help me figure out what I'm doing wrong? :) --=20 Regards, Ali Polatel --+KJYzRxRHjYqLGl5 Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.14 (GNU/Linux) iEYEABECAAYFAkvmSQ8ACgkQQU4yORhF8iByxwCgyaKIy39qr8ogM3kkDTqOrc/V /icAoLIBazca1CWCfVzQFcbnthKk+6P0 =pA9A -----END PGP SIGNATURE----- --+KJYzRxRHjYqLGl5--