Exemplo n.º 1
0
/*--------------------------------------------------------------------------
 NAME
    H5O_attr_debug
 PURPOSE
    Prints debugging information for an attribute message
 USAGE
    void *H5O_attr_debug(f, mesg, stream, indent, fwidth)
        H5F_t *f;               IN: pointer to the HDF5 file struct
        const void *mesg;       IN: Pointer to the source attribute struct
        FILE *stream;           IN: Pointer to the stream for output data
        int indent;            IN: Amount to indent information by
        int fwidth;            IN: Field width (?)
 RETURNS
    Non-negative on success/Negative on failure
 DESCRIPTION
        This function prints debugging output to the stream passed as a
    parameter.
--------------------------------------------------------------------------*/
static herr_t
H5O_attr_debug(H5F_t *f, hid_t dxpl_id, const void *_mesg, FILE * stream, int indent,
	       int fwidth)
{
    const H5A_t *mesg = (const H5A_t *)_mesg;
    H5O_shared_t	sh_mesg;        /* Shared message information */
    void *dt_mesg;                      /* Pointer to datatype message to dump */
    herr_t      (*debug)(H5F_t*, hid_t, const void*, FILE*, int, int)=NULL;
    herr_t ret_value=SUCCEED;   /* Return value */

    FUNC_ENTER_NOAPI_NOINIT(H5O_attr_debug);

    /* check args */
    assert(f);
    assert(stream);
    assert(indent >= 0);
    assert(fwidth >= 0);

    fprintf(stream, "%*s%-*s \"%s\"\n", indent, "", fwidth,
	    "Name:",
	    mesg->name);
    fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
	    "Initialized:",
	    (unsigned int)mesg->initialized);
    fprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
	    "Opened:",
	    (unsigned int)mesg->ent_opened);
    fprintf(stream, "%*sSymbol table entry...\n", indent, "");
    H5G_ent_debug(f, dxpl_id, &(mesg->ent), stream, indent+3, MAX(0, fwidth-3),
		  HADDR_UNDEF);

    fprintf(stream, "%*sData type...\n", indent, "");
    fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX(0,fwidth-3),
	    "Size:",
	    (unsigned long)(mesg->dt_size));
    fprintf (stream, "%*s%-*s %s\n", indent+3, "", MAX(0,fwidth-3),
               "Shared:",
               (H5T_committed(mesg->dt) ? "Yes" : "No")
               );
    if(H5T_committed(mesg->dt)) {
        /* Reset shared message information */
        HDmemset(&sh_mesg,0,sizeof(H5O_shared_t));

        /* Get shared message information from datatype */
        if ((H5O_MSG_DTYPE->get_share)(f, mesg->dt, &sh_mesg/*out*/)<0)
            HGOTO_ERROR(H5E_ATTR, H5E_CANTENCODE, FAIL, "can't retrieve shared message information");

        debug=H5O_MSG_SHARED->debug;
        dt_mesg=&sh_mesg;
    } /* end if */
    else {
        debug=H5O_MSG_DTYPE->debug;
        dt_mesg=mesg->dt;
    } /* end else */
    if(debug)
        (debug)(f, dxpl_id, dt_mesg, stream, indent+3, MAX(0, fwidth-3));
    else
        fprintf(stream, "%*s<No info for this message>\n", indent + 6, "");

    fprintf(stream, "%*sData space...\n", indent, "");
    fprintf(stream, "%*s%-*s %lu\n", indent+3, "", MAX(0,fwidth-3),
	    "Size:",
	    (unsigned long)(mesg->ds_size));
    H5S_debug(f, dxpl_id, mesg->ds, stream, indent+3, MAX(0, fwidth-3));

done:
    FUNC_LEAVE_NOAPI(ret_value);
}
Exemplo n.º 2
0
/*-------------------------------------------------------------------------
 * Function:	H5F_debug
 *
 * Purpose:	Prints a file header to the specified stream.  Each line
 *		is indented and the field name occupies the specified width
 *		number of characters.
 *
 * Errors:
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Robb Matzke
 *		[email protected]
 *		Aug  1 1997
 *
 * Modifications:
 *		Robb Matzke, 1999-07-28
 *		The ADDR argument is passed by value.
 *
 *		Raymond Lu, 2001-10-14
 * 		Changed to the new generic property list.
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5F_debug(H5F_t *f, hid_t dxpl_id, FILE * stream, int indent, int fwidth)
{
    hsize_t userblock_size;
    int     super_vers, freespace_vers, obj_dir_vers, share_head_vers;
    H5P_genplist_t *plist;              /* Property list */
    herr_t      ret_value=SUCCEED;       /* Return value */

    FUNC_ENTER_NOAPI(H5F_debug, FAIL)

    /* check args */
    assert(f);
    assert(stream);
    assert(indent >= 0);
    assert(fwidth >= 0);

    /* Get property list */
    if(NULL == (plist = H5I_object(f->shared->fcpl_id)))
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")

        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_SUPER_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 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 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,
              "File access flags",
              (unsigned) (f->shared->flags));
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "File open reference count:",
              (unsigned) (f->shared->nrefs));
    HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
              "Address of super block:", f->shared->super_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 offsets (haddr_t type):", (unsigned) f->shared->sizeof_addr);
    HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
              "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:",
              f->shared->btree_k[H5B_SNODE_ID]);
    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:",
              f->shared->root_grp ? "" : "(none)");
    if (f->shared->root_grp) {
        H5G_ent_debug(f, dxpl_id, H5G_entof(f->shared->root_grp), stream,
                      indent+3, MAX(0, fwidth-3), HADDR_UNDEF);
    }

