Go to the first, previous, next, last section, table of contents.


Scheduling Asynchronous Computations

A running libgdb function can take a long time. Libgdb includes a hook so that an application can run intermittently during long debugger operations.

Function: void gdb_set_poll_fn (fn, fn_arg)
void (*fn)(void * fn_arg, int (*gdb_poll)());
void * fn_arg;

Arrange to call fn periodically during lengthy debugger operations. If fn is NULL, polling is turned off. fn should take two arguments: an opaque pointer passed as fn_arg to gdb_set_poll_fn, and a function pointer. The function pointer passed to fn is provided by libgdb and points to a function that returns 0 when the poll function should return. That is, when (*gdb_poll)() returns 0, libgdb is ready to continue fn should return quickly.

It is possible that (*gdb_poll)() will return 0 the first time it is called, so it is reasonable for an application to do minimal processing before checking whether to return.

No libgdb functions should be called from an application's poll function, with one exception: gdb_request_quit.

Function: void gdb_request_quit (void)
This function, if called from a poll function, requests that the currently executing libgdb command be interrupted as soon as possible, and that control be returned to the top-level via an error.

The quit is not immediate. It will not occur until at least after the application's poll function returns.


Go to the first, previous, next, last section, table of contents.