From c9ce27a640e2df04bb4e1085f03f4bd4ec67d931 Mon Sep 17 00:00:00 2001 From: Sean Keely Date: Tue, 4 May 2021 02:11:10 -0500 Subject: [PATCH] Add exception forwarding to tools API callbacks. Prevents poorly written tools which throw in tools interface callbacks from causing ROCr to catch and return a generic error code. Change-Id: I2f5bf7104dc7d4ee688eb48423c7ffdb06bd7702 --- runtime/hsa-runtime/core/runtime/runtime.cpp | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/runtime/hsa-runtime/core/runtime/runtime.cpp b/runtime/hsa-runtime/core/runtime/runtime.cpp index 7ce4e58b25..18f08d726a 100644 --- a/runtime/hsa-runtime/core/runtime/runtime.cpp +++ b/runtime/hsa-runtime/core/runtime/runtime.cpp @@ -1461,8 +1461,7 @@ void Runtime::LoadTools() { if (tool != NULL) { tool_libs_.push_back(tool); - tool_init_t ld; - ld = (tool_init_t)os::GetExportAddress(tool, "OnLoad"); + rocr::AMD::callback_t ld = (tool_init_t)os::GetExportAddress(tool, "OnLoad"); if (ld) { if (!ld(&hsa_api_table_.hsa_api, hsa_api_table_.hsa_api.version.major_id, @@ -1473,8 +1472,8 @@ void Runtime::LoadTools() { } } - tool_wrap_t wrap; - wrap = (tool_wrap_t)os::GetExportAddress(tool, "WrapAgent"); + rocr::AMD::callback_t wrap = + (tool_wrap_t)os::GetExportAddress(tool, "WrapAgent"); if (wrap) { std::vector* agent_lists[2] = {&cpu_agents_, &gpu_agents_}; @@ -1491,8 +1490,7 @@ void Runtime::LoadTools() { } } - tool_add_t add; - add = (tool_add_t)os::GetExportAddress(tool, "AddAgent"); + rocr::AMD::callback_t add = (tool_add_t)os::GetExportAddress(tool, "AddAgent"); if (add) add(this); } else {