From owner-freebsd-hackers@FreeBSD.ORG Sun Jul 26 15:39:54 2009 Return-Path: Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 76E6D106566C for ; Sun, 26 Jul 2009 15:39:54 +0000 (UTC) (envelope-from gal.diskin@intel.com) Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by mx1.freebsd.org (Postfix) with ESMTP id 5604A8FC19 for ; Sun, 26 Jul 2009 15:39:54 +0000 (UTC) (envelope-from gal.diskin@intel.com) Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 26 Jul 2009 08:10:26 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="4.43,272,1246863600"; d="scan'208,217";a="711176705" Received: from irsmsx601.ger.corp.intel.com ([163.33.7.164]) by fmsmga001.fm.intel.com with ESMTP; 26 Jul 2009 08:14:43 -0700 Received: from hasmsx601.ger.corp.intel.com (10.184.10.125) by irsmsx601.ger.corp.intel.com (163.33.7.164) with Microsoft SMTP Server (TLS) id 8.1.358.0; Sun, 26 Jul 2009 16:11:28 +0100 Received: from hasmsx502.ger.corp.intel.com ([10.184.10.97]) by hasmsx601.ger.corp.intel.com ([10.184.10.125]) with mapi; Sun, 26 Jul 2009 18:11:27 +0300 From: "Diskin, Gal" To: "freebsd-hackers@freebsd.org" Date: Sun, 26 Jul 2009 18:11:25 +0300 Thread-Topic: ptrace question Thread-Index: AcoOA1e3XgfwxwsHSYeK05jNFYzSsg== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 X-Mailman-Approved-At: Sun, 26 Jul 2009 17:33:54 +0000 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.5 Subject: ptrace question 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, 26 Jul 2009 15:39:54 -0000 Hi, I'm using ptrace to execute one application under the control of another (s= urprisingly :P). I'm trying to find the number of the last system call exec= uted in the traced process from the tracing process. In Linux this is done = using "orig_eax" (or "orig_rax") but as far as I can tell it does not have = a counterpart in FreeBSD (correct me if I'm wrong). I've looked at the kern= el sources in hope of finding out how the conversion was done in the Linux = emulation layer. The file linux_ptrace.c (http://fxr.watson.org/fxr/source/= i386/linux/linux_ptrace.c?v=3DFREEBSD72#L118) seems to be the place the con= version is taking place. However, in spite the comment at the top of the co= nversion function mentioning that the translation is not straightforward, t= he translation done is simply copying eax to orig_eax. My question is: Is there a way to find the number of the last system call e= xecuted in the traced application from the tracing application (using ptrac= e)? Thanks, Gal Diskin --------------------------------------------------------------------- Intel Israel (74) Limited This e-mail and any attachments may contain confidential material for the sole use of the intended recipient(s). Any review or distribution by others is strictly prohibited. If you are not the intended recipient, please contact the sender and delete all copies.