Brian Utterback
2008-Jun-25 12:09 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
I am trying to trace the xti functions in a process. I am using the following script: #!/usr/sbin/dtrace -s pid$target::t_*:entry { } pid$target::t_*:return { printf("%x %d",arg0,arg1); } My problem is that the value of arg1 that I get is mostly 50 or 48, although I have seen large numbers like 642832 and 768712. The thing is, the t_* functions almost all return either a 0 or -1. I thought I must be missing something simple, like a copying or 32/64 bit thing, but I just don''t see what the problem is. Any ides? -- blu There are two rules in life: Rule 1- Don''t tell people everything you know ---------------------------------------------------------------------- Brian Utterback - Solaris RPE, Sun Microsystems, Inc. Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom
Adam Leventhal
2008-Jun-25 17:59 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
Hi Brian, Functions that end in a tail-call to another function can report an incorrect return value in the arg1 variable. Take a look at the disassembly at the location where you''re seeing the apparently invalid return values to confirm that it''s a tail-call. It can be a little confusing -- sorry about that. Adam On Jun 25, 2008, at 5:09 AM, Brian Utterback wrote:> I am trying to trace the xti functions in a process. I am using the > following script: > > #!/usr/sbin/dtrace -s > pid$target::t_*:entry > { > } > pid$target::t_*:return > { > printf("%x %d",arg0,arg1); > } > > > My problem is that the value of arg1 that I get is mostly 50 or 48, > although I have seen large numbers like 642832 and 768712. The thing > is, the t_* functions almost all return either a 0 or -1. I thought I > must be missing something simple, like a copying or 32/64 bit thing, > but I just don''t see what the problem is. Any ides? > -- > blu > > There are two rules in life: > Rule 1- Don''t tell people everything you know > ---------------------------------------------------------------------- > Brian Utterback - Solaris RPE, Sun Microsystems, Inc. > Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Brian Utterback
2008-Jun-25 19:45 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
That''s what it was. All of the t_* functions are just wrapper functions that call the corresponding _tx_* function. Darn tail calls. Adam Leventhal wrote:> Hi Brian, > > Functions that end in a tail-call to another function can report an > incorrect > return value in the arg1 variable. Take a look at the disassembly at the > location where you''re seeing the apparently invalid return values to > confirm > that it''s a tail-call. > > It can be a little confusing -- sorry about that. > > Adam > > On Jun 25, 2008, at 5:09 AM, Brian Utterback wrote: > >> I am trying to trace the xti functions in a process. I am using the >> following script: >> >> #!/usr/sbin/dtrace -s >> pid$target::t_*:entry >> { >> } >> pid$target::t_*:return >> { >> printf("%x %d",arg0,arg1); >> } >> >> >> My problem is that the value of arg1 that I get is mostly 50 or 48, >> although I have seen large numbers like 642832 and 768712. The thing >> is, the t_* functions almost all return either a 0 or -1. I thought I >> must be missing something simple, like a copying or 32/64 bit thing, >> but I just don''t see what the problem is. Any ides? >> -- >> blu >> >> There are two rules in life: >> Rule 1- Don''t tell people everything you know >> ---------------------------------------------------------------------- >> Brian Utterback - Solaris RPE, Sun Microsystems, Inc. >> Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom >> _______________________________________________ >> dtrace-discuss mailing list >> dtrace-discuss at opensolaris.org > > > -- > Adam Leventhal, Fishworks http://blogs.sun.com/ahl > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org-- blu There are two rules in life: Rule 1- Don''t tell people everything you know ---------------------------------------------------------------------- Brian Utterback - Solaris RPE, Sun Microsystems, Inc. Ph:877-259-7345, Em:brian.utterback-at-ess-you-enn-dot-kom
Vladimir Marek
2008-Jun-26 06:33 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
> Functions that end in a tail-call to another function can report an > incorrect return value in the arg1 variable. Take a look at the > disassembly at the location where you''re seeing the apparently invalid > return values to confirm that it''s a tail-call.Aaah, that exactly happened to me half a year ago, on the same t_* functions. And I forgot it in the meantime. Would it be sensible to have dtrace which would warn you when it detects tail-call optimized function ? -- Vlad -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 193 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20080626/b3da97fb/attachment.bin>
Adam Leventhal
2008-Jun-26 19:27 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
>> Functions that end in a tail-call to another function can report an >> incorrect return value in the arg1 variable. Take a look at the >> disassembly at the location where you''re seeing the apparently >> invalid >> return values to confirm that it''s a tail-call. > > Aaah, that exactly happened to me half a year ago, on the same t_* > functions. And I forgot it in the meantime. Would it be sensible to > have > dtrace which would warn you when it detects tail-call optimized > function > ?It''s certainly the case that it''s never the right thing to trace arg1 from a tail-call return probe. It would be tricky, but perhaps DTrace could do something to warn against this. I suggest you file a bug. Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Vladimir Marek
2008-Jun-27 11:01 UTC
[dtrace-discuss] Arg1 doesn''t hold return value in pid provider?
>> Aaah, that exactly happened to me half a year ago, on the same t_* >> functions. And I forgot it in the meantime. Would it be sensible to >> have dtrace which would warn you when it detects tail-call optimized >> function ? > > It''s certainly the case that it''s never the right thing to trace arg1 > from a tail-call return probe. It would be tricky, but perhaps DTrace > could do something to warn against this. I suggest you file a bug.6720127 dtrace could warn user that he''s tracing tail-call optimized function Thank you -- Vlad -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 193 bytes Desc: not available URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20080627/ed387f4a/attachment.bin>