From 576554dcea0531d51b175e77b6f8b73e4bced651 Mon Sep 17 00:00:00 2001 From: Laurent Morichetti Date: Wed, 27 Apr 2022 08:36:54 -0700 Subject: [PATCH] Fix a SEGV when running --roctx-trace There's a typo in RegisterApiCallback, roctx::cb_table.Get should be roctx::cb_table.Set. Change-Id: I47ec8ac666f783ff4e03f35d13e375e645899900 [ROCm/roctracer commit: 0d7d56eea57817b6a24a114bff96d6bc078ea7ff] --- projects/roctracer/src/core/callback_table.h | 1 + projects/roctracer/src/roctx/roctx.cpp | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/projects/roctracer/src/core/callback_table.h b/projects/roctracer/src/core/callback_table.h index 52c4fccdb8..608154ce0d 100644 --- a/projects/roctracer/src/core/callback_table.h +++ b/projects/roctracer/src/core/callback_table.h @@ -45,6 +45,7 @@ template class CallbackTable { void Get(uint32_t id, activity_rtapi_callback_t* callback, void** arg) const { assert(id < N && "id is out of range"); + assert(callback != nullptr && arg != nullptr && "invalid arguments"); std::lock_guard lock(mutex_); std::tie(*callback, *arg) = callbacks_[id]; } diff --git a/projects/roctracer/src/roctx/roctx.cpp b/projects/roctracer/src/roctx/roctx.cpp index 5bb959a354..c2a71bebe3 100644 --- a/projects/roctracer/src/roctx/roctx.cpp +++ b/projects/roctracer/src/roctx/roctx.cpp @@ -230,7 +230,7 @@ PUBLIC_API bool RegisterApiCallback(uint32_t op, void* callback, void* arg) { PUBLIC_API bool RemoveApiCallback(uint32_t op) { if (op >= ROCTX_API_ID_NUMBER) return false; - roctx::cb_table.Get(op, NULL, NULL); + roctx::cb_table.Set(op, nullptr, nullptr); return true; }