On 9/19/17 21:27 , Nayan Gadre wrote:
> Hi,
>
> I have managed to do few things. @Jim and @Mathew inputs were helpful. Thanks
>
> So i have
> [root@vcssx247-ldm7 ~]#dtrace -lvn fbt:my_mod:msg_recv1:entry
> ID PROVIDER MODULE FUNCTION NAME
> 7090 fbt mymod msg_recv1 entry
>
> Probe Description Attributes
> Identifier Names: Private
> Data Semantics: Private
> Dependency Class: Unknown
>
> Argument Attributes
> Identifier Names: Private
> Data Semantics: Private
> Dependency Class: ISA
>
> Argument Types
> args[0]: mblk_t *
> args[1]: uint_t
> args[2]: uchar_t *
> args[3]: ulong_t
>
> And my probe then becomes:
> dtrace -n 'msg_recv1:entry { printf("msg_recv1: %x, %x\n",
> *(uchar_t*)args[0]->b_rptr, *((uchar_t*)args[0]->b_rptr + 1)); }'
>
> Now, the args[0]->b_rptr points to my custom structure pkt_hdr_t { }.
>
> Is is possible to typecast this args[0]->b_rptr to struct pkt_hdr_t *
> in the dtrace script for better readable access of the private
> structure variables instead of using offsets to b_rptr:
>
> Something like this:
> struct pkt_hdr_t* ppkt = (struct pkt_hdr_t*)args[0]->b_rptr;
Yes. Presuming you have type information for it in the module (CTF data)
or failing that a typedef in the D script it would be as simple as
something like:
dtrace -n 'fbt:my_mod:msg_recv1:entry{ print(*(struct pkt_hdr_t
*)args[0]->b_rptr); }'
Robert
-------------------------------------------
dtrace-discuss
Archives: https://www.listbox.com/member/archive/184261/=now
RSS Feed: https://www.listbox.com/member/archive/rss/184261/25769126-e243886f
Modify Your Subscription:
https://www.listbox.com/member/?member_id=25769126&id_secret=25769126-8d47a7b2
Powered by Listbox: http://www.listbox.com