We are trying to observe the data that is being written via aiowrite with this: pid$$1::aiowrite:entry { self->desc = arg0; /* file descriptor */ self->bufp = arg1; /* buffer pointer */ self->size = arg2; /* size, in bytes */ } pid$$1::aiowrite:return /self->size > 0/ { printf("%Y: ", walltimestamp); this->text = *(char *)copyin(self->bufp,self->size); printf("%s(PID:%d) called %s with fd=%d, size= %d, and \nbuf=\"%s\"\n\n", execname, pid, probefunc, self->desc, self->size, stringof(this->text)); this->text = 0; self->desc = 0; self->bufp = 0; self->size = 0; } but I am getting invalid address (0x0) in action #1 at DIF offset 28 errors. What am I doing wrong? Thanks in advance, -- prasad -- This message posted from opensolaris.org
prasad writes:> this->text = *(char *)copyin(self->bufp,self->size);That line copies in the buffer, and then dereferences the first byte. The contents of this->text is a single byte. That''s probably not what you want. I''d suggest: this->text = (char *)copyin(self->bufp,self->size); -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
prasad jlv writes:> James: > > Thank you for the information, but now the buffer is empty as in: > > 2008 Feb 11 11:50:14: processA(PID:xxxx) called aiowrite with fd=8, size=2084, and buf="" > > > What else am I doing wrong?Perhaps you''re expecting that the buffer contains a text string, but it just doesn''t. It seems like the first byte is zero, which is a C string terminator. I''d suggest trying truss to confirm what the application behavior is. -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
On Mon, Feb 11, 2008 at 10:12:41AM -0500, James Carlson wrote:> prasad writes: > > this->text = *(char *)copyin(self->bufp,self->size); > > That line copies in the buffer, and then dereferences the first byte. > The contents of this->text is a single byte. That''s probably not what > you want. I''d suggest: > > this->text = (char *)copyin(self->bufp,self->size);Another option is to use the two parameter version of the copyinstr() subroutine: this->text = copyinstr(self->bufp, self->size); I''ve updated the DTrace documentation to include information on this: http://wikis.sun.com/display/DTrace/Actions+and+Subroutines#ActionsandSubroutines-{{copyinstr}} And I''ve updated the chapter on User Process Tracing to include an example: http://wikis.sun.com/display/DTrace/User+Process+Tracing#UserProcessTracing-{{copyin}}and{{copyinstr}}Subroutines Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
Now with this: printf("%Y: ", walltimestamp); this->text = copyinstr(self->bufp,self->size); printf("%s(PID:%d) called %s with fd=%d, size= %d, and \nbuf=\"%s\"\n\n", execname, pid, probefunc, self->fd, self->size, this->text); I am getting this: 2008 Feb 22 14:30:00: dataPump(PID:6658) called aiowrite with fd=8, size= 204, and buf="" why am I getting nothing in the buffers? -- This message posted from opensolaris.org
prasad writes:> Now with this: > > printf("%Y: ", walltimestamp); > this->text = copyinstr(self->bufp,self->size); > printf("%s(PID:%d) called %s with fd=%d, size= %d, and \nbuf=\"%s\"\n\n", execname, pid, probefunc, self->fd, self->size, this->text); > > I am getting this: > > 2008 Feb 22 14:30:00: dataPump(PID:6658) called aiowrite with fd=8, size= 204, and buf="" > > why am I getting nothing in the buffers?At a guess, the first byte in the buffer is zero. A zero (ASCII NUL) byte is a C string terminator, so "%s" doesn''t print anything else. (Wasn''t that also what you were seeing the last time you posted ... ?) -- James Carlson, Solaris Networking <james.d.carlson at sun.com> Sun Microsystems / 35 Network Drive 71.232W Vox +1 781 442 2084 MS UBUR02-212 / Burlington MA 01803-2757 42.496N Fax +1 781 442 1677
there''s no context here, so I can''t even begin to answer your question prasad wrote:> Now with this: > > printf("%Y: ", walltimestamp); > this->text = copyinstr(self->bufp,self->size); > printf("%s(PID:%d) called %s with fd=%d, size= %d, and \nbuf=\"%s\"\n\n", execname, pid, probefunc, self->fd, self->size, this->text); > > I am getting this: > > 2008 Feb 22 14:30:00: dataPump(PID:6658) called aiowrite with fd=8, size= 204, and buf="" > > why am I getting nothing in the buffers? > > > -- > This message posted from opensolaris.org > _______________________________________________ > dtrace-discuss mailing list > dtrace-discuss at opensolaris.org
Sorry for not RTFM and not looking into the binary file that we were writing out ... Now I am using: tracemem( copyin(self->bufp,self->size),100); to print the data out. According to the DTrace guide, tracemem''s description is: void tracemem(address, size_t nbytes) The tracemem() action takes a D expression as its first argument, address, and a constant as its second argument, nbytes. tracemem() copies the memory from the address specified by addr into the directed buffer for the length specified by nbytes. I am getting "tracemem( ) argument #2 must be a non-zero positive integral constant expression" when I do: tracemem(copyin(self->bufp,self->size),self->size); Is it possible to do the above in other ways? Thanks in advance, -- prasad -- This message posted from opensolaris.org
On Wed, Feb 27, 2008 at 10:58:12AM -0800, prasad wrote:> According to the DTrace guide, tracemem''s description is: > > void tracemem(address, size_t nbytes) > > The tracemem() action takes a D expression as its first argument, > address, and a constant as its second argument, nbytes. tracemem() > copies the memory from the address specified by addr into the > directed buffer for the length specified by nbytes. > > I am getting "tracemem( ) argument #2 must be a non-zero positive integral constant expression" when I do: > > tracemem(copyin(self->bufp,self->size),self->size); > > Is it possible to do the above in other ways?Unfortunately not. Each record must be of a fixed a predetermined size so you can''t trace a variable amount of data in the way that you''d like. Adam -- Adam Leventhal, Fishworks http://blogs.sun.com/ahl
> > tracemem(copyin(self->bufp,self->size),self->size); > > > > Is it possible to do the above in other ways? > > Unfortunately not. Each record must be of a fixed a predetermined size so > you can''t trace a variable amount of data in the way that you''d like.But tracing more than self->size does not cause any trouble. So you could just use large enough static size (if the size is not so big that it would slow down dtrace too much). -- 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/20080228/e90ddb14/attachment.bin>