From owner-freebsd-dtrace@freebsd.org Wed Aug 16 22:05:50 2017 Return-Path: Delivered-To: freebsd-dtrace@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 8A773DD523B for ; Wed, 16 Aug 2017 22:05:50 +0000 (UTC) (envelope-from anatoly@kazanfieldhockey.ru) Received: from kazanfieldhockey.ru (kazanfieldhockey.ru [78.138.152.250]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client CN "kazanfieldhockey.ru", Issuer "kazanfieldhockey.ru" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 1137D71D2F; Wed, 16 Aug 2017 22:05:46 +0000 (UTC) (envelope-from anatoly@kazanfieldhockey.ru) Received: from asd2 (host-175-22.static.telecet.ru [87.117.175.22]) (authenticated bits=0) by kazanfieldhockey.ru (8.14.3/8.14.3) with ESMTP id v7GM5WWW060132 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO); Thu, 17 Aug 2017 01:05:35 +0300 (MSK) (envelope-from anatoly@kazanfieldhockey.ru) Date: Thu, 17 Aug 2017 01:05:50 +0300 From: Anatoly To: Mark Johnston Cc: freebsd-dtrace@FreeBSD.org Subject: Re: how to trace linux_open, linux_stat Message-ID: <20170817010550.7efcf5bc@asd2> In-Reply-To: <20170815174045.GB44729@wkstn-mjohnston.west.isilon.com> References: <20170815201703.6e3052e5@asd2> <20170815174045.GB44729@wkstn-mjohnston.west.isilon.com> X-Mailer: Claws Mail 3.14.0 (GTK+ 2.24.29; amd64-portbld-freebsd10.2) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Greylist: Sender succeeded SMTP AUTH, not delayed by milter-greylist-4.2.6 (kazanfieldhockey.ru [192.168.13.2]); Thu, 17 Aug 2017 01:05:35 +0300 (MSK) X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: "A discussion list for developers working on DTrace in FreeBSD." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 16 Aug 2017 22:05:50 -0000 On Tue, 15 Aug 2017 10:40:45 -0700 Mark Johnston wrote: > On Tue, Aug 15, 2017 at 08:17:03PM +0300, Anatoly wrote: > > Hello, I'm new to dtrace. I'm trying to run propiertary linux > > application "1C thin client" (i386) using emulators/linux-c6 under > > FreeBSD 11.1 amd64. Application starts, then stops shortly with > > error message box and same error in log file: > > 9db1fa37-b455-4f3f-b8dd-7de0ea7d6da3: File shared access error > > 'v8stg://c:/1/FileStorage': ./src/storage.cpp(5013) > > Thats why I put my hands on dtrace and trying to find out what this > > app want to do. I'm not experienced in such a things, so I just > > take a look at output of dtrace -l, and noted that there is > > linux_open and linux_stat. Then I tried: > > dtrace -n '::linux_open:entry { printf("%s %s", execname, > > copyinstr(arg0)); }' > > Thig gives output like: > > dtrace: error on enabled probe ID 1 (ID 51007: > > fbt:linux:linux_open:entry): invalid address (0xfffff80061022940) in > > action #2 at DIF offset 12 > > How can I print out arg0 here? With just (non-linux) open:entry it > > works. > > The issue is that fbt::linux_open:entry is tracing an internal kernel > function, while ::open:entry is tracing a syscall > (syscall::open:entry). > > Looking at the output of "dtrace -lv -n ::linux_open:entry", I suspect > you can get the info you want with: > > # dtrace -n '::linux_open:entry {printf("%s", > copyinstr(args[1]->path);}' > > I'm not sure how syscall tracing for the Linux binary compat layer > works. There is a linuxulator32 provider, but it doesn't seem to > provide a probe for open(2). Thank you, args[1]->path works.