Date: Tue, 5 Nov 2013 14:47:58 +0800 From: John Luk <john.37@gmail.com> To: Mark Johnston <markj@freebsd.org> Cc: freebsd-dtrace@freebsd.org Subject: Re: dtrace showed matched probes but nothing in output on FreeBSD 9.1-RELEASE Message-ID: <CAHkCX6hyHfzBaHqYg0=wONphkGdDL7x-ErC5s60wK_aiczR3rA@mail.gmail.com> In-Reply-To: <20131104141105.GE8007@raichu> References: <CAHkCX6j1H4cxeb255gdH_cLop5Lv0xJABbuma%2B835gNNq-Nshg@mail.gmail.com> <20131103235936.GB15661@raichu> <CAHkCX6g1jUirMDP4T7W%2BrP6P8JV5wF-Wsa984op_HP1WftSitA@mail.gmail.com> <20131104043519.GB8007@raichu> <CAHkCX6h312PJvukGo_MNowNpENDLT=hvmXymZRsDFW%2BtzYNPug@mail.gmail.com> <CAHkCX6iT2MKMRwQDQrWLLjMXx9kiiYneT4J_qirxn1EwshmGng@mail.gmail.com> <20131104141105.GE8007@raichu>
next in thread | previous in thread | raw e-mail | index | archive | help
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 <main+0>: push %rbp 0x0000000000400611 <main+1>: mov %rsp,%rbp 0x0000000000400614 <main+4>: sub $0x10,%rsp 0x0000000000400618 <main+8>: mov 0x200361(%rip),%rdi # 0x600980 <s1> 0x000000000040061f <main+15>: mov 0x200362(%rip),%rsi # 0x600988 <s1+8> 0x0000000000400626 <main+22>: callq 0x4005c0 <foo> 0x000000000040062b <main+27>: mov $0x7d6,%edi 0x0000000000400630 <main+32>: callq 0x400600 <inet_makeaddr> 0x0000000000400635 <main+37>: movl $0x186a0,-0x4(%rbp) 0x000000000040063c <main+44>: jmp 0x400642 <main+50> 0x000000000040063e <main+46>: subl $0x1,-0x4(%rbp) 0x0000000000400642 <main+50>: cmpl $0x0,-0x4(%rbp) 0x0000000000400646 <main+54>: jg 0x40063e <main+46> 0x0000000000400648 <main+56>: mov $0x0,%eax 0x000000000040064d <main+61>: leaveq 0x000000000040064e <main+62>: retq End of assembler dump. 2013/11/4 Mark Johnston <markj@freebsd.org>: > 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 <john.37@gmail.com>: >> > 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 <markj@freebsd.org>: >> >> 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 >> >> >> >>> >> >>> [...] >> >>>
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAHkCX6hyHfzBaHqYg0=wONphkGdDL7x-ErC5s60wK_aiczR3rA>