Change tools debug macros to not use error stack

This commit is contained in:
Allen Byrne 2020-01-23 10:20:34 -06:00
parent edcba1ce2e
commit ee1fa14066
10 changed files with 142 additions and 203 deletions

View File

@ -274,7 +274,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
trav_table_t *table = NULL;
size_t idx;
H5TOOLS_DEBUG("build_match_list start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* init */
trav_table_init(info1->fid, &table);
if (table == NULL) {
@ -382,7 +382,7 @@ build_match_list (const char *objname1, trav_info_t *info1, const char *objname2
done:
*table_out = table;
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
@ -416,6 +416,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata)
const char *ext_path;
herr_t ret_value = SUCCEED;
H5TOOLS_START_DEBUG("");
/* init linkinfo struct */
HDmemset(&lnk_info, 0, sizeof(h5tool_link_info_t));
@ -499,7 +500,7 @@ trav_grp_symlinks(const char *path, const H5L_info2_t *linfo, void *udata)
done:
if (lnk_info.trg_path)
HDfree(lnk_info.trg_path);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -514,11 +515,7 @@ done:
*-------------------------------------------------------------------------
*/
hsize_t
h5diff(const char *fname1,
const char *fname2,
const char *objname1,
const char *objname2,
diff_opt_t *opts)
h5diff(const char *fname1, const char *fname2, const char *objname1, const char *objname2, diff_opt_t *opts)
{
hid_t file1_id = H5I_INVALID_HID;
hid_t file2_id = H5I_INVALID_HID;
@ -552,7 +549,7 @@ h5diff(const char *fname1,
trav_table_t *match_list = NULL;
diff_err_t ret_value = H5DIFF_NO_ERR;
H5TOOLS_DEBUG("h5diff start");
H5TOOLS_START_DEBUG("");
/* init filenames */
HDmemset(filenames, 0, MAX_FILENAME * 2);
/* init link info struct */
@ -972,9 +969,8 @@ done:
H5Fclose(file2_id);
} H5E_END_TRY;
H5TOOLS_DEBUG("h5diff finish - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
return nfound;
}
@ -1012,7 +1008,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
size_t idx2 = 0;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_match start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*
* if not root, prepare object name to be pre-appended to group path to
* make full path
@ -1367,9 +1363,8 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
if (table)
trav_table_free(table);
H5TOOLS_DEBUG("diff_match finish diffs=%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG(" diffs=%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
return nfound;
}
@ -1388,12 +1383,7 @@ diff_match(hid_t file1_id, const char *grp1, trav_info_t *info1,
*-------------------------------------------------------------------------
*/
hsize_t
diff(hid_t file1_id,
const char *path1,
hid_t file2_id,
const char *path2,
diff_opt_t * opts,
diff_args_t *argdata)
diff(hid_t file1_id, const char *path1, hid_t file2_id, const char *path2, diff_opt_t * opts, diff_args_t *argdata)
{
int status = -1;
hid_t dset1_id = H5I_INVALID_HID;
@ -1413,7 +1403,7 @@ diff(hid_t file1_id,
h5tool_link_info_t linkinfo1;
h5tool_link_info_t linkinfo2;
H5TOOLS_DEBUG("diff start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*init link info struct */
HDmemset(&linkinfo1, 0, sizeof(h5tool_link_info_t));
@ -1803,9 +1793,8 @@ done:
/* enable error reporting */
} H5E_END_TRY;
H5TOOLS_DEBUG("diff finish:%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG(": %d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
return nfound;
}

View File

@ -261,19 +261,9 @@ static void close_member_types(mcomp_t *members);
*-------------------------------------------------------------------------
*/
hsize_t diff_array(
void *_mem1,
void *_mem2,
hsize_t nelmts,
hsize_t hyper_start,
int rank,
hsize_t *dims,
diff_opt_t *opts,
const char *name1,
const char *name2,
hid_t m_type,
hid_t container1_id,
hid_t container2_id) /* dataset where the reference came from*/
hsize_t diff_array(void *_mem1, void *_mem2, hsize_t nelmts, hsize_t hyper_start,
int rank, hsize_t *dims, diff_opt_t *opts, const char *name1, const char *name2,
hid_t m_type, hid_t container1_id, hid_t container2_id)
{
hsize_t nfound = 0; /* number of differences found */
size_t size; /* size of datum */
@ -287,7 +277,7 @@ hsize_t diff_array(
mcomp_t members;
H5T_class_t type_class;
H5TOOLS_DEBUG("diff_array start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* get the size. */
size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@ -384,7 +374,7 @@ hsize_t diff_array(
} /* switch */
H5TOOLS_DEBUG("diff_array finish:%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG("exit: %d", nfound);
H5TOOLS_ENDDEBUG(": %d", nfound);
return nfound;
}
@ -421,20 +411,9 @@ hsize_t diff_array(
* Dereference the object and compare the type (basic object type).
*-------------------------------------------------------------------------
*/
static hsize_t diff_datum(
void *_mem1,
void *_mem2,
hid_t m_type,
hsize_t index,
int rank,
hsize_t *dims,
hsize_t *acc,
hsize_t *pos,
diff_opt_t *opts,
const char *obj1,
const char *obj2,
hid_t container1_id,
hid_t container2_id, /*where the reference came from*/
static hsize_t diff_datum(void *_mem1, void *_mem2, hid_t m_type, hsize_t index, int rank,
hsize_t *dims, hsize_t *acc, hsize_t *pos, diff_opt_t *opts, const char *obj1, const char *obj2,
hid_t container1_id, hid_t container2_id,
int *ph, /*print header */
mcomp_t *members) /*compound members */
{
@ -456,7 +435,7 @@ static hsize_t diff_datum(
hbool_t both_zero;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_datum start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
type_size = H5Tget_size(m_type);
type_class = H5Tget_class(m_type);
@ -2238,7 +2217,7 @@ done:
H5TOOLS_DEBUG("diff_datum finish:%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return nfound;
}
@ -2327,7 +2306,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
hsize_t nfound_p = 0; /* point differences found */
hsize_t ret_value = 0;
H5TOOLS_DEBUG("diff_region start");
H5TOOLS_START_DEBUG("");
ndims1 = H5Sget_simple_extent_ndims(region1_id);
ndims2 = H5Sget_simple_extent_ndims(region2_id);
@ -2508,7 +2487,7 @@ static hsize_t diff_region(hid_t obj1_id, hid_t obj2_id, hid_t region1_id, hid_t
ret_value = nfound_p + nfound_b;
done:
H5TOOLS_ENDDEBUG("exit with diffs:%d", ret_value);
H5TOOLS_ENDDEBUG(" with diffs:%d", ret_value);
return ret_value;
}
@ -2530,7 +2509,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
HDmemcpy(&temp1_uchar, mem1, sizeof(unsigned char));
HDmemcpy(&temp2_uchar, mem2, sizeof(unsigned char));
H5TOOLS_DEBUG("character_compare start %d=%d",temp1_uchar,temp2_uchar);
H5TOOLS_START_DEBUG(" %d=%d",temp1_uchar,temp2_uchar);
if (temp1_uchar != temp2_uchar) {
if (print_data(opts)) {
@ -2543,9 +2522,7 @@ static hsize_t character_compare(char *mem1, char *mem2, hsize_t i, size_t u,
}
nfound++;
}
H5TOOLS_DEBUG("character_compare finish");
H5TOOLS_ENDDEBUG("exit: %d", nfound);
H5TOOLS_ENDDEBUG(": %d", nfound);
return nfound;
}
@ -4523,7 +4500,7 @@ int ull2float(unsigned long long ull_value, float *f_value)
size_t dst_size;
int ret_value = 0;
H5TOOLS_DEBUG("ull2float start");
H5TOOLS_START_DEBUG("");
if ((dxpl_id = H5Pcreate(H5P_DATASET_XFER)) < 0)
H5TOOLS_GOTO_ERROR(FAIL, "H5Pcreate failed");
@ -4548,9 +4525,7 @@ done:
if (buf)
HDfree(buf);
H5TOOLS_DEBUG("ull2float finish");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}

View File

@ -153,7 +153,7 @@ static herr_t build_match_list_attrs(hid_t loc1_id, hid_t loc2_id, table_attrs_t
herr_t ret_value = SUCCEED;
H5TOOLS_DEBUG("build_match_list_attrs start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
if(H5Oget_info3(loc1_id, &oinfo1, H5O_INFO_NUM_ATTRS) < 0) {
H5TOOLS_GOTO_ERROR(FAIL, "H5Oget_info first object failed");
@ -299,9 +299,8 @@ done:
H5Aclose(attr2_id);
} H5E_END_TRY;
H5TOOLS_DEBUG("build_match_list_attrs end - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
return ret_value;
}
@ -340,7 +339,7 @@ hsize_t diff_attr_data(hid_t attr1_id, hid_t attr2_id, const char *name1, const
int j;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_attr_data start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* get the datatypes */
if((ftype1_id = H5Aget_type(attr1_id)) < 0)
@ -517,9 +516,8 @@ done:
H5Sclose(space2_id);
} H5E_END_TRY;
H5TOOLS_DEBUG("diff_attr_data end - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
return nfound;
}
@ -548,7 +546,7 @@ hsize_t diff_attr(hid_t loc1_id, hid_t loc2_id, const char *path1, const char *p
hsize_t nfound_total = 0;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_attr start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
if(build_match_list_attrs(loc1_id, loc2_id, &match_list_attrs, opts) < 0) {
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "build_match_list_attrs failed");
@ -600,8 +598,7 @@ done:
H5Aclose(attr2_id);
} H5E_END_TRY;
H5TOOLS_DEBUG("diff_attr end - errstat:%d", opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG(" - errstat:%d", opts->err_stat);
return nfound_total;
}

View File

@ -27,11 +27,7 @@
* Return: Number of differences found
*-------------------------------------------------------------------------
*/
hsize_t diff_dataset(hid_t file1_id,
hid_t file2_id,
const char *obj1_name,
const char *obj2_name,
diff_opt_t *opts)
hsize_t diff_dataset(hid_t file1_id, hid_t file2_id, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
int status = -1;
hid_t did1 = H5I_INVALID_HID;
@ -41,7 +37,7 @@ hsize_t diff_dataset(hid_t file1_id,
hsize_t nfound = 0;
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_dataset start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/*-------------------------------------------------------------------------
* open the handles
*-------------------------------------------------------------------------
@ -92,8 +88,7 @@ done:
/* enable error reporting */
} H5E_END_TRY;
H5TOOLS_DEBUG("diff_dataset finish:%d - errstat:%d", nfound, opts->err_stat);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG(":%d - errstat:%d", nfound, opts->err_stat);
return nfound;
}
@ -148,11 +143,7 @@ done:
*
*-------------------------------------------------------------------------
*/
hsize_t diff_datasetid(hid_t did1,
hid_t did2,
const char *obj1_name,
const char *obj2_name,
diff_opt_t *opts)
hsize_t diff_datasetid(hid_t did1, hid_t did2, const char *obj1_name, const char *obj2_name, diff_opt_t *opts)
{
hid_t sid1 = H5I_INVALID_HID;
hid_t sid2 = H5I_INVALID_HID;
@ -197,7 +188,7 @@ hsize_t diff_datasetid(hid_t did1,
unsigned int vl_data2 = 0; /*contains VL datatypes */
diff_err_t ret_value = opts->err_stat;
H5TOOLS_DEBUG("diff_datasetid start - errstat:%d", opts->err_stat);
H5TOOLS_START_DEBUG(" - errstat:%d", opts->err_stat);
/* Get the dataspace handle */
if((sid1 = H5Dget_space(did1)) < 0)
H5TOOLS_GOTO_ERROR(H5DIFF_ERR, "H5Dget_space failed");
@ -606,8 +597,7 @@ done:
/* enable error reporting */
} H5E_END_TRY;
H5TOOLS_DEBUG("diff_datasetid return:%d with nfound:%d", ret_value, nfound);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG(": %d with nfound:%d", ret_value, nfound);
return nfound;
}
@ -623,18 +613,10 @@ done:
*-------------------------------------------------------------------------
*/
int diff_can_type(hid_t f_tid1, /* file data type */
hid_t f_tid2, /* file data type */
int rank1,
int rank2,
hsize_t *dims1,
hsize_t *dims2,
hsize_t *maxdim1,
hsize_t *maxdim2,
const char *obj1_name,
const char *obj2_name,
diff_opt_t *opts,
int is_compound)
int diff_can_type(hid_t f_tid1, hid_t f_tid2, int rank1, int rank2,
hsize_t *dims1, hsize_t *dims2, hsize_t *maxdim1, hsize_t *maxdim2,
const char *obj1_name, const char *obj2_name,
diff_opt_t *opts, int is_compound)
{
H5T_class_t tclass1;
H5T_class_t tclass2;
@ -643,7 +625,7 @@ int diff_can_type(hid_t f_tid1, /* file data type */
int i;
int ret_value = 1;
H5TOOLS_DEBUG("diff_can_type start");
H5TOOLS_START_DEBUG("");
/*-------------------------------------------------------------------------
* check for the same class
*-------------------------------------------------------------------------
@ -851,8 +833,7 @@ done:
if (ret_value < 0)
opts->err_stat = H5DIFF_ERR;
H5TOOLS_DEBUG("diff_can_type end - %d", ret_value);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG(" - %d", ret_value);
return ret_value;
}

View File

@ -341,6 +341,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
{
herr_t ret_value = SUCCEED;
H5TOOLS_START_DEBUG("");
if((*m_size1) != (*m_size2)) {
if((*m_size1) < (*m_size2)) {
H5Tclose(*m_tid1);
@ -363,7 +364,7 @@ herr_t match_up_memsize (hid_t f_tid1_id, hid_t f_tid2_id,
H5TOOLS_GOTO_ERROR(FAIL, "native type sizes do not compare");
done:
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}

View File

@ -22,6 +22,12 @@
#include "h5tools_utils.h"
#include "H5private.h"
#ifdef H5_TOOLS_DEBUG
/* global debug variables */
int H5tools_INDENT_g = 0;
#endif
/* global variables */
hid_t H5tools_ERR_STACK_g = 0;
hid_t H5tools_ERR_CLS_g = H5I_INVALID_HID;
@ -741,7 +747,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
if (!ctx->need_prefix)
return;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
HDmemset(&prefix, 0, sizeof(h5tools_str_t));
HDmemset(&str, 0, sizeof(h5tools_str_t));
@ -809,7 +815,7 @@ h5tools_simple_prefix(FILE *stream, const h5tool_format_t *info,
h5tools_str_close(&prefix);
h5tools_str_close(&str);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@ -934,7 +940,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
if (stream == NULL)
return dimension_break;
H5TOOLS_DEBUG("enter need_prefix=%d", ctx->need_prefix);
H5TOOLS_START_DEBUG(" need_prefix=%d", ctx->need_prefix);
H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter);
s = h5tools_str_fmt(buffer, (size_t)0, "%s");
@ -1061,7 +1067,7 @@ h5tools_render_element(FILE *stream, const h5tool_format_t *info,
ctx->prev_multiline = multiline;
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return dimension_break;
}
@ -1102,7 +1108,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
int secnum; /* section sequence number */
int multiline; /* datum was multiline */
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
H5TOOLS_DEBUG("elmt_counter=%ld - local_elmt_counter=%ld", elmt_counter, local_elmt_counter);
s = h5tools_str_fmt(buffer, (size_t)0, "%s");
@ -1212,7 +1218,7 @@ h5tools_render_region_element(FILE *stream, const h5tool_format_t *info,
ctx->prev_multiline = multiline;
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return dimension_break;
}
@ -1231,7 +1237,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
int i;
unsigned j;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
if(ctx->ndims > 0) {
ctx->acc[ctx->ndims - 1] = 1;
@ -1243,7 +1249,7 @@ init_acc_pos(h5tools_context_t *ctx, hsize_t *dims)
ctx->pos[j] = 0;
}
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@ -1265,7 +1271,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
hbool_t past_catch = FALSE;
int ret_value = 0;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
if((size = H5Tget_size(tid)) == 0)
H5TOOLS_THROW((-1), "H5Tget_size failed");
@ -1481,7 +1487,7 @@ render_bin_output(FILE *stream, hid_t container, hid_t tid, void *_mem, hsize_t
} /* end switch */
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1514,6 +1520,7 @@ render_bin_output_region_data_blocks(hid_t region_id, FILE *stream,
hid_t sid1 = H5I_INVALID_HID;
int ret_value = -1;
H5TOOLS_START_DEBUG("");
/* Get the dataspace of the dataset */
if((sid1 = H5Dget_space(region_id)) < 0)
H5TOOLS_THROW((-1), "H5Dget_space failed");
@ -1580,7 +1587,7 @@ CATCH
if(H5Sclose(sid1) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1609,6 +1616,7 @@ render_bin_output_region_blocks(hid_t region_space, hid_t region_id,
hbool_t past_catch = FALSE;
hbool_t ret_value = TRUE;
H5TOOLS_START_DEBUG("");
if((snblocks = H5Sget_select_hyper_nblocks(region_space)) <= 0)
H5TOOLS_THROW(FALSE, "H5Sget_select_hyper_nblocks failed");
nblocks = (hsize_t)snblocks;
@ -1644,7 +1652,7 @@ done:
H5_LEAVE(TRUE)
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1676,6 +1684,7 @@ render_bin_output_region_data_points(hid_t region_space, hid_t region_id,
void *region_buf = NULL;
int ret_value = 0;
H5TOOLS_START_DEBUG("");
if((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_GOTO_ERROR((-1), "H5Tget_size failed");
@ -1705,7 +1714,7 @@ done:
if(H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1732,6 +1741,7 @@ render_bin_output_region_points(hid_t region_space, hid_t region_id,
hbool_t past_catch = FALSE;
hbool_t ret_value = TRUE;
H5TOOLS_START_DEBUG("");
if((snpoints = H5Sget_select_elem_npoints(region_space)) <= 0)
H5TOOLS_THROW(FALSE, "H5Sget_select_elem_npoints failed");
npoints = (hsize_t)snpoints;
@ -1758,7 +1768,7 @@ done:
H5_LEAVE(ret_value)
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}

View File

@ -273,7 +273,7 @@ h5tools_dump_simple_data(FILE *stream, const h5tool_format_t *info, hid_t contai
* to the ctx->size_last_dim. */
int ret_value = 0;
H5TOOLS_DEBUG("enter file=%p", (void*)stream);
H5TOOLS_START_DEBUG(" file=%p", (void*)stream);
H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
/* binary dump */
if (bin_output && (rawdatastream != NULL)) {
@ -460,8 +460,7 @@ done:
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -484,8 +483,7 @@ CATCH
*-------------------------------------------------------------------------
*/
static int
h5tools_print_region_data_blocks(hid_t region_id,
FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
h5tools_print_region_data_blocks(hid_t region_id, FILE *stream, const h5tool_format_t *info, h5tools_context_t *cur_ctx,
h5tools_str_t *buffer, /* string into which to render */
size_t ncols, unsigned ndims, hid_t type_id, hsize_t nblocks, hsize_t *ptdata)
{
@ -517,7 +515,7 @@ h5tools_print_region_data_blocks(hid_t region_id,
HDmemset(&ctx, 0, sizeof(ctx));
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
if((type_size = H5Tget_size(type_id)) == 0)
H5TOOLS_THROW(FAIL, "H5Tget_size failed");
@ -635,7 +633,7 @@ done:
if(H5Sclose(sid1) < 0)
H5TOOLS_ERROR(FAIL, "H5Sclose failed");
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -690,6 +688,7 @@ h5tools_dump_region_data_blocks(hid_t region_space, hid_t region_id,
HDassert(ctx);
HDassert(buffer);
H5TOOLS_START_DEBUG("");
outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
@ -853,7 +852,7 @@ done:
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -903,7 +902,7 @@ h5tools_print_region_data_points(hid_t region_space, hid_t region_id,
HDassert(ptdata);
HDassert(ndims > 0);
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
HDmemset(&ctx, 0, sizeof(ctx));
/* Allocate space for the dimension array */
@ -991,7 +990,7 @@ CATCH
if(H5Sclose(mem_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1043,6 +1042,7 @@ h5tools_dump_region_data_points(hid_t region_space, hid_t region_id,
HDassert(ctx);
HDassert(buffer);
H5TOOLS_START_DEBUG("");
outputformat = *info;
outputformat.idx_fmt = "";
outputformat.idx_n_fmt = "";
@ -1202,7 +1202,7 @@ done:
H5_LEAVE(dimension_break)
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1241,8 +1241,7 @@ CATCH
*/
static herr_t
h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t dset, hid_t p_type,
hid_t f_space, hsize_t hyperslab_count,
hid_t dset, hid_t p_type, hid_t f_space, hsize_t hyperslab_count,
hsize_t *temp_start, /* start inside offset count loop */
hsize_t *temp_count, /* count inside offset count loop */
hsize_t *temp_block, /* block size used in loop */
@ -1271,6 +1270,7 @@ h5tools_print_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_c
unsigned int vl_data = 0; /* contains VL datatypes */
herr_t ret_value = SUCCEED;
H5TOOLS_START_DEBUG("");
if ((size_t) ctx->ndims > NELMTS(sm_size))
H5TOOLS_THROW(FAIL, "ndims and sm_size comparision failed");
@ -1391,7 +1391,7 @@ CATCH
if(sm_buf)
HDfree(sm_buf);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1568,8 +1568,7 @@ h5tools_display_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools
*-------------------------------------------------------------------------
*/
static herr_t
h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx,
hid_t dset, hid_t p_type)
h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx, hid_t dset, hid_t p_type)
{
int sndims;
hid_t f_space = H5I_INVALID_HID; /* file data space */
@ -1578,6 +1577,7 @@ h5tools_dump_simple_subset(FILE *stream, const h5tool_format_t *info, h5tools_co
hbool_t past_catch = FALSE;
herr_t ret_value = SUCCEED;
H5TOOLS_START_DEBUG("");
if((f_space = H5Dget_space(dset)) < 0)
H5TOOLS_THROW(FAIL, "H5Dget_space failed");
@ -1603,7 +1603,7 @@ CATCH
if(f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_THROW(FAIL, "H5Sclose failed");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1656,7 +1656,7 @@ h5tools_dump_simple_dset(FILE *stream, const h5tool_format_t *info, h5tools_cont
unsigned int vl_data = 0; /* contains VL datatypes */
int ret_value = 0;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
if (H5I_INVALID_HID == (f_space = H5Dget_space(dset)))
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
@ -1796,7 +1796,7 @@ done:
if(f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1827,7 +1827,7 @@ h5tools_dump_simple_mem(FILE *stream, const h5tool_format_t *info, h5tools_conte
/* VL data special information */
unsigned int vl_data = 0; /* contains VL datatypes */
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
if (H5I_INVALID_HID == (f_space = H5Aget_space(attr_id)))
H5TOOLS_GOTO_ERROR((-1), "H5Dget_space failed");
@ -1890,7 +1890,7 @@ done:
if(f_space >= 0 && H5Sclose(f_space) < 0)
H5TOOLS_ERROR((-1), "H5Sclose failed");
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1922,6 +1922,7 @@ h5tools_dump_dset(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
h5tool_format_t info_dflt;
int ret_value = 0;
H5TOOLS_START_DEBUG("");
/* Use default values */
if (!stream)
stream = rawoutstream;
@ -1973,7 +1974,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -1997,6 +1998,7 @@ h5tools_dump_mem(FILE *stream, const h5tool_format_t *info, h5tools_context_t *c
h5tool_format_t info_dflt;
int ret_value = 0;
H5TOOLS_START_DEBUG("");
/* Use default values */
if (!stream)
stream = rawoutstream;
@ -2042,7 +2044,7 @@ done:
if (f_space > 0)
H5Sclose(f_space);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -2085,6 +2087,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
const char *order_s = NULL; /* byte order string */
int ret_value = 0;
H5TOOLS_START_DEBUG("");
if((type_class = H5Tget_class(type)) < 0)
H5TOOLS_THROW((-1), "H5Tget_class failed");
if (object_search && H5Tcommitted(type) > 0) {
@ -2635,7 +2638,7 @@ h5tools_print_datatype(FILE *stream, h5tools_str_t *buffer, const h5tool_format_
}
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -2661,6 +2664,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
int i;
int ret_value = 0;
H5TOOLS_START_DEBUG("");
if((ndims = H5Sget_simple_extent_dims(space, size, maxsize)) < 0)
H5TOOLS_THROW((-1), "H5Sget_simple_extent_dims failed");
@ -2712,7 +2716,7 @@ h5tools_print_dataspace(h5tools_str_t *buffer, hid_t space)
} /* end switch */
CATCH
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -2747,6 +2751,7 @@ h5tools_print_enum(FILE *stream, h5tools_str_t *buffer, const h5tool_format_t *i
hbool_t past_catch = FALSE;
int ret_value = 0;
H5TOOLS_START_DEBUG("");
if (info->line_ncols > 0)
ncols = info->line_ncols;
@ -2858,7 +2863,7 @@ CATCH
if(0 == nmembs)
h5tools_str_append(buffer, "\n<empty>");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return ret_value;
}
@ -3991,7 +3996,7 @@ h5tools_dump_data(FILE *stream, const h5tool_format_t *info, h5tools_context_t *
h5tool_format_t outputformat;
H5R_ref_t *ref_buf = NULL;
H5TOOLS_DEBUG("enter file=%p", (void*)stream);
H5TOOLS_START_DEBUG(" file=%p", (void*)stream);
H5TOOLS_DEBUG("rawdata file=%p", (void*)rawdatastream);
/* setup */
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@ -4365,6 +4370,6 @@ done:
}
h5tools_str_close(&buffer);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}

View File

@ -21,10 +21,9 @@
#include "H5Eprivate.h" /* Error handling */
/* tools-HDF5 Error variables */
H5TOOLS_DLLVAR int H5tools_INDENT_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_STACK_g;
H5TOOLS_DLLVAR hid_t H5tools_DBG_ERR_STACK_g;
H5TOOLS_DLLVAR hid_t H5tools_ERR_CLS_g;
H5TOOLS_DLLVAR hid_t H5tools_DBG_ERR_CLS_g;
H5TOOLS_DLLVAR hid_t H5E_tools_g;
H5TOOLS_DLLVAR hid_t H5E_tools_min_id_g;
H5TOOLS_DLLVAR hid_t H5E_tools_min_info_id_g;
@ -53,9 +52,6 @@ do {
if ((H5tools_ERR_STACK_g = H5Ecreate_stack()) < 0) \
HDfprintf(stderr, "Failed to create HDF5 tools error stack\n"); \
\
/* Create new HDF5 error stack for debugging, if tools debugging is enabled */ \
H5TOOLS_CREATE_DEBUG_STACK(); \
\
/* Register errors from the HDF5 tools as a new error class */ \
if ((H5tools_ERR_CLS_g = H5Eregister_class("H5tools", "HDF5:tools", lib_str)) < 0) \
HDfprintf(stderr, "Failed to register HDF5 tools error class\n"); \
@ -96,9 +92,6 @@ do {
if (H5Eunregister_class(H5tools_ERR_CLS_g) < 0) \
HDfprintf(stderr, "Failed to unregister the HDF5 tools error class\n"); \
\
/* Close the tools debugging error stack, if it was created */ \
H5TOOLS_CLOSE_DEBUG_STACK(); \
\
/* Close the tools error stack */ \
if (H5Eclose_stack(H5tools_ERR_STACK_g) < 0) \
HDfprintf(stderr, "Failed to close HDF5 tools error stack\n"); \
@ -174,47 +167,35 @@ do {
#ifdef H5_TOOLS_DEBUG
#define H5TOOLS_CREATE_DEBUG_STACK() \
#define H5TOOLS_START_DEBUG(...) \
do { \
/* Create new HDF5 error stack for debugging */ \
if ((H5tools_DBG_ERR_STACK_g = H5Ecreate_stack()) < 0) \
HDfprintf(stderr, "Failed to create HDF5 tools debugging error stack\n"); \
\
/* Register debugging output from the HDF5 tools as a new error class */ \
if ((H5tools_DBG_ERR_CLS_g = H5Eregister_class("H5tools-debug", "HDF5:tools", lib_str)) < 0) \
HDfprintf(stderr, "Failed to register HDF5 tools debugging error class\n"); \
H5tools_INDENT_g += 2; \
HDfprintf(stderr, "%*sENTER %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
HDfflush(stderr); \
} while(0)
#define H5TOOLS_CLOSE_DEBUG_STACK() \
do { \
/* Unregister the HDF5 tools debugging error class */ \
if (H5Eunregister_class(H5tools_DBG_ERR_CLS_g) < 0) \
HDfprintf(stderr, "Failed to unregister the HDF5 tools debugging error class\n"); \
\
/* Close the tools debugging error stack */ \
if (H5Eclose_stack(H5tools_DBG_ERR_STACK_g) < 0) \
HDfprintf(stderr, "Failed to close HDF5 tools debugging error stack\n"); \
#define H5TOOLS_DEBUG(...) \
do { \
HDfprintf(stderr, "%*s %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
HDfflush(stderr); \
} while(0)
#define H5TOOLS_DEBUG(...) \
do { \
H5TOOLS_PUSH_ERROR(H5tools_DBG_ERR_STACK_g, H5tools_DBG_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \
} while(0)
#define H5TOOLS_ENDDEBUG(...) \
do { \
H5TOOLS_PUSH_ERROR(H5tools_DBG_ERR_STACK_g, H5tools_DBG_ERR_CLS_g, H5E_tools_g, H5E_tools_min_dbg_id_g, __VA_ARGS__); \
H5Eprint2(H5tools_DBG_ERR_STACK_g, stderr); \
#define H5TOOLS_ENDDEBUG(...) \
do { \
HDfprintf(stderr, "%*sEXIT %s:%d in %s()...", H5tools_INDENT_g, "", __FILE__, __LINE__, FUNC); \
HDfprintf(stderr, __VA_ARGS__); \
HDfprintf(stderr, "\n"); \
H5tools_INDENT_g -= 2; \
HDfflush(stderr); \
} while(0)
#else
#define H5TOOLS_CREATE_DEBUG_STACK() \
do { \
; \
} while(0)
#define H5TOOLS_CLOSE_DEBUG_STACK() \
#define H5TOOLS_START_DEBUG(...) \
do { \
; \
} while(0)

View File

@ -292,7 +292,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
size_t i = 0;
hsize_t curr_pos = elmtno;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
H5TOOLS_DEBUG("elmtno=%ld, ctx->ndims=%d", elmtno, ctx->ndims);
h5tools_str_reset(str);
@ -325,7 +325,7 @@ h5tools_str_prefix(h5tools_str_t *str/*in,out*/, const h5tool_format_t *info,
h5tools_str_append(str, OPT(info->idx_n_fmt, HSIZE_T_FORMAT), (hsize_t)elmtno);
H5TOOLS_DEBUG("str=%s", str->s);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
/* Add prefix and suffix to the index */
return h5tools_str_fmt(str, (size_t)0, OPT(info->idx_fmt, "%s: "));
@ -693,7 +693,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
H5T_class_t type_class;
char *ret_value = NULL;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
/* Build default formats for long long types */
if(!fmt_llong[0]) {
HDsnprintf(fmt_llong, sizeof(fmt_llong), "%%%sd", H5_PRINTF_LL_WIDTH);
@ -1346,7 +1346,7 @@ h5tools_str_sprint(h5tools_str_t *str, const h5tool_format_t *info, hid_t contai
ret_value = h5tools_str_fmt(str, start, OPT(info->elmt_fmt, "%s"));
H5TOOLS_ENDDEBUG("exit with %s", ret_value);
H5TOOLS_ENDDEBUG(" with %s", ret_value);
return ret_value;
}
@ -1364,7 +1364,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
{
ssize_t buf_size;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
h5tools_str_append(str, " \"");
buf_size = H5Rget_file_name(ref_vp, NULL, 0);
@ -1406,7 +1406,7 @@ h5tools_str_sprint_reference(h5tools_str_t *str, H5R_ref_t *ref_vp)
}
h5tools_str_append(str, "\"");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------

View File

@ -1307,7 +1307,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
h5tools_str_t buffer; /* string into which to render */
h5tools_context_t datactx; /* print context */
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
datactx = *ctx; /* print context */
/* Assume entire data space to be printed */
@ -1513,7 +1513,7 @@ dump_reference(FILE *stream, const h5tool_format_t *info, h5tools_context_t *ctx
PRINTVALSTREAM(stream, "\n");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@ -1542,7 +1542,7 @@ dump_dataset_values(hid_t dset)
h5tool_format_t *info = &ls_dataformat;
H5R_ref_t *ref_buf = NULL;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
f_type = H5Dget_type(dset);
space = H5Dget_space(dset);
@ -1682,7 +1682,7 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
@ -1712,7 +1712,7 @@ dump_attribute_values(hid_t attr)
h5tool_format_t *info = &ls_dataformat;
H5R_ref_t *ref_buf = NULL;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
f_type = H5Aget_type(attr);
space = H5Aget_space(attr);
@ -1859,7 +1859,7 @@ done:
PRINTVALSTREAM(rawoutstream, "\n");
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
}
/*-------------------------------------------------------------------------
@ -1888,7 +1888,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@ -1962,7 +1962,7 @@ list_attr(hid_t obj, const char *attr_name, const H5A_info_t H5_ATTR_UNUSED *ain
H5TOOLS_DEBUG("Attribute open failed");
h5tools_str_close(&buffer);
}
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return 0;
}
@ -2300,7 +2300,7 @@ list_obj(const char *name, const H5O_info2_t *oinfo, const char *first_seen, voi
h5tools_context_t ctx; /* print context */
h5tool_format_t *info = &ls_dataformat;
H5TOOLS_DEBUG("enter");
H5TOOLS_START_DEBUG("");
HDmemset(&ctx, 0, sizeof(ctx));
HDmemset(&buffer, 0, sizeof(h5tools_str_t));
@ -2438,7 +2438,7 @@ done:
}
h5tools_str_close(&buffer);
H5TOOLS_ENDDEBUG("exit");
H5TOOLS_ENDDEBUG("");
return 0;
} /* end list_obj() */