Date: Tue, 15 Apr 2014 23:16:09 -0400 From: Mark Johnston <markj@freebsd.org> To: carlos antonio neira bustos <cneirabustos@gmail.com> Cc: "freebsd-dtrace@freebsd.org" <freebsd-dtrace@freebsd.org> Subject: Re: uaddr and friends Message-ID: <CAMw1wOxixJ%2B2_84EHYOpQwCUu=5Q-O3a-xvrq_KS7YrDtXPVQQ@mail.gmail.com> In-Reply-To: <CACiB22h-fzbb8ErJEV5ci%2BonRKm3d69UWPD8ELwuTkhrLDeLsw@mail.gmail.com> References: <CACiB22g4JHWhj9ZPWmKKg1FAF376J3TBcrOtgOFrs4JHkFvkOw@mail.gmail.com> <CAMw1wOxWUpCtrYhkp-NUfigPZUewpyesYzTYG2s=uHLmMXhQwg@mail.gmail.com> <CACiB22hQ-9bBeFcFNeEfcrRu2MK0VxAUP1taHFCxJoW0eypxcg@mail.gmail.com> <CAMw1wOw0SwAHRWCBTBX6FczU=cWZwri-p9--MdaC956WtZ5sGw@mail.gmail.com> <CACiB22h-fzbb8ErJEV5ci%2BonRKm3d69UWPD8ELwuTkhrLDeLsw@mail.gmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
On Tue, Apr 15, 2014 at 10:54 PM, carlos antonio neira bustos <cneirabustos@gmail.com> wrote: > Thanks Mark. > > You are right, I did not look at dt_subr.c, uaddr is a short version of > ustack, I'll update to current now and try to pick on something else from > the list. Thanks! I've updated the TODOs a bit. I find that a good way to find things to do is to just try random DTrace scripts until something fails reproducibly. Large processes like firefox and Xorg have been a fertile source of bugs. :) And yes, please update to CURRENT; there have been quite a few bugs fixed since 10.0. FreeBSD 10.1 will have much better userland DTrace support. -Mark > > Bests > > > On Tue, Apr 15, 2014 at 11:36 PM, Mark Johnston <markj@freebsd.org> wrote: >> >> On Tue, Apr 15, 2014 at 10:15 PM, carlos antonio neira bustos >> <cneirabustos@gmail.com> wrote: >> > Hi Mark, >> > >> > I was looking at this document >> > >> > https://wikis.oracle.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-%7B%7Busym%7D%7D >> > currently looking at the code uaddr is the same as usym, but according >> > to >> > this document >> > >> > usym will print the symbol for a specified address. This is analogous to >> > how >> > uaddr works, but without the hexadecimal offsets. >> > >> > uaddr: date`clock_val+0x1 >> > usym: date`clock_val >> > >> > >> > here are my outputs from usym and uaddr : >> > >> > root@bsd:/home/cneira # dtrace -n 'pid$target::main:{usym(uregs[R_PC])}' >> > -c >> > ./test >> > dtrace: description 'pid$target::main:' matched 2 probes >> > abCPU ID FUNCTION:NAME >> > 0 56282 main:entry test`main >> > 0 56281 main:return test`main >> > dtrace: pid 10588 has exited >> > >> > root@bsd:/home/cneira # dtrace -n >> > 'pid$target::main:{uaddr(uregs[R_PC])}' -c >> > ./test >> > dtrace: description 'pid$target::main:' matched 2 probes >> > abCPU ID FUNCTION:NAME >> > 0 56282 main:entry >> > test`main+0x1 >> > >> > 0 56281 main:return >> > test`main+0x23 >> > >> > dtrace: pid 10591 has exited >> > >> > As current is only using dt_print_usym for uaddr the output should not >> > have >> > the hexadecimal offset specified in that documentation. >> > So I'm somewhat lost about which is the correct behavior , Do you have a >> > uaddr and usym output example in current to check this?, all my >> > changes >> > were done in 10 prod release. >> >> You're right, dt_print_usym handles both usym and uaddr. In the usym >> case, there's some special handling which looks up the symbol name >> corresponding to the given pc, and then sets the pc variable to the >> address of the symbol. Then dtrace_uaddr2str only prints the offset >> from the symbol if that offset is non-zero, so in the uaddr case you >> get "+0x1" and "+0x23" above. >> >> > >> > Bests >> > >> > >> > >> > >> > >> > >> > >> > On Tue, Apr 15, 2014 at 10:09 PM, Mark Johnston <markj@freebsd.org> >> > wrote: >> >> >> >> On Tue, Apr 15, 2014 at 8:35 PM, carlos antonio neira bustos >> >> <cneirabustos@gmail.com> wrote: >> >> > Hi All, >> >> > >> >> > I was looking at Dtrace todo list from >> >> > https://wiki.freebsd.org/DTraceTODO >> >> > and started to work on : Get uaddr(), ufunc(), umod(), and usym() >> >> > action >> >> > funtions working. >> >> > I have the data recording action (uaddr) working now, here is an >> >> > example: >> >> >> >> Hi! >> >> >> >> Hm, these should have been (at least mostly) working since r258902: >> >> http://svnweb.freebsd.org/base?view=revision&revision=258902 >> >> >> >> > >> >> > root@bsd:/home/cneira # dtrace -n >> >> > 'pid$target::main:{uaddr(uregs[R_PC])}' >> >> > -c ./test >> >> > dtrace: description 'pid$target::main:' matched 2 probes >> >> > abCPU ID FUNCTION:NAME >> >> > 0 56282 main:entry >> >> > test`main+0x1 >> >> > >> >> > 0 56281 main:return >> >> > test`main+0x23 >> >> > >> >> > dtrace: pid 9687 has exited >> >> > >> >> > Here is the output of nm from the test binary I have used to check >> >> > this >> >> > change. >> >> > >> >> > U _init_tls@@FBSD_1.0 >> >> > 08048380 T _start >> >> > 080483a0 t _start1 >> >> > 0804814c r abitag >> >> > U atexit@@FBSD_1.0 >> >> > 08048164 r crt_noinit_tag >> >> > 080485c0 T dosomething >> >> > 08049764 B environ >> >> > U exit@@FBSD_1.0 >> >> > 080484f0 t finalizer >> >> > 08048560 t frame_dummy >> >> > 08048590 T main >> >> > U putchar@@FBSD_1.0 >> >> > >> >> > >> >> > root@bsd:/home/cneira # dtrace -c ./test -n 'pid$target::main:entry{ >> >> > uaddr(0x080485c0); }' >> >> > dtrace: description 'pid$target::main:entry' matched 1 probe >> >> > abCPU ID FUNCTION:NAME >> >> > 0 56281 main:entry >> >> > test`dosomething >> >> > >> >> > dtrace: pid 9736 has exited >> >> > >> >> > I'll continue working on the rest, how do I submit a patch with >> >> > these >> >> > changes ? >> >> >> >> Pasting it inline is generally fine if it's not too large. It's also >> >> ok to put it in a public directory somewhere and post a link to it. >> >> >> >> -Mark >> > >> > > >
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAMw1wOxixJ%2B2_84EHYOpQwCUu=5Q-O3a-xvrq_KS7YrDtXPVQQ>