On 06/03/10 06:35, Hans-Peter wrote:
> Hi 
>
> I am trying to make a dtrace script that captures tcp packets sent by a 
> specific process.
>
> But I receive the message:
> dtrace: error on enabled probe ID 3 (ID 35884: 
> fbt:sockfs:sostream_direct:return): invalid address (0x106390000) in action 
> #1 at DIF offset 12
>
> Can someone explain why this happens?
>
> regards HansP
>
> #!/usr/sbin/dtrace -Cs
>  /*
>   * Command line arguments
>   */
>  #include <sys/file.h>
> #include <inet/common.h>
> #include <sys/byteorder.h>
> #include <sys/socket.h>
> #include <sys/socketvar.h>
>
> /*
>  * Print header
>  */
> dtrace:::BEGIN
> {
>         /* starting values */
>         counts = COUNTER;
>         secs = INTERVAL;
>         TCP_out = 0;
>         TCP_in = 0;
>
>         printf("Tracing... Please wait.\n");
>
>         start = 0;
> }
>
> fbt:sockfs:sostream_direct:entry
> / pid == $1 && start == 0 /
> {
>         self->sop = 1;
>         self->nsop = (struct sonode *)arg1;
>         self->tcpp = (tcp_t *)self->nsop->so_priv;
>         self->laddrs = self->nsop->so_laddr_sa;
>         start = 1;
>         printf("%50s : 
> %10d\n","fbt:sockfs:sostream_direct:entry",self->nsop->so_sndbuf);
> }
>
> fbt:sockfs:sostream_direct:return
> / pid == $1 && start == 1 /
> {
>         self->connp = (conn_t *)self->tcpp->tcp_connp;
>         /*printf("%50s 
> %10d\n","fbt:sockfs:sostream_direct:return",self->laddr->soa_len); */
>         printf("%50s \n","fbt:sockfs:sostream_direct:return");
> }
>   
Well, you have a few potential problems with this script, for instance
the return probe is enabled via global variables, but dereferences
thread-local storage which may not be valid. However, the cause of your
immediate problem is that the argx variables are indexed from zero and
not one. I think you need

self->nsop = (struct sonode *)arg0;


-- 
blu

It's bad civic hygiene to build technologies that could someday be
used to facilitate a police state. - Bruce Schneier
----------------------------------------------------------------------
Brian Utterback - Solaris RPE, Oracle Corporation.
Ph:603-262-3916, Em:brian.utterb...@oracle.com

_______________________________________________
dtrace-discuss mailing list
dtrace-discuss@opensolaris.org

Reply via email to