Tracing userland calls through to a driver

From: Lee MATTHEWS <Lee.MATTHEWS.external_at_stormshield.eu>
Date: Thu, 15 Sep 2022 08:37:55 UTC
Hello,


I am trying to debug some GPIO issues on FreeBSD 10.3.  I'd like to know if it is possible to know what process in userland (via a process id) has called a method in the driver.

So for example, in the driver, the functions are bound via DEVMETHOD like :


static device_method_t winbond_gpio_methods[] = {
    /* Device interface */
...
    DEVMETHOD(gpio_pin_set,            winbond_gpio_pin_set),
    DEVMETHOD(gpio_pin_get,            winbond_gpio_pin_get),
...
    DEVMETHOD_END
};


When the function winbond_gpio_pin_get() is called, how can I know what called this?


Thanks in advance.


Best wishes,

Lee Matthews