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

# How Builtin Variables are Defined

Convenience variables provide a way for values maintained by libgdb to be referenced in expressions (e.g. `$bpnum`). Libgdb includes a means by which the application can define new, integer valued convenience variables:

Function: void gdb_define_int_var (name, fn, fn_arg)

      char * name;
      int (*fn) (void *);
      void * fn_arg;

  This function defines (or undefines) a convenience variable called name. If fn is NULL, the variable becomes undefined. Otherwise, fn is a function which, when passed fn_arg returns the value of the newly defined variable.

  No libgdb functions should be called by fn.

One use for this function is to create breakpoint conditions computed in novel ways. This is done by defining a convenience variable and referring to that variable in a breakpoint condition expression.

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