Attila Rajmund Nohl
2011-04-22 16:54:51 UTC
Hello!
I'm trying to write a dtrace script that will log the parameters of
the putmsg calls of a process. So far I've got this:
#!/usr/sbin/dtrace -qs
syscall::putmsg:entry
{
printf("Calling putmsg, filedes: %5d, ctlptr: %8x, dataptr: %8x,
flags: %5d", arg0, arg1, arg2, arg3);
}
syscall::putmsg:return
{
printf("Return from putmsg: %d", (int)arg0);
}
Of course, the value of the ctlptr is a rather meaningless memory
address of a struct - how can I access the values of the fields of
that struct? I've tried this:
printf("maxlen: %5d", arg1->maxlen);
compilation error, then
ctlptr = (struct strbuf*)arg1;
printf("maxlen: %5d", ctlptr->maxlen);
and got:
dtrace: error on enabled probe ID 1 (ID 6236: syscall::putmsg:entry):
invalid address (0xffbfeeac) in action #6 at DIF offset 4
How can that be an invalid address? Or is the program I'm tracing buggy?
I'm trying to write a dtrace script that will log the parameters of
the putmsg calls of a process. So far I've got this:
#!/usr/sbin/dtrace -qs
syscall::putmsg:entry
{
printf("Calling putmsg, filedes: %5d, ctlptr: %8x, dataptr: %8x,
flags: %5d", arg0, arg1, arg2, arg3);
}
syscall::putmsg:return
{
printf("Return from putmsg: %d", (int)arg0);
}
Of course, the value of the ctlptr is a rather meaningless memory
address of a struct - how can I access the values of the fields of
that struct? I've tried this:
printf("maxlen: %5d", arg1->maxlen);
compilation error, then
ctlptr = (struct strbuf*)arg1;
printf("maxlen: %5d", ctlptr->maxlen);
and got:
dtrace: error on enabled probe ID 1 (ID 6236: syscall::putmsg:entry):
invalid address (0xffbfeeac) in action #6 at DIF offset 4
How can that be an invalid address? Or is the program I'm tracing buggy?