1
0
mirror of https://github.com/hashcat/hashcat.git synced 2024-12-17 12:18:24 +00:00

Merge pull request #174 from gm4tr1x/showOpenCLBuildLogOnErrors

Handling clBuildProgram failure (show build log on errors)
This commit is contained in:
Jens Steube 2016-01-29 08:36:40 +01:00
commit 31817e5bdf

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)); 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 char *buf = NULL;
// exit (-1); 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);
} }
} }