diff options
Diffstat (limited to 'tools/src/misc')
-rw-r--r-- | tools/src/misc/h5debug.c | 59 |
1 files changed, 33 insertions, 26 deletions
diff --git a/tools/src/misc/h5debug.c b/tools/src/misc/h5debug.c index 72f826e..7e00b4f 100644 --- a/tools/src/misc/h5debug.c +++ b/tools/src/misc/h5debug.c @@ -38,6 +38,7 @@ #include "H5private.h" /* Generic Functions */ #include "H5Apkg.h" /* Attributes */ #include "H5B2pkg.h" /* v2 B-trees */ +#include "H5CXprivate.h" /* API Contexts */ #include "H5Dpkg.h" /* Datasets */ #include "H5Eprivate.h" /* Error handling */ #include "H5EApkg.h" /* Extensible Arrays */ @@ -247,13 +248,14 @@ get_H5FA_class(const uint8_t *sig) int main(int argc, char *argv[]) { - hid_t fid, fapl, dxpl; + hid_t fid, fapl; H5F_t *f; haddr_t addr = 0, extra = 0, extra2 = 0, extra3 = 0, extra4 = 0; uint8_t sig[H5F_SIGNATURE_LEN]; size_t u; H5E_auto2_t func; void *edata; +hbool_t api_ctx_pushed = FALSE; /* Whether API context pushed */ herr_t status = SUCCEED; if(argc == 1) { @@ -274,7 +276,6 @@ main(int argc, char *argv[]) /* * Open the file and get the file descriptor. */ - dxpl = H5AC_ind_read_dxpl_id; if((fapl = H5Pcreate(H5P_FILE_ACCESS)) < 0) { HDfprintf(stderr, "cannot create file access property list\n"); HDexit(1); @@ -288,6 +289,11 @@ main(int argc, char *argv[]) HDfprintf(stderr, "cannot open file\n"); HDexit(1); } /* end if */ +if(H5CX_push() < 0) { + HDfprintf(stderr, "cannot set API context\n"); + HDexit(1); +} +api_ctx_pushed = TRUE; if(NULL == (f = (H5F_t *)H5I_object(fid))) { HDfprintf(stderr, "cannot obtain H5F_t pointer\n"); HDexit(2); @@ -317,7 +323,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), dxpl, sig) < 0) { + if(H5F_block_read(f, H5FD_MEM_SUPER, addr, sizeof(sig), sig) < 0) { HDfprintf(stderr, "cannot read signature\n"); HDexit(3); } @@ -331,13 +337,13 @@ main(int argc, char *argv[]) /* * Debug a local heap. */ - status = H5HL_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5HL_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp (sig, H5HG_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a global heap collection. */ - status = H5HG_debug (f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5HG_debug (f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5G_NODE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -351,7 +357,7 @@ main(int argc, char *argv[]) HDfprintf(stderr, "\th5debug <filename> <Symbol table node address> <address of local heap>\n\n"); } /* end if */ - status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); } else if(!HDmemcmp(sig, H5B_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -373,7 +379,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5G_node_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra); + status = H5G_node_debug(f, addr, stdout, 0, VCOL, extra); break; case H5B_CHUNK_ID: @@ -411,7 +417,7 @@ main(int argc, char *argv[]) /* Set the last dimension (the element size) to zero */ dim[ndims] = 0; - status = H5D_btree_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, ndims, dim); + status = H5D_btree_debug(f, addr, stdout, 0, VCOL, ndims, dim); break; case H5B_NUM_BTREE_ID: @@ -434,7 +440,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, (haddr_t)extra); + status = H5B2__hdr_debug(f, addr, stdout, 0, VCOL, cls, (haddr_t)extra); } else if(!HDmemcmp(sig, H5B2_INT_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -461,7 +467,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2__int_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); + status = H5B2__int_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (unsigned)extra3, (haddr_t)extra4); } else if(!HDmemcmp(sig, H5B2_LEAF_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -486,13 +492,13 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5B2__leaf_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); + status = H5B2__leaf_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, (haddr_t)extra3); } else if(!HDmemcmp(sig, H5HF_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a fractal heap header. */ - status = H5HF_hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5HF_hdr_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5HF_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -507,7 +513,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5HF_dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (size_t)extra2); + status = H5HF_dblock_debug(f, addr, stdout, 0, VCOL, extra, (size_t)extra2); } else if(!HDmemcmp(sig, H5HF_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -522,14 +528,14 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5HF_iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, (unsigned)extra2); + status = H5HF_iblock_debug(f, addr, stdout, 0, VCOL, extra, (unsigned)extra2); } else if(!HDmemcmp(sig, H5FS_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug a free space header. */ - status = H5FS_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5FS_debug(f, addr, stdout, 0, VCOL); } else if(!HDmemcmp(sig, H5FS_SINFO_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -544,14 +550,14 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FS_sects_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, extra, extra2); + status = H5FS_sects_debug(f, addr, stdout, 0, VCOL, extra, extra2); } else if(!HDmemcmp(sig, H5SM_TABLE_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug shared message master table. */ - status = H5SM_table_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); + status = H5SM_table_debug(f, addr, stdout, 0, VCOL, (unsigned) UFAIL, (unsigned) UFAIL); } else if(!HDmemcmp(sig, H5SM_LIST_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -566,7 +572,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5SM_list_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, (haddr_t)extra); + status = H5SM_list_debug(f, addr, stdout, 0, VCOL, (haddr_t)extra); } else if(!HDmemcmp(sig, H5EA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -583,7 +589,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra); + status = H5EA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); } else if(!HDmemcmp(sig, H5EA_IBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -600,7 +606,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__iblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5EA__iblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); } else if(!HDmemcmp(sig, H5EA_SBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -617,7 +623,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__sblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); + status = H5EA__sblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (unsigned)extra2, extra3); } else if(!HDmemcmp(sig, H5EA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -634,7 +640,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5EA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); + status = H5EA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2, extra3); } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -651,7 +657,7 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FA__hdr_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra); + status = H5FA__hdr_debug(f, addr, stdout, 0, VCOL, cls, extra); } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* @@ -668,21 +674,21 @@ main(int argc, char *argv[]) HDexit(4); } /* end if */ - status = H5FA__dblock_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL, cls, extra, extra2); + status = H5FA__dblock_debug(f, addr, stdout, 0, VCOL, cls, extra, extra2); } else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) { /* * Debug v2 object header (which have signatures). */ - status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5O_debug(f, addr, stdout, 0, VCOL); } else if(sig[0] == H5O_VERSION_1) { /* * This could be a v1 object header. Since they don't have a signature * it's a somewhat "ify" detection. */ - status = H5O_debug(f, H5AC_ind_read_dxpl_id, addr, stdout, 0, VCOL); + status = H5O_debug(f, addr, stdout, 0, VCOL); } else { /* @@ -713,6 +719,7 @@ main(int argc, char *argv[]) H5Pclose(fapl); H5Fclose(fid); +if(api_ctx_pushed) H5CX_pop(); H5Eset_auto2(H5E_DEFAULT, func, edata); |