From 653706c513215f2e846a828c45e3f7c4e3a00b26 Mon Sep 17 00:00:00 2001 From: Dana Robinson Date: Tue, 5 Mar 2024 17:43:51 -0800 Subject: [PATCH] Handle H5G_info_t properly --- bin/trace | 1 + src/H5G.c | 20 ++++++++++---------- src/H5trace.c | 36 ++++++++++++++++++++++++++++++++++-- 3 files changed, 45 insertions(+), 12 deletions(-) diff --git a/bin/trace b/bin/trace index e4bc830e06e..d07367f67ac 100755 --- a/bin/trace +++ b/bin/trace @@ -75,6 +75,7 @@ $Source = ""; "H5F_file_space_type_t" => "Ft", "H5F_libver_t" => "Fv", "H5G_iterate_t" => "Gi", + "H5G_info_t" => "GI", "H5G_obj_t" => "Go", "H5G_stat_t" => "Gs", "hsize_t" => "h", diff --git a/src/H5G.c b/src/H5G.c index d2a8f145e27..7679da7d80a 100644 --- a/src/H5G.c +++ b/src/H5G.c @@ -591,7 +591,7 @@ H5Gget_info(hid_t loc_id, H5G_info_t *group_info /*out*/) herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE2("e", "i*!", loc_id, group_info); + H5TRACE2("e", "i*GI", loc_id, group_info); /* Retrieve group information synchronously */ if (H5G__get_info_api_common(loc_id, group_info, NULL, NULL) < 0) @@ -620,7 +620,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE6("e", "*s*sIui*!i", app_file, app_func, app_line, loc_id, group_info, es_id); + H5TRACE6("e", "*s*sIui*GIi", app_file, app_func, app_line, loc_id, group_info, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -634,7 +634,7 @@ H5Gget_info_async(const char *app_file, const char *app_func, unsigned app_line, if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE6(__func__, "*s*sIui*!i", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) + H5ARG_TRACE6(__func__, "*s*sIui*GIi", app_file, app_func, app_line, loc_id, group_info, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -699,7 +699,7 @@ H5Gget_info_by_name(hid_t loc_id, const char *name, H5G_info_t *group_info /*out herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE4("e", "i*s*!i", loc_id, name, group_info, lapl_id); + H5TRACE4("e", "i*s*GIi", loc_id, name, group_info, lapl_id); /* Retrieve group information synchronously */ if (H5G__get_info_by_name_api_common(loc_id, name, group_info, lapl_id, NULL, NULL) < 0) @@ -728,7 +728,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE8("e", "*s*sIui*s*!ii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id); + H5TRACE8("e", "*s*sIui*s*GIii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -742,7 +742,7 @@ H5Gget_info_by_name_async(const char *app_file, const char *app_func, unsigned a if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE8(__func__, "*s*sIui*s*!ii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE8(__func__, "*s*sIui*s*GIii", app_file, app_func, app_line, loc_id, name, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); @@ -809,7 +809,7 @@ H5Gget_info_by_idx(hid_t loc_id, const char *group_name, H5_index_t idx_type, H5 herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE7("e", "i*sIiIoh*!i", loc_id, group_name, idx_type, order, n, group_info, lapl_id); + H5TRACE7("e", "i*sIiIoh*GIi", loc_id, group_name, idx_type, order, n, group_info, lapl_id); /* Retrieve group information synchronously */ if (H5G__get_info_by_idx_api_common(loc_id, group_name, idx_type, order, n, group_info, lapl_id, NULL, @@ -840,8 +840,8 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap herr_t ret_value = SUCCEED; /* Return value */ FUNC_ENTER_API(FAIL) - H5TRACE11("e", "*s*sIui*sIiIoh*!ii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, - group_info, lapl_id, es_id); + H5TRACE11("e", "*s*sIui*sIiIoh*GIii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, + n, group_info, lapl_id, es_id); /* Set up request token pointer for asynchronous operation */ if (H5ES_NONE != es_id) @@ -856,7 +856,7 @@ H5Gget_info_by_idx_async(const char *app_file, const char *app_func, unsigned ap if (NULL != token) /* clang-format off */ if (H5ES_insert(es_id, vol_obj->connector, token, - H5ARG_TRACE11(__func__, "*s*sIui*sIiIoh*!ii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) + H5ARG_TRACE11(__func__, "*s*sIui*sIiIoh*GIii", app_file, app_func, app_line, loc_id, group_name, idx_type, order, n, group_info, lapl_id, es_id)) < 0) /* clang-format on */ HGOTO_ERROR(H5E_SYM, H5E_CANTINSERT, FAIL, "can't insert token into event set"); diff --git a/src/H5trace.c b/src/H5trace.c index 2fb43e14a5d..86cf92ecb07 100644 --- a/src/H5trace.c +++ b/src/H5trace.c @@ -1480,8 +1480,40 @@ H5_trace_args(H5RS_str_t *rs, const char *type, va_list ap) H5G_iterate_t git = (H5G_iterate_t)va_arg(ap, H5G_iterate_t); H5RS_asprintf_cat(rs, "%p", (void *)(uintptr_t)git); - } /* end block */ - break; + } break; + + case 'I': /* H5G_info_t */ + { + H5G_info_t ginfo = va_arg(ap, H5G_info_t); + + H5RS_acat(rs, "{"); + switch (ginfo.storage_type) { + case H5G_STORAGE_TYPE_UNKNOWN: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_UNKNOWN"); + break; + + case H5G_STORAGE_TYPE_SYMBOL_TABLE: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_SYMBOL_TABLE"); + break; + + case H5G_STORAGE_TYPE_COMPACT: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_COMPACT"); + break; + + case H5G_STORAGE_TYPE_DENSE: + H5RS_asprintf_cat(rs, "H5G_STORAGE_TYPE_DENSE"); + break; + + default: + H5RS_asprintf_cat(rs, "%ld", (long)ginfo.storage_type); + break; + } + H5RS_asprintf_cat(rs, ", "); + H5RS_asprintf_cat(rs, "%" PRIuHSIZE ", ", ginfo.nlinks); + H5RS_asprintf_cat(rs, "%" PRId64 ", ", ginfo.max_corder); + H5_trace_args_bool(rs, ginfo.mounted); + H5RS_asprintf_cat(rs, "}"); + } break; case 'o': /* H5G_obj_t */ {