From owner-freebsd-dtrace@FreeBSD.ORG Tue Nov 5 06:47:59 2013 Return-Path: Delivered-To: freebsd-dtrace@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1 with cipher ADH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTP id 4D5BA634; Tue, 5 Nov 2013 06:47:59 +0000 (UTC) (envelope-from john.37@gmail.com) Received: from mail-oa0-x22f.google.com (mail-oa0-x22f.google.com [IPv6:2607:f8b0:4003:c02::22f]) (using TLSv1 with cipher ECDHE-RSA-RC4-SHA (128/128 bits)) (No client certificate requested) by mx1.freebsd.org (Postfix) with ESMTPS id 0BCDA2F8D; Tue, 5 Nov 2013 06:47:58 +0000 (UTC) Received: by mail-oa0-f47.google.com with SMTP id k1so151937oag.6 for ; Mon, 04 Nov 2013 22:47:58 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=+bXj5iOEKaiOJollZtbRG2xUVJ5rcEGSMdD3MZ6ba7c=; b=zNkZ+uDwLlv38Q/z2DjYDPW00wKgL/1r1zDUkUBAZaAfZCG5D72H1rhnlHn9UjbOmg x65Fkfws7i3jqiIUxU8AXqKCDbqDrA9Zja9SmgJnmLlbPW9YJMWnT6l6CUUdppmpEg76 5iSxJcV3tJfe16KmYG1wIBRjOJQepjKtcVbQCxP9/NCamwbTQZEJb7xZK6SmzN1Z7qkQ Grbd2LediMc5RZXE9dNhW+9zR5ilMJstCKkjg73tVejVRgL6ENCORUqR1Mwm340sbHGc q63Kc7TWsU4U0YhzijA0af+vCHl8jCEUJtm/MnqN5l49AWrUB7+IXE+8tcZjFEWjFXX0 vRzA== MIME-Version: 1.0 X-Received: by 10.60.145.207 with SMTP id sw15mr8634745oeb.38.1383634078375; Mon, 04 Nov 2013 22:47:58 -0800 (PST) Received: by 10.60.35.74 with HTTP; Mon, 4 Nov 2013 22:47:58 -0800 (PST) In-Reply-To: <20131104141105.GE8007@raichu> References: <20131103235936.GB15661@raichu> <20131104043519.GB8007@raichu> <20131104141105.GE8007@raichu> Date: Tue, 5 Nov 2013 14:47:58 +0800 Message-ID: Subject: Re: dtrace showed matched probes but nothing in output on FreeBSD 9.1-RELEASE From: John Luk To: Mark Johnston Content-Type: text/plain; charset=UTF-8 Cc: freebsd-dtrace@freebsd.org X-BeenThere: freebsd-dtrace@freebsd.org X-Mailman-Version: 2.1.14 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: Tue, 05 Nov 2013 06:47:59 -0000 Hi, Mark. The gdb output is included below. I'm wondering why dtrace -l can trace all my function correctly but the D script failed. Is it because they get the symbol table in different way? Cheers, spin6lock root@xiangling:/usr/home/spin6lock # cd test root@xiangling:/usr/home/spin6lock/test # gdb ./a.out GNU gdb 6.1.1 [FreeBSD] Copyright 2004 Free Software Foundation, Inc. GDB is free software, covered by the GNU General Public License, and you are welcome to change it and/or distribute copies of it under certain conditions. Type "show copying" to see the conditions. There is absolutely no warranty for GDB. Type "show warranty" for details. This GDB was configured as "amd64-marcel-freebsd"... (gdb) disas main Dump of assembler code for function main: 0x0000000000400610 : push %rbp 0x0000000000400611 : mov %rsp,%rbp 0x0000000000400614 : sub $0x10,%rsp 0x0000000000400618 : mov 0x200361(%rip),%rdi # 0x600980 0x000000000040061f : mov 0x200362(%rip),%rsi # 0x600988 0x0000000000400626 : callq 0x4005c0 0x000000000040062b : mov $0x7d6,%edi 0x0000000000400630 : callq 0x400600 0x0000000000400635 : movl $0x186a0,-0x4(%rbp) 0x000000000040063c : jmp 0x400642 0x000000000040063e : subl $0x1,-0x4(%rbp) 0x0000000000400642 : cmpl $0x0,-0x4(%rbp) 0x0000000000400646 : jg 0x40063e 0x0000000000400648 : mov $0x0,%eax 0x000000000040064d : leaveq 0x000000000040064e : retq End of assembler dump. 2013/11/4 Mark Johnston : > On Mon, Nov 04, 2013 at 04:56:43PM +0800, John Luk wrote: >> EDIT:Apologies for miss-sent mail. >> >> Great! Seems that we're on the right way, I got the output below: >> >> # dtrace -s ufunc.d -c ./a.out a.out >> dtrace: script 'ufunc.d' matched 5 probes >> ^C >> >> foo 1 >> foo1 1 >> main 1 >> >> through the inet_makeaddr was missing. I applied the patch with: > > It could be that your compiler is inlining it. Can you run the following > commands and paste the output? > > # gdb ./a.out > (gdb) disas main > > Thanks > -Mark > >> >> patch < libproc_sym_lookup-9.1.diff >> >> Thanks again for your patch, Mark :) >> >> >> Cheers, >> spin6lock >> >> 2013/11/4 John Luk : >> > Great! Seems that we're on the right way, I got the output below: >> > >> > # dtrace -s ufunc.d -c ./a.out a.out >> > dtrace: script 'ufunc.d' matched 5 probes >> > ^C >> > >> > foo 1 >> > foo1 1 >> > main 1 >> > >> > through the inet_makeaddr was missing. I applied the patch with: >> > >> > patch < libproc_sym_lookup-9.1.diff >> > >> > Thanks again for your patch, Mark :) >> > >> > Cheers, >> > spin6lock >> > >> > >> > 2013/11/4 Mark Johnston : >> >> On Mon, Nov 04, 2013 at 12:11:55PM +0800, John Luk wrote: >> >>> Thanks, Mark. But I still got nothing :( >> >>> The line number of your patch wasn't match with mine, I patched it >> >>> on hand. Was it because I was on an older version of src? The head >> >>> of proc_sym.c shows: >> >>> >> >>> $FreeBSD: release/9.1.0/lib/libproc/proc_sym.c 211184 2010-08-11 >> >>> 17:33:26Z rpaulo >> >>> >> >>> And the patch of mine is include below, is it correct? >> >> >> >> Sorry, I missed that you were on 9.1. The patch you pasted had a mistake >> >> in it; can you instead try applying the patch here: >> >> >> >> http://people.freebsd.org/~markj/patches/libproc_sym_lookup-9.1.diff >> >> >> >> I created it against the 9.1 tree, so it should apply cleanly. I built and >> >> installed the patched 9.1 libproc on a machine running head, and got the >> >> expected behaviour: >> >> >> >> mark@raichu: ~/src/dtrace/ufunc $ sudo dtrace -s ufunc.d -c ./test test >> >> dtrace: script 'ufunc.d' matched 9 probes >> >> dtrace: pid 11555 has exited >> >> >> >> __do_global_dtors_aux 1 >> >> foo 1 >> >> foo1 1 >> >> inet_makeaddr 1 >> >> main 1 >> >> >> >> mark@raichu: ~/src/dtrace/ufunc $ >> >> >> >> I don't think that this will be the final patch; checking for ET_EXEC to >> >> determine whether to add a relocation offset seems a bit dubious; I'm >> >> pretty sure it won't work for position-independent executables. >> >> >> >> Thanks, >> >> -Mark >> >> >> >>> >> >>> [...] >> >>>