Re: Read return struct of kernel trace

From: Ryan Stone <rysto32_at_gmail.com>
Date: Tue, 22 Feb 2022 16:42:00 UTC
It should be dtrace -Cs usbd_get_endpoint.d

However you probably don't need the #include at all, even if you need
access to usb types in your full script.  The type information will be
embedded in the kernel and automatically fetched by dtrace.

On Sun, Feb 20, 2022 at 1:22 AM Farhan Khan <farhan@farhan.codes> wrote:
>
> Hi all,
>
> I am trying to instrument the return value of usbd_get_endpoint(), which is a "struct usb_endpoint" defined in /usr/src/sys/dev/usb/usbdi.h. I would like to print out the contents of the struct in a human-readable way. To that end, I am trying to include the header file into my dtrace script but keep getting error messages from dtrace.
> My script is as follows:
> ------------
> #!/usr/sbin/dtrace -qvs
>
> #include <dev/usb/usbdi.h>
>
> fbt::usbd_get_endpoint:return
> {
> printf("Exit %d\n", arg0);
> }
> ------------
> [farhan@freebsddev ~]$ sudo dtrace -C ./usbd_get_endpoint.d
> dtrace: no probes specified
> [farhan@freebsddev ~]$ sudo dtrace -sC ./usbd_get_endpoint.d
> dtrace: failed to open C: No such file or directory
> [farhan@freebsddev ~]$ sudo dtrace ./usbd_get_endpoint.d
> dtrace: no probes specified
>
> I am not certain how to resolve this issue. Also, if it is not necessary to include the header to print out the structure, please suggest an alternative method.
> Thank you!
> --
> Farhan Khan
>
>