diff --git a/src/h5core/h5_core_private.h b/src/h5core/h5_core_private.h index 4a334e6..dece6d5 100644 --- a/src/h5core/h5_core_private.h +++ b/src/h5core/h5_core_private.h @@ -21,7 +21,8 @@ #define H5_CORE_API_LEAVE(value) __FUNC_LEAVE(value) #define H5_CORE_API_RETURN(value) __FUNC_RETURN(value, H5_DEBUG_CORE_API) -#define H5_PRIV_API_ENTER(type) __FUNC_ENTER(type) +#define H5_PRIV_API_ENTER0(type) \ + __FUNC_ENTER1(type, H5_DEBUG_PRIV_API) #define H5_PRIV_API_ENTER1(type, fmt, a1) \ __FUNC_ENTER1(type, fmt, a1, H5_DEBUG_PRIV_API) #define H5_PRIV_API_ENTER2(type, fmt, a1, a2) \ diff --git a/src/h5core/h5_hsearch.c b/src/h5core/h5_hsearch.c index e7a76c8..ab87e9a 100644 --- a/src/h5core/h5_hsearch.c +++ b/src/h5core/h5_hsearch.c @@ -67,7 +67,11 @@ h5priv_hcreate ( unsigned int (*compute_hash)(const void*), h5_err_t (*free_entry)(const void*) ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER5 (h5_err_t, + "nel=%llu, htab=0x%p, compare=0x%p, " + "compute_hash=0x%p, free_entry=0x%p", + (long long unsigned)nel, + htab, compare, compute_hash, free_entry); /* Test for correct arguments. */ if (htab == NULL || htab->table != NULL) { @@ -100,7 +104,9 @@ h5priv_hresize ( size_t nel, // number of entries to grow h5_hashtable_t* htab // hash table to resize ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, + "nel=%llu, htab=0x%p", + (long long unsigned)nel, htab); if (htab == NULL || htab->table == NULL) { H5_PRIV_API_LEAVE (h5_error_internal ()); } @@ -138,7 +144,7 @@ hwalk ( struct hsearch_data* htab, h5_err_t (*visit)(const void *item) ) { - H5_PRIV_FUNC_ENTER (h5_err_t); + H5_PRIV_FUNC_ENTER2 (h5_err_t, "htab=0x%p, visit=0x%p", htab, visit); unsigned int idx = 1; for (idx = 1; idx < htab->size; idx++) { if (htab->table[idx].used) { @@ -155,7 +161,7 @@ h5_err_t h5priv_hdestroy ( struct hsearch_data* htab ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "htab=0x%p", htab); /* Test for correct arguments. */ if (htab == NULL) { H5_PRIV_API_LEAVE (h5_error_internal ()); @@ -193,7 +199,9 @@ h5priv_hsearch ( void** retval, struct hsearch_data* htab ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "item=0x%p, action=%d, retval=0x%p, htab=0x%p", + item, action, retval, htab); unsigned int hval; unsigned int idx; @@ -319,7 +327,7 @@ h5priv_hcreate_string_keyed ( h5_hashtable_t* htab, h5_err_t (*free_entry)(const void*) ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, "htab=0x%p, free_entry=0x%p", htab, free_entry); if (free_entry == NULL) { TRY (h5priv_hcreate (nel, htab, cmp_string_keyed, diff --git a/src/h5core/h5b_attribs.c b/src/h5core/h5b_attribs.c index 7889919..d2b9527 100644 --- a/src/h5core/h5b_attribs.c +++ b/src/h5core/h5b_attribs.c @@ -10,7 +10,7 @@ h5_write_field_attrib ( const void *attrib_value, /*!< IN: attribute value */ const h5_int64_t attrib_nelem /*!< IN: number of elements */ ) { - H5_CORE_API_ENTER5 (h5_err_t, + H5_CORE_API_ENTER6 (h5_err_t, "f=%p, field_name=\"%s\", " "attrib_name=\"%s\", attrib_type=%d, " "attrib_value=%p, attrib_nelem=%lld", @@ -20,7 +20,6 @@ h5_write_field_attrib ( attrib_type, attrib_value, (long long)attrib_nelem); - , TRY( h5bpriv_create_field_group(f, field_name) ); TRY( h5_write_attrib ( diff --git a/src/h5core/h5t_adjacencies_private.h b/src/h5core/h5t_adjacencies_private.h index 882b19c..af5e1f1 100644 --- a/src/h5core/h5t_adjacencies_private.h +++ b/src/h5core/h5t_adjacencies_private.h @@ -19,7 +19,9 @@ h5tpriv_get_adjacencies ( const h5_int32_t dim, h5_loc_idlist_t** list ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, entity_id=%lld, dim=%d, list=0x%p", + f, (long long)entity_id, dim, list); if (f->t->methods.adjacency == NULL) { H5_PRIV_API_LEAVE (h5_error_internal ()); } @@ -31,11 +33,11 @@ static inline h5_err_t h5tpriv_release_adjacency_structs ( h5_file_t* const f ) { - h5_debug ("%s ()", __func__); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); if (f->t->methods.adjacency == NULL) { - return 0; + H5_PRIV_API_LEAVE (H5_OK); } - return (*f->t->methods.adjacency->release_internal_structs)(f); + H5_PRIV_API_RETURN (f->t->methods.adjacency->release_internal_structs(f)); } static inline h5_err_t @@ -43,8 +45,11 @@ h5tpriv_update_adjacency_structs ( h5_file_t* const f, const h5t_lvl_idx_t level_id ) { - h5_debug ("%s (%lld)", __func__, (long long)level_id); - return (*f->t->methods.adjacency->update_internal_structs)(f, level_id); + H5_PRIV_API_ENTER2 (h5_err_t, "f=0x%p, level_id=%d", f, level_id); + if (f->t->methods.adjacency == NULL) { + H5_PRIV_API_LEAVE (H5_OK); + } + H5_PRIV_API_RETURN (f->t->methods.adjacency->update_internal_structs(f, level_id)); } #endif diff --git a/src/h5core/h5t_hsearch.c b/src/h5core/h5t_hsearch.c index ab800dd..2706f90 100644 --- a/src/h5core/h5t_hsearch.c +++ b/src/h5core/h5t_hsearch.c @@ -11,7 +11,9 @@ h5tpriv_search_tv2 ( h5_loc_idx_t elem_idx, // in h5_loc_idlist_t** idlist // out ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5t_fdata_t* t = f->t; h5_loc_idx_t vertex_idx; @@ -75,7 +77,7 @@ h5tpriv_resize_te_htab ( h5_file_t* const f, size_t nel ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, "f=0x%p, nel=%lld", f, (long long)nel); h5t_adjacencies_t* a = &f->t->adjacencies; if ( a->te_hash.size == 0 ) { TRY (h5priv_hcreate ( @@ -97,7 +99,9 @@ h5tpriv_search_te2 ( h5_loc_idx_t elem_idx, h5_loc_idlist_t** idlist ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5t_fdata_t* t = f->t; h5t_adjacencies_t* a = &t->adjacencies; void* __retval; @@ -183,7 +187,9 @@ h5tpriv_find_te ( h5_loc_idx_t edge_id, // in h5_loc_idlist_t** idlist // out ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER3 (h5_err_t, + "f=0x%p, edge_id=%lld, idlist=0x%p", + f, (long long)edge_id, idlist); h5t_te_entry_t item; TRY (h5t_get_vertex_indices_of_edge ( f, @@ -200,7 +206,9 @@ h5tpriv_find_te2 ( h5_loc_idx_t elem_idx, // in h5_loc_idlist_t** idlist // out ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5t_te_entry_t item; TRY (h5t_get_vertex_indices_of_edge2 ( f, @@ -257,7 +265,7 @@ h5tpriv_resize_td_htab ( h5_file_t* const f, size_t nel ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, "f=0x%p, nel=%lld", f, (long long)nel); h5t_adjacencies_t* a = &f->t->adjacencies; if (a->td_hash.size == 0) { TRY (h5priv_hcreate ( @@ -279,7 +287,9 @@ h5tpriv_search_td2 ( h5_loc_idx_t elem_idx, h5_loc_idlist_t** idlist // out ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5t_fdata_t* t = f->t; h5t_adjacencies_t* a = &f->t->adjacencies; void* __retval; @@ -343,7 +353,9 @@ h5tpriv_find_td ( h5_loc_idx_t triangle_id, h5_loc_idlist_t** idlist ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER3 (h5_err_t, + "f=0x%p, triangle_id=%lld, idlist=0x%p", + f, (long long)triangle_id, idlist); h5t_td_entry_t item; TRY (h5t_get_vertex_indices_of_triangle ( f, @@ -360,7 +372,9 @@ h5tpriv_find_td2 ( h5_loc_idx_t elem_idx, h5_loc_idlist_t** idlist ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5t_td_entry_t item; TRY (h5t_get_vertex_indices_of_triangle2 ( f, @@ -381,7 +395,9 @@ h5tpriv_find_tv2 ( h5_loc_idx_t elem_idx, h5_loc_idlist_t** idlist ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER4 (h5_err_t, + "f=0x%p, face_idx=%lld, elem_idx=%lld, idlist=0x%p", + f, (long long)face_idx, (long long)elem_idx, idlist); h5_loc_idx_t idx; TRY (idx = h5tpriv_get_loc_elem_vertex_idx (f, elem_idx, face_idx)); *idlist = f->t->adjacencies.tv.v[idx]; diff --git a/src/h5core/h5t_map.c b/src/h5core/h5t_map.c index 413552e..42a2909 100644 --- a/src/h5core/h5t_map.c +++ b/src/h5core/h5t_map.c @@ -36,7 +36,9 @@ h5tpriv_sort_local_vertex_indices ( h5_loc_idx_t* const indices, /* IN/OUT: local vertex indices */ const h5_size_t size /* size of array */ ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER3 (h5_err_t, + "f=0x%p, indices=0x%p, size=%llu", + f, indices, (long long unsigned)size); h5t_fdata_t* t = f->t; h5_size_t i; diff --git a/src/h5core/h5t_openclose.c b/src/h5core/h5t_openclose.c index ca1faf6..0593391 100644 --- a/src/h5core/h5t_openclose.c +++ b/src/h5core/h5t_openclose.c @@ -322,7 +322,7 @@ h5_err_t h5tpriv_open_file ( h5_file_t* const f /*!< IN: file handle */ ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); TRY (f->t = h5_calloc (1, sizeof (*f->t))); h5t_fdata_t* t = f->t; @@ -343,7 +343,7 @@ h5_err_t h5tpriv_init_step ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); UNUSED_ARGUMENT (f); H5_PRIV_API_RETURN (H5_SUCCESS); } @@ -357,7 +357,7 @@ h5_err_t h5tpriv_close_step ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); UNUSED_ARGUMENT (f); H5_PRIV_API_RETURN (H5_SUCCESS); } @@ -367,7 +367,7 @@ h5_err_t h5tpriv_open_topo_group ( h5_file_t * const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); h5t_fdata_t* t = f->t; if (t->topo_gid == 0 || t->topo_gid == -1) { TRY (t->topo_gid = h5priv_open_group (f, f->root_gid, H5T_CONTAINER_GRPNAME)); @@ -380,7 +380,7 @@ h5tpriv_open_meshes_group ( h5_file_t* const f, const h5_oid_t type_id ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, "f=0x%p, type_id=%d", f, type_id); h5t_fdata_t* t = f->t; if (t->topo_gid < 0) { @@ -405,7 +405,9 @@ h5tpriv_open_mesh_group ( const h5_oid_t type_id, const h5_id_t id ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER3 (h5_err_t, + "f=0x%p, type_id=%d, id=%lld", + f, type_id, (long long)id); h5t_fdata_t* t = f->t; if (t->meshes_gid < 0) { diff --git a/src/h5core/h5t_readwrite.c b/src/h5core/h5t_readwrite.c index 42666fb..ba4ceb8 100644 --- a/src/h5core/h5t_readwrite.c +++ b/src/h5core/h5t_readwrite.c @@ -94,7 +94,7 @@ h5_err_t h5tpriv_write_mesh ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); h5t_fdata_t* t = f->t; if (t->mesh_changed) { TRY (write_vertices (f)); @@ -108,7 +108,7 @@ h5tpriv_write_mesh ( } static h5_ssize_t -read_num_leaf_levels ( +get_num_leaf_levels ( h5_file_t* const f ) { h5t_fdata_t* t = f->t; @@ -116,14 +116,15 @@ read_num_leaf_levels ( hid_t diskspace_id; hssize_t size; - H5_PRIV_FUNC_ENTER (h5_ssize_t); + H5_PRIV_FUNC_ENTER1 (h5_ssize_t, "f=0x%p", f); if (t->cur_mesh < 0) { - return h5tpriv_error_undef_mesh (); + H5_PRIV_FUNC_LEAVE (h5tpriv_error_undef_mesh ()); } TRY (dataset_id = hdf5_open_dataset (t->mesh_gid, "NumVertices") ); TRY (diskspace_id = hdf5_get_dataset_space (dataset_id) ); TRY (size = hdf5_get_npoints_of_dataspace (diskspace_id) ); TRY (hdf5_close_dataspace (diskspace_id) ); + TRY (hdf5_close_dataset (dataset_id)); t->num_leaf_levels = size; H5_PRIV_FUNC_RETURN (size); @@ -272,12 +273,12 @@ h5_err_t h5tpriv_read_mesh ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); h5t_fdata_t* t = f->t; if (t->mesh_gid < 0) { H5_PRIV_API_LEAVE (h5_error_internal ()); } - TRY (read_num_leaf_levels (f)); + TRY (get_num_leaf_levels (f)); TRY (read_num_vertices (f)); TRY (read_vertices (f)); diff --git a/src/h5core/h5t_tags.c b/src/h5core/h5t_tags.c index 08a02f4..78f3a89 100644 --- a/src/h5core/h5t_tags.c +++ b/src/h5core/h5t_tags.c @@ -82,7 +82,7 @@ h5_err_t h5tpriv_release_tags ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); h5t_fdata_t* t = f->t; TRY (release_container (&t->mtags)); H5_PRIV_API_RETURN (H5_SUCCESS); @@ -973,7 +973,7 @@ h5_err_t h5tpriv_write_mtags ( h5_file_t* const f ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER1 (h5_err_t, "f=0x%p", f); h5t_fdata_t* t = f->t; TRY (t->mtags.group_id = h5priv_open_group (f, t->mesh_gid, "Tags")); TRY (write_container (f, &f->t->mtags)); @@ -1086,7 +1086,7 @@ h5tpriv_read_tag_container ( h5_file_t* const f, h5t_tagcontainer_t* ctn ) { - H5_PRIV_API_ENTER (h5_err_t); + H5_PRIV_API_ENTER2 (h5_err_t, "f=0x%p, ctn=0x%p", f, ctn); size_t num_sets; TRY (num_sets = hdf5_get_num_objs_in_group (ctn->group_id)); hsize_t idx; diff --git a/src/include/h5core/h5_errorhandling.h b/src/include/h5core/h5_errorhandling.h index d37d649..adb584f 100644 --- a/src/include/h5core/h5_errorhandling.h +++ b/src/include/h5core/h5_errorhandling.h @@ -287,9 +287,9 @@ h5_debug ( ... ) { if (h5_debug_level >= 4) { - char prefix[256]; - snprintf (prefix, sizeof(prefix), "(%d) %s", - h5_call_stack_get_level(), + char prefix[1024]; + snprintf (prefix, sizeof(prefix), "%*s %s", + h5_call_stack_get_level(), "", h5_call_stack_get_name()); va_list ap; va_start (ap, fmt);