Ejemplo n.º 1
0
void
_dwarf_set_error(Dwarf_Debug dbg, Dwarf_Error *error, int errorcode,
    int elferrorcode, const char *functionname, int linenumber)
{
	Dwarf_Error de;

	de.err_error = errorcode;
	de.err_elferror = elferrorcode;
	de.err_func  = functionname;
	de.err_line  = linenumber;
	de.err_msg[0] = '\0';
	
	/*
	 * If the user supplied a destination for the error, copy the
	 * error descriptor over and return.  Otherwise, if the debug
	 * context is known and has an error handler, invoke that.
	 * Otherwise, if a 'default' error handler was registered,
	 * invoke it.
	 */
	if (error)
		*error = de;
	else if (dbg && dbg->dbg_errhand)
		dbg->dbg_errhand(de, dbg->dbg_errarg);
	else if (_libdwarf.errhand)
		_libdwarf.errhand(de, _libdwarf.errarg);

	/* No handler found, do nothing. */
}