Max
2009-Oct-23 15:55 UTC
[dtrace-discuss] Using dapptrace. Can''t seem to trace user functions with defaults or specifying -u<lib>
Hi Folks, I''m trying to get to grips with dapptrace, running it on my Mac. Everything seems pretty straightforward, except for - of course - what I''m trying to do. I want to focus in on my code but I can''t seem to be able to output just the functions I want, i.e. user functions. The -U option gives everything. Too much of course. Leaving that blank means the default which seems to be "a.out", e.g. sudo -s dapptrace ~/myexecutable : probe description pid31688:a.out::entry does not match any probes That hits nothing. If I take a lib from all the output using the -U option, e.g. libSystem.B.dylib, -> libSystem.B.dylib:free(0x300D70, 0x1A, 0xBFFFF258) -> libSystem.B.dylib:szone_size(0x22E000, 0x300D70, 0x50) <- libSystem.B.dylib:szone_size = 585 -> libSystem.B.dylib:szone_free_definite_size(0x22E000, 0x300D70, 0x10) -> libSystem.B.dylib:tiny_free_list_remove_ptr(0x1, 0x231500, 0x22E000) <- libSystem.B.dylib:tiny_free_list_remove_ptr = 239 <- libSystem.B.dylib:szone_free_de and try that specifying the -u option as in: sudo -s dapptrace -u libSystem.B.dylib ~/myexecutable that gives... : probe description pid31696:libSystem.B.dylib::entry does not match any probes which to me is weird as that is a library it is showing when I run with the -U option. I think I''m missing something obvious here and any advice would be much appreciated. Cheers, Max -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20091023/8de60a52/attachment.html>
James McIlree
2009-Oct-23 20:42 UTC
[dtrace-discuss] Using dapptrace. Can''t seem to trace user functions with defaults or specifying -u<lib>
On Oct 23, 2009, at 8:55 AM, Max wrote:> Hi Folks, > I''m trying to get to grips with dapptrace, running it on my Mac. > > Everything seems pretty straightforward, except for - of course - > what I''m trying to do. > > I want to focus in on my code but I can''t seem to be able to output > just the functions I want, i.e. user functions. > > The -U option gives everything. Too much of course. > > Leaving that blank means the default which seems to be "a.out", > > e.g. sudo -s dapptrace ~/myexecutable > > : probe description pid31688:a.out::entry does not match any probes > > That hits nothing. > > If I take a lib from all the output using the -U option, e.g. > libSystem.B.dylib, > > -> libSystem.B.dylib:free(0x300D70, 0x1A, 0xBFFFF258) > -> libSystem.B.dylib:szone_size(0x22E000, 0x300D70, 0x50) > <- libSystem.B.dylib:szone_size = 585 > -> libSystem.B.dylib:szone_free_definite_size(0x22E000, 0x300D70, > 0x10) > -> libSystem.B.dylib:tiny_free_list_remove_ptr(0x1, 0x231500, > 0x22E000) > <- libSystem.B.dylib:tiny_free_list_remove_ptr = 239 > <- libSystem.B.dylib:szone_free_de > > > and try that specifying the -u option as in: > > sudo -s dapptrace -u libSystem.B.dylib ~/myexecutable > > that gives... > > : probe description pid31696:libSystem.B.dylib::entry does not > match any probes > > > > which to me is weird as that is a library it is showing when I run > with the -U option. > > I think I''m missing something obvious here and any advice would be > much appreciated.Max, The problem is that the dapptrace script is doing this:> ### Run DTrace > if [ $opt_command -eq 1 ]; then > /usr/sbin/dtrace -x dynvarsize=$buf -x evaltime=exec -n "$dtrace" \ > -c "$command" >&2 > else > /usr/sbin/dtrace -x dynvarsize=$buf -n "$dtrace" -p "$pid" >&2 > fiThe -x evaltime=exec option means "start tracing immediately when the app is launched", but at that time, the only libraries loaded are dyld and the target executable. There really aren''t any libSystem.B.dylib functions to probe. If you add a "-Z" after the -x evaltime=exec above, your command should work. I''m not sure what is going on with a.out not working, I believe it should work, and it is a bug that it isn''t. James M
Max
2009-Oct-26 12:07 UTC
[dtrace-discuss] Using dapptrace. Can''t seem to trace user functions with defaults or specifying -u<lib>
Hi James, that''s great thanks for responding. It doesn''t seem to match the target executable either with the -u option. Again, I can see that library in use using -U. Could it be that it is also loaded dynamically? Everything comes up as expected using -Z. Many thanks, Max On 23 Oct 2009, at 21:42, James McIlree wrote:> > On Oct 23, 2009, at 8:55 AM, Max wrote: > >> Hi Folks, >> I''m trying to get to grips with dapptrace, running it on my Mac. >> >> Everything seems pretty straightforward, except for - of course - >> what I''m trying to do. >> >> I want to focus in on my code but I can''t seem to be able to output >> just the functions I want, i.e. user functions. >> >> The -U option gives everything. Too much of course. >> >> Leaving that blank means the default which seems to be "a.out", >> >> e.g. sudo -s dapptrace ~/myexecutable >> >> : probe description pid31688:a.out::entry does not match any probes >> >> That hits nothing. >> >> If I take a lib from all the output using the -U option, e.g. >> libSystem.B.dylib, >> >> -> libSystem.B.dylib:free(0x300D70, 0x1A, 0xBFFFF258) >> -> libSystem.B.dylib:szone_size(0x22E000, 0x300D70, 0x50) >> <- libSystem.B.dylib:szone_size = 585 >> -> libSystem.B.dylib:szone_free_definite_size(0x22E000, 0x300D70, >> 0x10) >> -> libSystem.B.dylib:tiny_free_list_remove_ptr(0x1, 0x231500, >> 0x22E000) >> <- libSystem.B.dylib:tiny_free_list_remove_ptr = 239 >> <- libSystem.B.dylib:szone_free_de >> >> >> and try that specifying the -u option as in: >> >> sudo -s dapptrace -u libSystem.B.dylib ~/myexecutable >> >> that gives... >> >> : probe description pid31696:libSystem.B.dylib::entry does not >> match any probes >> >> >> >> which to me is weird as that is a library it is showing when I run >> with the -U option. >> >> I think I''m missing something obvious here and any advice would be >> much appreciated. > > Max, > > The problem is that the dapptrace script is doing this: > >> ### Run DTrace >> if [ $opt_command -eq 1 ]; then >> /usr/sbin/dtrace -x dynvarsize=$buf -x evaltime=exec -n "$dtrace" \ >> -c "$command" >&2 >> else >> /usr/sbin/dtrace -x dynvarsize=$buf -n "$dtrace" -p "$pid" >&2 >> fi > > The -x evaltime=exec option means "start tracing immediately when > the app is launched", > but at that time, the only libraries loaded are dyld and the target > executable. There really > aren''t any libSystem.B.dylib functions to probe. > > If you add a "-Z" after the -x evaltime=exec above, your command > should work. > > I''m not sure what is going on with a.out not working, I believe it > should work, > and it is a bug that it isn''t. > > James M >