SWDEV-295878 Fix for seg fault when using --trace-start off
Change-Id: Ic76d814b3591f72db18319d78f34596dae1ddfee
This commit is contained in:
@@ -82,7 +82,7 @@ typedef std::stack<std::string> message_stack_t;
|
||||
typedef std::map<uint32_t, message_stack_t*> thread_map_t;
|
||||
typedef std::mutex map_mutex_t;
|
||||
map_mutex_t map_mutex;
|
||||
thread_map_t* thread_map = NULL;
|
||||
thread_map_t thread_map;
|
||||
static thread_local message_stack_t* message_stack = NULL;
|
||||
|
||||
roctx_status_t GetExcStatus(const std::exception& e) {
|
||||
@@ -95,8 +95,7 @@ void thread_data_init() {
|
||||
const auto tid = GetTid();
|
||||
|
||||
std::lock_guard<map_mutex_t> lck(map_mutex);
|
||||
if (thread_map == NULL) thread_map = new thread_map_t;
|
||||
(*thread_map)[tid] = message_stack;
|
||||
thread_map[tid] = message_stack;
|
||||
}
|
||||
|
||||
// callbacks table
|
||||
@@ -194,7 +193,7 @@ PUBLIC_API void roctxRangeStop(roctx_range_id_t rangeId) {
|
||||
}
|
||||
|
||||
PUBLIC_API void RangeStackIterate(roctx_range_iterate_cb_t callback, void* arg) {
|
||||
for (const auto& entry : *roctx::thread_map) {
|
||||
for (const auto& entry : roctx::thread_map) {
|
||||
const auto tid = entry.first;
|
||||
for (roctx::message_stack_t stack = *(entry.second); !stack.empty(); stack.pop()){
|
||||
std::string message = stack.top();
|
||||
|
||||
@@ -34,6 +34,7 @@ THE SOFTWARE.
|
||||
#include <unistd.h> /* usleep */
|
||||
|
||||
#include <roctracer_ext.h>
|
||||
#include "src/util/exception.h"
|
||||
#include <roctracer_roctx.h>
|
||||
#include <roctracer_hsa.h>
|
||||
#include <roctracer_hip.h>
|
||||
@@ -915,11 +916,11 @@ void tool_load() {
|
||||
uint32_t ctrl_len = 0;
|
||||
uint32_t ctrl_rate = 0;
|
||||
|
||||
sscanf(ctrl_str, "%d:%d:%d", &ctrl_delay, &ctrl_len, &ctrl_rate);
|
||||
|
||||
if (sscanf(ctrl_str, "%d:%d:%d", &ctrl_delay, &ctrl_len, &ctrl_rate) != 3) {
|
||||
EXC_RAISING(ROCTRACER_STATUS_ERROR, "Invalid ROCP_CTRL_RATE var(" << ctrl_str << "), expected ctrl_delay:ctrl_len:ctrl_rate");
|
||||
}
|
||||
if (ctrl_len > ctrl_rate) {
|
||||
fprintf(stderr, "ROCTracer: control length value (%u) > rate value (%u)\n", ctrl_len, ctrl_rate);
|
||||
abort();
|
||||
EXC_RAISING(ROCTRACER_STATUS_ERROR, "Control length value " << ctrl_len << " > rate value " << ctrl_rate);
|
||||
}
|
||||
control_dist_us = ctrl_rate - ctrl_len;
|
||||
control_len_us = ctrl_len;
|
||||
|
||||
Reference in New Issue
Block a user