summaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorQuincey Koziol <koziol@hdfgroup.org>2009-07-03 04:22:31 (GMT)
committerQuincey Koziol <koziol@hdfgroup.org>2009-07-03 04:22:31 (GMT)
commit1521b1dd1b00808da0f03f9b5e312100e8f83ee4 (patch)
tree4ac2fb3286b250524edb97dbbceffdaab60d8861 /tools
parente844def040da6235cf37ce7feb136720e423edb4 (diff)
downloadhdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.zip
hdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.tar.gz
hdf5-1521b1dd1b00808da0f03f9b5e312100e8f83ee4.tar.bz2
[svn-r17155] Description:
Bring r17154 from 'revise_chunks' branch to trunk: Add fixed array data structure. (For initial use as a chunk index) Tested on: FreeBSD/32 6.3 (duty) in debug mode FreeBSD/64 6.3 (liberty) w/C++ & FORTRAN, in debug mode Linux/32 2.6 (jam) w/PGI compilers, w/C++ & FORTRAN, w/threadsafe, in debug mode Linux/64-amd64 2.6 (smirom) w/Intel compilers w/default API=1.6.x, w/C++ & FORTRAN, in production mode Solaris/32 2.10 (linew) w/deprecated symbols disabled, w/C++ & FORTRAN, w/szip filter, in production mode Linux/64-ia64 2.6 (cobalt) w/Intel compilers, w/C++ & FORTRAN, in production mode Linux/64-ia64 2.4 (tg-login3) w/parallel, w/FORTRAN, in debug mode Linux/64-amd64 2.6 (abe) w/parallel, w/FORTRAN, in production mode Mac OS X/32 10.5.7 (amazon) in debug mode Mac OS X/32 10.5.7 (amazon) w/C++ & FORTRAN, w/threadsafe, in production mode
Diffstat (limited to 'tools')
-rw-r--r--tools/misc/h5debug.c72
1 files changed, 72 insertions, 0 deletions
diff --git a/tools/misc/h5debug.c b/tools/misc/h5debug.c
index 77cd9b2..9eabe5a 100644
--- a/tools/misc/h5debug.c
+++ b/tools/misc/h5debug.c
@@ -30,6 +30,8 @@
#define H5B2_TESTING /*suppress warning about H5B2 testing funcs*/
#define H5EA_PACKAGE /*suppress error about including H5EApkg */
#define H5EA_TESTING /*suppress warning about H5EA testing funcs*/
+#define H5FA_PACKAGE /*suppress error about including H5FApkg */
+#define H5FA_TESTING /*suppress warning about H5FA testing funcs*/
#define H5F_PACKAGE /*suppress error about including H5Fpkg */
#define H5G_PACKAGE /*suppress error about including H5Gpkg */
#define H5HF_PACKAGE /*suppress error about including H5HFpkg */
@@ -42,6 +44,7 @@
#include "H5Dprivate.h" /* Datasets */
#include "H5Eprivate.h" /* Error handling */
#include "H5EApkg.h" /* Extensible Arrays */
+#include "H5FApkg.h" /* Fixed Arrays */
#include "H5Fpkg.h" /* File access */
#include "H5FSprivate.h" /* Free space manager */
#include "H5Gpkg.h" /* Groups */
@@ -164,6 +167,41 @@ get_H5EA_class(const uint8_t *sig)
/*-------------------------------------------------------------------------
+ * Function: get_H5FA_class
+ *
+ * Purpose: Determine the fixed array class from the buffer read in.
+ * Extensible arrays are debugged through the array subclass.
+ * The subclass identifier is two bytes after the signature.
+ *
+ * Return: Non-NULL on success/NULL on failure
+ *
+ * Programmer: Quincey Koziol
+ * koziol@hdfgroup.org
+ * Sep 11 2008
+ *
+ *-------------------------------------------------------------------------
+ */
+static const H5FA_class_t *
+get_H5FA_class(const uint8_t *sig)
+{
+ H5FA_cls_id_t clsid = (H5FA_cls_id_t)sig[H5_SIZEOF_MAGIC + 1];
+ const H5FA_class_t *cls;
+
+ switch(clsid) {
+ case H5FA_CLS_TEST_ID:
+ cls = H5FA_CLS_TEST;
+ break;
+
+ default:
+ fprintf(stderr, "Unknown array class %u\n", (unsigned)(clsid));
+ HDexit(4);
+ } /* end switch */
+
+ return(cls);
+} /* end get_H5FA_class() */
+
+
+/*-------------------------------------------------------------------------
* Function: main
*
* Usage: debug FILENAME [OFFSET]
@@ -494,6 +532,40 @@ main(int argc, char *argv[])
status = H5EA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2);
+ } else if(!HDmemcmp(sig, H5FA_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fixed array header.
+ */
+ const H5FA_class_t *cls = get_H5FA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0) {
+ fprintf(stderr, "ERROR: Need object header address containing the layout messagein order to dump header\n");
+ fprintf(stderr, "Fixed array header block usage:\n");
+ fprintf(stderr, "\th5debug <filename> <Fixed Array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FA__hdr_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra);
+
+ } else if(!HDmemcmp(sig, H5FA_DBLOCK_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
+ /*
+ * Debug a fixed array data block.
+ */
+ const H5FA_class_t *cls = get_H5FA_class(sig);
+ HDassert(cls);
+
+ /* Check for enough valid parameters */
+ if(extra == 0 || extra2 == 0) {
+ fprintf(stderr, "ERROR: Need fixed array header address and object header address containing the layout message in order to dump data block\n");
+ fprintf(stderr, "fixed array data block usage:\n");
+ fprintf(stderr, "\th5debug <filename> <data block address> <array header address> <object header address>\n");
+ HDexit(4);
+ } /* end if */
+
+ status = H5FA__dblock_debug(f, H5P_DATASET_XFER_DEFAULT, addr, stdout, 0, VCOL, cls, extra, (size_t)extra2);
+
} else if(!HDmemcmp(sig, H5O_HDR_MAGIC, (size_t)H5_SIZEOF_MAGIC)) {
/*
* Debug v2 object header (which have signatures).