Next: , Up: Debugging and Profiling   [Contents][Index]


2.8.1 Debugging Hooks

Since most GObject-based libraries use an event and callback model, debugging can be challenging. Guile-GI provides the ability for the user to hook into particular events in the introspection layer. See Hooks in The Guile reference manual to see how to operate on them.

The following hooks are defined

Variable: %before-function-hook

Will be emitted before calling a function with two arguments: name, a string denoting the name of the called function, and args, a list of Scheme variables passed to that function.

Since the %before-function-hook procedure is called just before the FFI calls a C function, it would be called within the procedure call of any procedure created by GObject introspection.

Variable: %before-callback-hook

Will be emitted before invoking a callback with three arguments: name, a string denoting the name of the callback, proc, the Scheme procedure that will be called, and args, a list of Scheme variables passed to that function.

Variable: %before-c-callback-hook

Will be emitted before invoking a C callback with three arguments: name, a string denoting the name of the callback, ptr, a pointer to the C function that will be called, and args, a list of Scheme variables passed to that function.

Callbacks are usually called as the result of signals, and the procedures to be called are expected to match the type of information the signal emits. Setting %before-callback-hook and %before-c-callback-hook may provide clues when debugging signal events.