From 41615ea7d5061fceb8268defd5229b0c5cceb59b Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Fri, 13 Oct 2017 23:58:50 -0500 Subject: [PATCH] Improve unhandled exception error reporting in debug builds. Change-Id: Ia92d1a93163105d817a2147d96f2edd399e2b70d [ROCm/ROCR-Runtime commit: 3cef9b1a04ce1170a420aee20d75b0bff60b6e61] --- .../runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp index a0f63c7b1a..8f4309fbf9 100644 --- a/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp +++ b/projects/rocr-runtime/runtime/hsa-runtime/core/runtime/hsa_ext_amd.cpp @@ -130,11 +130,16 @@ hsa_status_t handleException() { return HSA_STATUS_ERROR_OUT_OF_RESOURCES; } catch (const hsa_exception& e) { return e.error_code(); - // Enable when callback exception support is added. - // } catch (std::nested_exception& e) { // Rethrow exceptions from callbacks after unwinding - // HSA. + // } catch (std::nested_exception& e) { + // Rethrow exceptions caught from callbacks. // e.rethrow_nested(); // return HSA_STATUS_ERROR; +#ifndef NDEBUG + } catch (const std::exception& e) { + fprintf(stderr, "Unhandled exception: %s\n", e.what()); + assert(false && "Unhandled exception."); + return HSA_STATUS_ERROR; +#endif } catch (...) { assert(false && "Unhandled exception."); abort();