Hey all, This is probably a dumb newbie question but I seem to be misunderstanding what the copyin function can do. When I run the following one-liner: dtrace -n ''fbt::sprintf:return {printf("%s %s",execname,copyinstr(arg0))}'' I get the following errors: ... dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): invalid address (0x1b2) in action #2 at DIF offset 28 dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): invalid address (0x1b2) in action #2 at DIF offset 28 dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): invalid address (0x1b2) in action #2 at DIF offset 28 ... Shouldn''t copyin output the string pointed to by *buf? Or does this only work for userspace functions? Thanks --Brett -------------- next part -------------- An HTML attachment was scrubbed... URL: <http://mail.opensolaris.org/pipermail/dtrace-discuss/attachments/20090407/30d6fbde/attachment.html>
On Tue, Apr 07, 2009 at 10:39:02AM -0700, Brett Monroe wrote:> Hey all, > > This is probably a dumb newbie question but I seem to be misunderstanding > what the copyin function can do. When I run the following one-liner: > > dtrace -n ''fbt::sprintf:return {printf("%s %s",execname,copyinstr(arg0))}'' > > I get the following errors: > > ... > dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): > invalid address (0x1b2) in action #2 at DIF offset 28 > dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): > invalid address (0x1b2) in action #2 at DIF offset 28 > dtrace: error on enabled probe ID 1 (ID 15240: fbt:genunix:sprintf:return): > invalid address (0x1b2) in action #2 at DIF offset 28 > ... > > Shouldn''t copyin output the string pointed to by *buf? Or does this only > work for userspace functions?copyin() is only used for user addresses. Kernel addresses can be used directly (though for ''char *''s, you may need to use stringof()). You''ve got another error, too; the returned value is in arg1, not arg0 (which holds the offset of the ret instruction). Also, you should use the args[] array, since fbt probes have type information: % dtrace -n ''fbt::sprintf:return {printf("%s %s",execname,stringof(args[1]))}'' Cheers, - jonathan
On Tue, Apr 7, 2009 at 1:39 PM, Brett Monroe <mr.bmonroe at gmail.com> wrote:> Hey all, > > This is probably a dumb newbie question but I seem to be misunderstanding > what the copyin function can do.? When I run the following one-liner: > > dtrace -n ''fbt::sprintf:return {printf("%s %s",execname,copyinstr(arg0))}'' > > I get the following errors: > > ...You''re specifying the fbt version of sprintf(). I''d hazard a guess that you want the pid provider version here. Chad
On 4/7/09, Brett Monroe <mr.bmonroe at gmail.com> wrote:> Shouldn''t copyin output the string pointed to by *buf? Or does this only > work for userspace functions?copyinstr is only for copying data from the user address space to the kernel. Rayson> > Thanks > --Brett > > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org >