done:
    FUNC_LEAVE_NOAPI(ret_value)
}
Exemplo n.º 3
0
/*-------------------------------------------------------------------------
 * Function:	H5F_debug
 *
 * Purpose:	Prints a file header to the specified stream.  Each line
 *		is indented and the field name occupies the specified width
 *		number of characters.
 *
 * Return:	Non-negative on success/Negative on failure
 *
 * Programmer:	Robb Matzke
 *		[email protected]
 *		Aug  1 1997
 *
 *-------------------------------------------------------------------------
 */
herr_t
H5F_debug(H5F_t *f, FILE *stream, int indent, int fwidth)
{
    H5P_genplist_t *plist;              /* File creation property list */
    hsize_t userblock_size;             /* Userblock size */
    herr_t ret_value = SUCCEED;         /* Return value */

    FUNC_ENTER_NOAPI(H5F_debug, FAIL)

    /* check args */
    HDassert(f);
    HDassert(stream);
    HDassert(indent >= 0);
    HDassert(fwidth >= 0);

    /* Get property list */
    if(NULL == (plist = (H5P_genplist_t *)H5I_object(f->shared->fcpl_id)))
        HGOTO_ERROR(H5E_ARGS, H5E_BADTYPE, FAIL, "not a property list")

        /* Retrieve file creation properties */
        if(H5P_get(plist, H5F_CRT_USER_BLOCK_NAME, &userblock_size) < 0)
            HGOTO_ERROR(H5E_PLIST, H5E_CANTGET, FAIL, "can't get userblock size")

            /* debug */
            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,
              "File access flags", f->shared->flags);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "File open reference count:", f->shared->nrefs);
    HDfprintf(stream, "%*s%-*s %a (abs)\n", indent, "", fwidth,
              "Address of super block:", f->shared->sblock->base_addr);
    HDfprintf(stream, "%*s%-*s %Hu bytes\n", indent, "", fwidth,
              "Size of userblock:", userblock_size);

    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Superblock version number:", f->shared->sblock->super_vers);

    /* Hard-wired versions */
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Free list version number:", (unsigned)HDF5_FREESPACE_VERSION);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Root group symbol table entry version number:", (unsigned)HDF5_OBJECTDIR_VERSION);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Shared header version number:", (unsigned)HDF5_SHAREDHEADER_VERSION);

    HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
              "Size of file offsets (haddr_t type):", (unsigned) f->shared->sizeof_addr);
    HDfprintf(stream, "%*s%-*s %u bytes\n", indent, "", fwidth,
              "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->sblock->sym_leaf_k);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Symbol table internal node 1/2 rank:", f->shared->sblock->btree_k[H5B_SNODE_ID]);
    HDfprintf(stream, "%*s%-*s 0x%02x\n", indent, "", fwidth,
              "File status flags:", (unsigned)(f->shared->sblock->status_flags));
    HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
              "Superblock extension address:", f->shared->sblock->ext_addr);
    HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
              "Shared object header message table address:", f->shared->sohm_addr);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Shared object header message version number:", (unsigned) f->shared->sohm_vers);
    HDfprintf(stream, "%*s%-*s %u\n", indent, "", fwidth,
              "Number of shared object header message indexes:", (unsigned) f->shared->sohm_nindexes);

    HDfprintf(stream, "%*s%-*s %a (rel)\n", indent, "", fwidth,
              "Address of driver information block:", f->shared->sblock->driver_addr);

    HDfprintf(stream, "%*s%-*s %s\n", indent, "", fwidth,
              "Root group symbol table entry:",
              f->shared->root_grp ? "" : "(none)");
    if(f->shared->root_grp) {
        if(f->shared->sblock->root_ent) /* Use real root group symbol table entry */
            H5G_ent_debug(f, f->shared->sblock->root_ent, stream, indent + 3,
                          MAX(0, fwidth - 3), NULL);
        else {
            H5O_loc_t *root_oloc;   /* Root object location */
            H5G_entry_t root_ent;   /* Constructed root symbol table entry */

            /* Reset the root group entry */
            H5G_ent_reset(&root_ent);

            /* Build up a simulated root group symbol table entry */
            root_oloc = H5G_oloc(f->shared->root_grp);
            HDassert(root_oloc);
            root_ent.type = H5G_NOTHING_CACHED;
            root_ent.header = root_oloc->addr;
            root_ent.file = f;

            /* Display root group symbol table entry info */
            H5G_ent_debug(f, &root_ent, stream, indent + 3, MAX(0, fwidth - 3), NULL);
        } /* end else */
    } /* end if */

done:
    FUNC_LEAVE_NOAPI(ret_value)
} /* end H5F_debug() */