diff options
-rw-r--r-- | src/H5B.c | 8 | ||||
-rw-r--r-- | src/H5F.c | 58 | ||||
-rw-r--r-- | src/H5Gent.c | 71 | ||||
-rw-r--r-- | src/H5Gnode.c | 5 | ||||
-rw-r--r-- | src/H5O.c | 10 | ||||
-rw-r--r-- | tools/misc/h5debug.c | 25 |
6 files changed, 105 insertions, 72 deletions
@@ -2109,15 +2109,19 @@ H5B_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f /* If there is a key debugging routine, use it to display the left & right keys */ if (type->debug_key) { /* Decode the 'left' key & print it */ + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + "Left Key:"); if(bt->key[i].nkey==NULL) H5B_decode_key(f, bt, i); - (type->debug_key)(stream, f, dxpl_id, indent+3, MAX (0, fwidth-3), + (type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), bt->key[i].nkey, udata); /* Decode the 'right' key & print it */ + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + "Right Key:"); if(bt->key[i+1].nkey==NULL) H5B_decode_key(f, bt, i+1); - (type->debug_key)(stream, f, dxpl_id, indent+3, MAX (0, fwidth-3), + (type->debug_key)(stream, f, dxpl_id, indent+6, MAX (0, fwidth-6), bt->key[i+1].nkey, udata); } } @@ -4125,7 +4125,7 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE * stream, int inden int fwidth) { hsize_t userblock_size; - int boot_vers, freespace_vers, obj_dir_vers, share_head_vers; + int super_vers, freespace_vers, obj_dir_vers, share_head_vers; H5P_genplist_t *plist; /* Property list */ herr_t ret_value=SUCCEED; /* Return value */ @@ -4144,59 +4144,59 @@ H5F_debug(H5F_t *f, hid_t dxpl_id, haddr_t UNUSED addr, FILE * stream, int inden if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get user block size"); - - if(H5P_get(plist, H5F_CRT_BOOT_VERS_NAME, &boot_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get boot block version"); + if(H5P_get(plist, H5F_CRT_BOOT_VERS_NAME, &super_vers)<0) + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version"); if(H5P_get(plist, H5F_CRT_FREESPACE_VERS_NAME, &freespace_vers)<0) - HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get boot block version"); + HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get super block version"); if(H5P_get(plist, H5F_CRT_OBJ_DIR_VERS_NAME, &obj_dir_vers)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get object directory version"); if(H5P_get(plist, H5F_CRT_SHARE_HEAD_VERS_NAME, &share_head_vers)<0) HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get shared-header format version"); /* debug */ - HDfprintf(stream, "%*sFile Boot Block...\n", indent, ""); + HDfprintf(stream, "%*sFile Super Block...\n", indent, ""); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "File name:", f->name); HDfprintf(stream, "%*s%-*s 0x%08x\n", indent, "", fwidth, - "Flags", + "File access flags", (unsigned) (f->shared->flags)); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Reference count:", + "File open reference count:", (unsigned) (f->shared->nrefs)); - HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth, - "Consistency flags:", - (unsigned long) (f->shared->consist_flags)); - HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, - "Address of boot block:", f->shared->boot_addr); HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, - "Base address:", f->shared->base_addr); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, - "Free list address:", f->shared->freespace_addr); - HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, - "Driver information block:", f->shared->driver_addr); - + "Address of super block:", f->shared->boot_addr); HDfprintf(stream, "%*s%-*s %lu bytes\n", indent, "", fwidth, "Size of user block:", (unsigned long) userblock_size); + + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Super block version number:", (unsigned) super_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Free list version number:", (unsigned) freespace_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Root group symbol table entry version number:", (unsigned) obj_dir_vers); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, + "Shared header version number:", (unsigned) share_head_vers); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file size_t type:", (unsigned) f->shared->sizeof_size); + "Size of file offsets (haddr_t type):", (unsigned) f->shared->sizeof_addr); HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth, - "Size of file haddr_t type:", (unsigned) f->shared->sizeof_addr); + "Size of file lengths (hsize_t type):", (unsigned) f->shared->sizeof_size); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Symbol table leaf node 1/2 rank:", f->shared->sym_leaf_k); HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Symbol table internal node 1/2 rank:", (unsigned) (f->shared->btree_k[H5B_SNODE_ID])); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Boot block version number:", (unsigned) boot_vers); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Free list version number:", (unsigned) freespace_vers); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Object directory version number:", (unsigned) obj_dir_vers); - HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, - "Shared header version number:", (unsigned) share_head_vers); + HDfprintf(stream, "%*s%-*s 0x%08lx\n", indent, "", fwidth, + "File consistency flags:", + (unsigned long) (f->shared->consist_flags)); + HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth, + "Base address:", f->shared->base_addr); + HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + "Free list address:", f->shared->freespace_addr); + + HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth, + "Address of driver information block:", f->shared->driver_addr); HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth, "Root group symbol table entry:", diff --git a/src/H5Gent.c b/src/H5Gent.c index 60ad89b..ab505fb 100644 --- a/src/H5Gent.c +++ b/src/H5Gent.c @@ -434,10 +434,15 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str int indent, int fwidth, haddr_t heap) { const char *lval = NULL; + int nested_indent, nested_fwidth; herr_t ret_value=SUCCEED; /* Return value */ FUNC_ENTER_NOAPI(H5G_ent_debug, FAIL); + /* Calculate the indent & field width values for nested information */ + nested_indent=indent+3; + nested_fwidth=MAX(0,fwidth-3); + HDfprintf(stream, "%*s%-*s %lu\n", indent, "", fwidth, "Name offset into private heap:", (unsigned long) (ent->name_off)); @@ -449,38 +454,42 @@ H5G_ent_debug(H5F_t UNUSED *f, hid_t dxpl_id, const H5G_entry_t *ent, FILE * str "Dirty:", ent->dirty ? "Yes" : "No"); HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, - "Symbol type:"); + "Cache info type:"); switch (ent->type) { - case H5G_NOTHING_CACHED: - HDfprintf(stream, "Nothing Cached\n"); - break; - - case H5G_CACHED_STAB: - HDfprintf(stream, "Symbol Table\n"); - - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "B-tree address:", ent->cache.stab.btree_addr); - - HDfprintf(stream, "%*s%-*s %a\n", indent, "", fwidth, - "Heap address:", ent->cache.stab.heap_addr); - break; - - case H5G_CACHED_SLINK: - HDfprintf (stream, "Symbolic Link\n"); - HDfprintf (stream, "%*s%-*s %lu\n", indent, "", fwidth, - "Link value offset:", - (unsigned long)(ent->cache.slink.lval_offset)); - if (H5F_addr_defined(heap)) { - lval = H5HL_peek (ent->file, dxpl_id, heap, ent->cache.slink.lval_offset); - HDfprintf (stream, "%*s%-*s %s\n", indent, "", fwidth, - "Link value:", - lval); - } - break; - - default: - HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type); - break; + case H5G_NOTHING_CACHED: + HDfprintf(stream, "Nothing Cached\n"); + break; + + case H5G_CACHED_STAB: + HDfprintf(stream, "Symbol Table\n"); + + HDfprintf(stream, "%*s%-*s\n", indent, "", fwidth, + "Cached entry information:"); + HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + "B-tree address:", ent->cache.stab.btree_addr); + + HDfprintf(stream, "%*s%-*s %a\n", nested_indent, "", nested_fwidth, + "Heap address:", ent->cache.stab.heap_addr); + break; + + case H5G_CACHED_SLINK: + HDfprintf (stream, "Symbolic Link\n"); + HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, + "Cached information:\n"); + HDfprintf (stream, "%*s%-*s %lu\n", nested_indent, "", nested_fwidth, + "Link value offset:", + (unsigned long)(ent->cache.slink.lval_offset)); + if (H5F_addr_defined(heap)) { + lval = H5HL_peek (ent->file, dxpl_id, heap, ent->cache.slink.lval_offset); + HDfprintf (stream, "%*s%-*s %s\n", nested_indent, "", nested_fwidth, + "Link value:", + lval); + } + break; + + default: + HDfprintf(stream, "*** Unknown symbol type %d\n", ent->type); + break; } done: diff --git a/src/H5Gnode.c b/src/H5Gnode.c index 1a153d5..a1f7762 100644 --- a/src/H5Gnode.c +++ b/src/H5Gnode.c @@ -232,7 +232,10 @@ H5G_node_debug_key (FILE *stream, H5F_t *f, hid_t dxpl_id, int indent, int fwidt FUNC_ENTER_NOAPI(H5G_node_debug_key, FAIL); assert (key); - HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name :"); + HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth, "Heap offset:", + (unsigned)key->offset); + + HDfprintf(stream, "%*s%-*s ", indent, "", fwidth, "Name:"); if (NULL == (s = H5HL_peek(f, dxpl_id, udata->heap_addr, key->offset))) HGOTO_ERROR(H5E_SYM, H5E_NOTFOUND, FAIL, "unable to read symbol name"); HDfprintf (stream, "%s\n", s); @@ -3085,7 +3085,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f size_t mesg_total = 0, chunk_total = 0; int *sequence; haddr_t tmp_addr; - herr_t ret_value = FAIL; + herr_t ret_value = SUCCEED; void *(*decode)(H5F_t*, hid_t, const uint8_t*, H5O_shared_t*); herr_t (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int)=NULL; @@ -3161,7 +3161,7 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f /* message name and size */ HDfprintf(stream, "%*s%-*s 0x%04x %s(%d)\n", indent + 3, "", MAX(0, fwidth - 3), - "Message ID:", + "Message ID (sequence number):", (unsigned) (oh->mesg[i].type->id), oh->mesg[i].type->name, sequence[oh->mesg[i].type->id]++); @@ -3207,10 +3207,12 @@ H5O_debug(H5F_t *f, hid_t dxpl_id, haddr_t addr, FILE *stream, int indent, int f debug = NULL; /* print the message */ + HDfprintf(stream, "%*s%-*s\n", indent + 3, "", MAX(0, fwidth - 3), + "Message Information:"); if (debug) - (debug)(f, dxpl_id, oh->mesg[i].native, stream, indent+3, MAX(0, fwidth-3)); + (debug)(f, dxpl_id, oh->mesg[i].native, stream, indent+6, MAX(0, fwidth-6)); else - HDfprintf(stream, "%*sNo info for this message.\n", indent + 3, ""); + HDfprintf(stream, "%*s<No info for this message>\n", indent + 6, ""); /* If the message is shared then also print the pointed-to message */ if (oh->mesg[i].flags & H5O_FLAG_SHARED) { diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c index c532e5d..145c553 100644 --- a/tools/misc/h5debug.c +++ b/tools/misc/h5debug.c @@ -54,7 +54,7 @@ int main(int argc, char *argv[]) { - hid_t fid, plist=H5P_DEFAULT; + hid_t fid, fapl, dxpl; H5F_t *f; haddr_t addr=0, extra=0; uint8_t sig[16]; @@ -67,14 +67,27 @@ main(int argc, char *argv[]) HDexit(1); } + /* Initialize the library */ + if(H5open ()<0) { + fprintf(stderr, "cannot initialize the library\n"); + HDexit(1); + } + /* * Open the file and get the file descriptor. */ + if((dxpl = H5Pcreate (H5P_DATASET_XFER))<0) { + fprintf(stderr, "cannot create dataset transfer property list\n"); + HDexit(1); + } + if((fapl = H5Pcreate (H5P_FILE_ACCESS))<0) { + fprintf(stderr, "cannot create file access property list\n"); + HDexit(1); + } if (strchr (argv[1], '%')) { - plist = H5Pcreate (H5P_FILE_ACCESS); - H5Pset_fapl_family (plist, (hsize_t)0, H5P_DEFAULT); + H5Pset_fapl_family (fapl, (hsize_t)0, H5P_DEFAULT); } - if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, plist)) < 0) { + if ((fid = H5Fopen(argv[1], H5F_ACC_RDONLY, fapl)) < 0) { fprintf(stderr, "cannot open file\n"); HDexit(1); } @@ -97,7 +110,7 @@ main(int argc, char *argv[]) * Read the signature at the specified file position. */ HDfprintf(stdout, "Reading signature at address %a (rel)\n", addr); - if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), H5P_DEFAULT, sig)<0) { + if (H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), dxpl, sig)<0) { fprintf(stderr, "cannot read signature\n"); HDexit(3); } @@ -180,6 +193,8 @@ main(int argc, char *argv[]) fprintf(stderr, "An error occurred\n"); HDexit(5); } + H5Pclose(dxpl); + H5Pclose(fapl); H5Fclose(fid); return 0; } |