1
0
mirror of https://github.com/hashcat/hashcat.git synced 2025-01-05 13:21:13 +00:00

Handling clBuildProgram failure (show build log on errors)

This commit is contained in:
Gabriele 'matrix' Gristina 2016-01-28 21:02:36 +01:00
parent 692a86eb54
commit ebd28553a5

View File

@ -375,8 +375,33 @@ void hc_clBuildProgram (OCL_PTR *ocl, cl_program program, cl_uint num_devices, c
{
log_error ("ERROR: %s : %d : %s\n", "clBuildProgram()", CL_err, val2cstr_cl (CL_err));
// If we exit here we can't see the error message
// exit (-1);
char *buf = NULL;
size_t len = 0;
if (ocl->clGetProgramBuildInfo (program, *device_list, CL_PROGRAM_BUILD_LOG, 0, NULL, &len) != CL_SUCCESS)
{
log_error ("ERROR: %s : %d : %s\n", "clGetProgramBuildInfo()", CL_err, val2cstr_cl (CL_err));
exit (-1);
}
if (len > 0)
{
buf = (char *) mymalloc (len + 1);
if (ocl->clGetProgramBuildInfo (program, *device_list, CL_PROGRAM_BUILD_LOG, len, buf, NULL) != CL_SUCCESS)
{
log_error ("ERROR: %s : %d : %s\n", "clGetProgramBuildInfo()", CL_err, val2cstr_cl (CL_err));
}
else
{
log_error ("Build log:\n%s\n", buf);
}
myfree (buf);
}
exit (-1);
}
}