Error-handling callback functions

An error-handling callback function and a pointer to an error argument (errarg) can be specified by the program analysis application during initialization of libddpi. During initialization of the Ddpi_Info object, the callback function is given by the errhand parameter. If libddpi detects an error and no Ddpi_Error object is specified in the application, the error-handling callback function is called.

Note: You must create your own error-handling callback function. For more information, see "Writing DWARF data to the ELF object file" in z/OS® Common Debug Architecture User's Guide.
After initialization, the program analysis application can change the either the callback function or the errarg pointer received from the callback function. The callback function is changed by calling the ddpi_error_set_errhandler operation. The pointer is changed by calling the ddpi_error_set_errarg operation.
If an error-handling callback function has been specified in the application and if the value of the error parameter is NULL, the error parameter is passed to the specified callback function, and the operation that encountered the error condition returns a value of DW_DLV_ERROR.

Callback function arguments

The callback function passes two arguments:
  • The first argument contains a pointer to a temporary Ddpi_Error object that documents the error.
  • The second argument is the errarg pointer, which is provided as a convenience for the program analysis application. The pointer can be used to pass extra information to the callback function.
If invalid arguments are specified when an libddpi operation is called, the return values are undefined. The error-handling callback function might not be called, and the libddpi operation might abort execution. Examples of invalid arguments are:
  • A NULL pointer to a libddpi operation (except where explicitly permitted)
  • A pointer to an invalid address
  • A pointer to an uninitialized value