Previous: HIP Built-in Variables, Up: HIP [Contents][Index]
If the HIP runtime library provides the necessary means, ROCgdb can stop the program when a HIP API error is returned. To catch such errors, use the ‘catch hiperr’ command. See catch hiperr, for details.
(gdb) catch hiperr Catchpoint 1 (HIP error) (gdb) run ... Thread 1 "prog" hit Catchpoint 1 (HIP error) HIP API call failed with error hipErrorInvalidDevice (101): invalid device ordinal The $_hiperr convenience variable holds the error number. (gdb) p $_hiperr $1 = hipErrorInvalidDevice (gdb) p/d $_hiperr $2 = 101
There’s also a convenience variable named ‘$_hiperr’ that represents the error. If the ‘hipError_t’ type is known to ROCgdb, then ‘$_hiperr’ is printed as that type, else it is printed as a number. One common use-case of this convenience variable is to set conditional catchpoints.
(gdb) catch hiperr if $_hiperr == hipErrorInvalidDevice
Catchpoint 1 (HIP error)
(gdb) info breakpoints
Num Type Disp Enb Address What
1 catchpoint keep y catch hiperr
stop only if $_hiperr == hipErrorInvalidDevice