From 28faba40a7d4e1f8bec2476c80d6519e06918731 Mon Sep 17 00:00:00 2001 From: Rachida Kebichi Date: Thu, 25 Mar 2021 09:32:28 -0400 Subject: [PATCH] SWDEV-271503 Fixed core dump Change-Id: Ia582a27482581c3b81c42da0add9f6743898da6c [ROCm/roctracer commit: ad5b463912cb59b67c5bee9eb025340ec8188d36] --- projects/roctracer/script/gen_ostream_ops.py | 6 +++--- projects/roctracer/test/tool/tracer_tool.cpp | 7 ++----- 2 files changed, 5 insertions(+), 8 deletions(-) diff --git a/projects/roctracer/script/gen_ostream_ops.py b/projects/roctracer/script/gen_ostream_ops.py index ae60be84e7..180103a54e 100755 --- a/projects/roctracer/script/gen_ostream_ops.py +++ b/projects/roctracer/script/gen_ostream_ops.py @@ -85,7 +85,7 @@ def process_struct(file_handle, cppHeader_struct, cppHeader, parent_hier_name, a str = '' if "union" not in mtype: indent = "" - str += " if (regex_match (\"" + cppHeader_struct + "::" + name + "\", std::regex(" + apiname.upper() + "_structs_regex))) {\n" + str += " if (std::string(\"" + cppHeader_struct + "::" + name + "\").find(" + apiname.upper() + "_structs_regex" + ")) {\n" indent = " " str += indent + " roctracer::" + apiname.lower() + "_support::operator<<(out, \"" + name + "=\");\n" str += indent + " roctracer::" + apiname.lower() + "_support::operator<<(out, v." + name + ");\n" @@ -132,7 +132,7 @@ def gen_cppheader(infilepath, outfilepath, rank): '#include \n' + \ '\n' + \ '#include "roctracer.h"\n' - header_s += '#include \n#include \n' + header_s += '#include \n' output_filename_h.write(header_s) output_filename_h.write('\n') @@ -140,7 +140,7 @@ def gen_cppheader(infilepath, outfilepath, rank): output_filename_h.write('namespace ' + apiname.lower() + '_support {\n') output_filename_h.write('static int ' + apiname.upper() + '_depth_max = 1;\n') output_filename_h.write('static int ' + apiname.upper() + '_depth_max_cnt = 0;\n') - output_filename_h.write('static std::string ' + apiname.upper() + '_structs_regex = \".*\";\n') + output_filename_h.write('static std::string ' + apiname.upper() + '_structs_regex = \"\";\n') output_filename_h.write('// begin ostream ops for '+ apiname + ' \n') output_filename_h.write("// basic ostream ops\n") output_filename_h.write(header_basic) diff --git a/projects/roctracer/test/tool/tracer_tool.cpp b/projects/roctracer/test/tool/tracer_tool.cpp index c7e063ff3d..cf55574766 100644 --- a/projects/roctracer/test/tool/tracer_tool.cpp +++ b/projects/roctracer/test/tool/tracer_tool.cpp @@ -823,7 +823,6 @@ void tool_unload() { // Flush tracing pool close_tracing_pool(); roctracer::TraceBufferBase::FlushAll(); - close_file_handles(); ONLOAD_TRACE_END(); } @@ -1026,10 +1025,6 @@ void tool_load() { void exit_handler(int status, void* arg) { ONLOAD_TRACE("status(" << status << ") arg(" << arg << ")"); -#if 0 - tool_unload(); - ONLOAD_TRACE_END(); -#endif } // HSA-runtime tool on-load method @@ -1178,6 +1173,8 @@ extern "C" DESTRUCTOR_API void destructor() { ONLOAD_TRACE_BEG(); tool_unload(); roctracer_flush_buf(); + close_file_handles(); + if (hip_api_stats) hip_api_stats->dump(); if (hip_kernel_stats) hip_kernel_stats->dump();