summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRobb Matzke <matzke@llnl.gov>1998-08-19 22:46:31 (GMT)
committerRobb Matzke <matzke@llnl.gov>1998-08-19 22:46:31 (GMT)
commite455040749ca1d47fb218b9bb35d78247fb9561d (patch)
tree2d26f2ae1fea1ff393f00eb36e3f2155dec690b6
parent4322bfe90ab7de7245ff770155867fa5da78147c (diff)
downloadhdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.zip
hdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.tar.gz
hdf5-e455040749ca1d47fb218b9bb35d78247fb9561d.tar.bz2
[svn-r606] Debugging can be enabled/disabled at runtime though code is still
conditionally included at compile time. Tracing and debugging share the same environment variable. All is documented in Debugging.html.
-rw-r--r--INSTALL8
-rw-r--r--MANIFEST2
-rw-r--r--doc/html/Debugging.html408
-rw-r--r--doc/html/H5.user.html4
-rw-r--r--doc/html/tracing.html193
-rw-r--r--src/.distdep624
-rw-r--r--src/H5.c137
-rw-r--r--src/H5AC.c105
-rw-r--r--src/H5B.c2
-rw-r--r--src/H5D.c14
-rw-r--r--src/H5Distore.c23
-rw-r--r--src/H5E.c1
-rw-r--r--src/H5F.c31
-rw-r--r--src/H5Ffamily.c22
-rw-r--r--src/H5Fistore.c23
-rw-r--r--src/H5Flow.c6
-rw-r--r--src/H5Fprivate.h2
-rw-r--r--src/H5HL.c23
-rw-r--r--src/H5MF.c16
-rw-r--r--src/H5O.c12
-rw-r--r--src/H5S.c138
-rw-r--r--src/H5T.c45
-rw-r--r--src/H5Z.c80
-rw-r--r--src/H5private.h43
-rw-r--r--test/.distdep32
-rw-r--r--test/bittests.c8
26 files changed, 1204 insertions, 798 deletions
diff --git a/INSTALL b/INSTALL
index 65483f9..16c364a 100644
--- a/INSTALL
+++ b/INSTALL
@@ -65,7 +65,9 @@ Step 2. Configure.
* This version of HDF5 is normally built with various debugging
code enabled. To turn it off add the `--disable-debug' switch
- to the configure command.
+ to the configure command. Even if debugging support is compiled
+ into the library one must still enable the code at runtime with
+ the HDF5_DEBUG environment variable (see Debugging.html).
* This version of HDF5 is normally built with support for symbolic
debugging with dbx or gdb and without compiler optimization
@@ -73,10 +75,10 @@ Step 2. Configure.
optimizations add `--enable-production' to the configure
command.
- * This version of HDF5 is normally built with the ability to print
+ * This version of HDF5 is normally built with the ability to print
the names, arguments, and return values of all API functions
when they're called. For more information refer to the
- doc/html/tracing.html file. To disable tracing support add
+ Debugging.html file. To disable tracing support add
`--disable-trace' to the configure command.
* Old versions of gcc (<2.8.0) may experience register allocation
diff --git a/MANIFEST b/MANIFEST
index c04f540..aacd8a0 100644
--- a/MANIFEST
+++ b/MANIFEST
@@ -51,6 +51,7 @@
./doc/html/Datasets.html
./doc/html/Dataspaces.html
./doc/html/Datatypes.html
+./doc/html/Debugging.html
./doc/html/Errors.html
./doc/html/ExternalFiles.html
./doc/html/Files.html
@@ -123,7 +124,6 @@
./doc/html/study_p1.gif
./doc/html/study_p1.obj
./doc/html/symtab
-./doc/html/tracing.html
./doc/html/version.gif
./doc/html/version.obj
./doc/src/Glossary.html
diff --git a/doc/html/Debugging.html b/doc/html/Debugging.html
new file mode 100644
index 0000000..8c0c4cc
--- /dev/null
+++ b/doc/html/Debugging.html
@@ -0,0 +1,408 @@
+<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
+<html>
+ <head>
+ <title>Debugging HDF5 Applications</title>
+ </head>
+
+ <body>
+ <h1>Debugging HDF5 Applications</h1>
+
+ <h2>Introduction</h2>
+
+ <p>The HDF5 library contains a number of debugging features to
+ make programmers lives easier including the ability to print
+ detailed error messages, check invariant conditions, display
+ timings and other statistics, and trace API function calls and
+ return values.
+
+ <dl>
+ <dt><b>Error Messages</b>
+ <dd>Error messages are normally displayed automatically on the
+ standard error stream and include a stack trace of the library
+ including file names, line numbers, and function names. The
+ application has complete control over how error messages are
+ displayed and can disable the display on a permanent or
+ temporary basis. Refer to the documentation for the H5E error
+ handling package.
+
+ <br><br>
+ <dt><b>Invariant Conditions</b>
+ <dd>Unless <code>NDEBUG</code> is defined during compiling the
+ library will include code to verify that invariant conditions
+ have the expected values. When a problem is detected the
+ library will display the file and line number within the
+ library and the invariant condition that failed. A core dump
+ may be generated for post mortem debugging. The code to
+ perform these checks can be included on a per-package bases.
+
+ <br><br>
+ <dt><b>Timings and Statistics</b>
+ <dd>The library can be configured to accumulate certain
+ statistics about things like cache performance, data type
+ conversion, data space conversion, and data filters. The code
+ is included on a per-package basis and enabled at runtime by
+ an environment variable.
+
+ <br><br>
+ <dt><b>API Tracing</b>
+ <dd>All API calls made by an application can be displayed and
+ include formal argument names and actual values and the
+ function return value. This code is also conditionally
+ included at compile time and enabled at runtime.
+ </dl>
+
+ <p>The statistics and tracing can be displayed on any output
+ stream (including streams opened by the shell) with output from
+ different packages even going to different streams.
+
+ <h2>Error Messages</h2>
+
+ <p>By default any API function that fails will print an error
+ stack to the standard error stream.
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><h4>Example: An Error Message</h4></caption>
+ <tr>
+ <td>
+ <p><code><pre>
+HDF5-DIAG: Error detected in thread 0. Back trace follows.
+ #000: H5T.c line 462 in H5Tclose(): predefined data type
+ major(01): Function argument
+ minor(05): Bad value
+ </code></pre>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <p>The error handling package (H5E) is described
+ <a href="Errors.html">here</a>.
+
+ <h2>Invariant Conditions</h2>
+
+ <p>To include checks for invariant conditions the library should
+ be configured with <code>--disable-production</code>, the
+ default for versions before 1.2. The library designers have made
+ every attempt to handle error conditions gracefully but an
+ invariant condition assertion may fail in certain cases. The
+ output from a failure usually looks something like this:
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><h4>Example: A Failed Assertion</h4></caption>
+ <tr>
+ <td>
+ <p><code><pre>
+Assertion failed: H5.c:123: i&lt;NELMTS(H5_debug_g)
+IOT Trap, core dumped.
+ </code></pre>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <h2>Timings and Statistics</h2>
+
+ <p>Code to accumulate statistics is included at compile time by
+ using the <code>--enable-debug</code> configure switch. The
+ switch can be followed by an equal sign and a comma-separated
+ list of package names or else a default list is used.
+
+ <p>
+ <center>
+ <table border align=center width="80%">
+ <tr>
+ <th>Name</th>
+ <th>Default</th>
+ <th>Description</th>
+ </tr>
+ <tr>
+ <td align=center>a</td>
+ <td align=center>No</td>
+ <td>Attributes</td>
+ </tr>
+ <tr>
+ <td align=center>ac</td>
+ <td align=center>Yes</td>
+ <td>Meta data cache</td>
+ </tr>
+ <tr>
+ <td align=center>b</td>
+ <td align=center>Yes</td>
+ <td>B-Trees</td>
+ </tr>
+ <tr>
+ <td align=center>d</td>
+ <td align=center>Yes</td>
+ <td>Datasets</td>
+ </tr>
+ <tr>
+ <td align=center>e</td>
+ <td align=center>Yes</td>
+ <td>Error handling</td>
+ </tr>
+ <tr>
+ <td align=center>f</td>
+ <td align=center>Yes</td>
+ <td>Files</td>
+ </tr>
+ <tr>
+ <td align=center>g</td>
+ <td align=center>Yes</td>
+ <td>Groups</td>
+ </tr>
+ <tr>
+ <td align=center>hg</td>
+ <td align=center>Yes</td>
+ <td>Global heap</td>
+ </tr>
+ <tr>
+ <td align=center>hl</td>
+ <td align=center>No</td>
+ <td>Local heaps</td>
+ </tr>
+ <tr>
+ <td align=center>i</td>
+ <td align=center>Yes</td>
+ <td>Interface abstraction</td>
+ </tr>
+ <tr>
+ <td align=center>mf</td>
+ <td align=center>No</td>
+ <td>File memory management</td>
+ </tr>
+ <tr>
+ <td align=center>mm</td>
+ <td align=center>Yes</td>
+ <td>Library memory managment</td>
+ </tr>
+ <tr>
+ <td align=center>o</td>
+ <td align=center>No</td>
+ <td>Object headers and messages</td>
+ </tr>
+ <tr>
+ <td align=center>p</td>
+ <td align=center>Yes</td>
+ <td>Property lists</td>
+ </tr>
+ <tr>
+ <td align=center>s</td>
+ <td align=center>Yes</td>
+ <td>Data spaces</td>
+ </tr>
+ <tr>
+ <td align=center>t</td>
+ <td align=center>Yes</td>
+ <td>Data types</td>
+ </tr>
+ <tr>
+ <td align=center>v</td>
+ <td align=center>Yes</td>
+ <td>Vectors</td>
+ </tr>
+ <tr>
+ <td align=center>z</td>
+ <td align=center>Yes</td>
+ <td>Raw data filters</td>
+ </tr>
+ </table>
+ </center>
+
+ <p>In addition to including the code at compile time the
+ application must enable each package at runtime. This is done
+ by listing the package names in the <code>HDF5_DEBUG</code>
+ environment variable. That variable may also contain file
+ descriptor numbers (the default is `2') which control the output
+ for all following packages up to the next file number. The
+ word <code>all</code> refers to all packages. Any word my be
+ preceded by a minus sign to turn debugging off for the package.
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><b>Sample debug specifications</b></caption>
+ <tr valign=top>
+ <td><code>all</code></td>
+ <td>This causes debugging output from all packages to be
+ sent to the standard error stream.</td>
+ </tr>
+ <tr valign=top>
+ <td><code>all -t -s</code></td>
+ <td>Debugging output for all packages except data types
+ and data spaces will appear on the standard error
+ stream.</td>
+ </tr>
+ <tr valign=top>
+ <td><code>-all ac 255 t,s</code></td>
+ <td>This disables all debugging even if the default was to
+ debug something, then output from the meta data cache is
+ send to the standard error stream and output from data
+ types and spaces is sent to file descriptor 255 which
+ should be redirected by the shell.</td>
+ </tr>
+ </table>
+ </center>
+
+ <p>The components of the <code>HDF5_DEBUG</code> value may be
+ separated by any non-lowercase letter.
+
+ <h2>API Tracing</h2>
+
+ <p>The HDF5 library can trace API calls by printing the
+ function name, the argument names and their values, and the
+ return value. Some people like to see lots of output during
+ program execution instead of using a good symbolic debugger, and
+ this feature is intended for their consumption. For example,
+ the output from <code>h5ls foo</code> after turning on tracing,
+ includes:
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><b>Sample Output</b></caption>
+ <tr>
+ <td>
+ <code><pre>
+H5Tcopy(type=184549388) = 184549419 (type);
+H5Tcopy(type=184549392) = 184549424 (type);
+H5Tlock(type=184549424) = SUCCEED;
+H5Tcopy(type=184549393) = 184549425 (type);
+H5Tlock(type=184549425) = SUCCEED;
+H5Fopen(filename="foo", flags=0, access=H5P_DEFAULT) = FAIL;
+HDF5-DIAG: Error detected in thread 0. Back trace follows.
+ #000: H5F.c line 1245 in H5Fopen(): unable to open file
+ major(04): File interface
+ minor(10): Unable to open file
+ #001: H5F.c line 846 in H5F_open(): file does not exist
+ major(04): File interface
+ minor(10): Unable to open file
+ </pre></code>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <p>The code that performs the tracing must be included in the
+ library by specifying the <code>--enable-trace</code>
+ configuration switch (the default for versions before 1.2). Then
+ the word <code>trace</code> must appear in the value of the
+ <code>HDF5_DEBUG</code> variable. The output will appear on the
+ last file descriptor before the word <code>trace</code> or two
+ (standard error) by default.
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><b>Execution Examples</b></caption>
+ <tr>
+ <td>To display the trace on the standard error stream:
+ <code><pre>
+$ env HDF5_DEBUG=trace a.out
+ </pre></code>
+ </td>
+ </tr>
+ <tr>
+ <td>To send the trace to a file:
+ <code><pre>
+$ env HDF5_DEBUG="55 trace" a.out 55>trace-output
+ </pre></code>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <h3>Performance</h3>
+
+ <p>If the library was not configured for tracing then there is no
+ unnecessary overhead since all tracing code is excluded.
+ However, if tracing is enabled but not used there is a small
+ penalty. First, code size is larger because of extra
+ statically-declared character strings used to store argument
+ types and names and extra auto variable pointer in each
+ function. Also, execution is slower because each function sets
+ and tests a local variable and each API function calls the
+ <code>H5_trace()</code> function.
+
+ <p>If tracing is enabled and turned on then the penalties from the
+ previous paragraph apply plus the time required to format each
+ line of tracing information. There is also an extra call to
+ H5_trace() for each API function to print the return value.
+
+ <h3>Safety</h3>
+
+ <p>The tracing mechanism is invoked for each API function before
+ arguments are checked for validity. If bad arguments are passed
+ to an API function it could result in a segmentation fault.
+ However, the tracing output is line-buffered so all previous
+ output will appear.
+
+ <h3>Completeness</h3>
+
+ <p>There are two API functions that don't participate in
+ tracing. They are <code>H5Eprint()</code> and
+ <code>H5Eprint_cb()</code> because their participation would
+ mess up output during automatic error reporting.
+
+ <p>On the other hand, a number of API functions are called during
+ library initialization and they print tracing information.
+
+ <h3>Implementation</h3>
+
+ <p>For those interested in the implementation here is a
+ description. Each API function should have a call to one of the
+ <code>H5TRACE()</code> macros immediately after the
+ <code>FUNC_ENTER()</code> macro. The first argument is the
+ return type encoded as a string. The second argument is the
+ types of all the function arguments encoded as a string. The
+ remaining arguments are the function arguments. This macro was
+ designed to be as terse and unobtrousive as possible.
+
+ <p>In order to keep the <code>H5TRACE()</code> calls synchronized
+ with the source code we've written a perl script which gets
+ called automatically just before Makefile dependencies are
+ calculated for the file. However, this only works when one is
+ using GNU make. To reinstrument the tracing explicitly, invoke
+ the <code>trace</code> program from the hdf5 bin directory with
+ the names of the source files that need to be updated. If any
+ file needs to be modified then a backup is created by appending
+ a tilde to the file name.
+
+ <p>
+ <center>
+ <table border align=center width="100%">
+ <caption align=top><b>Explicit Instrumentation</b></caption>
+ <tr>
+ <td>
+ <code><pre>
+$ ../bin/trace *.c
+H5E.c: in function `H5Ewalk_cb':
+H5E.c:336: warning: trace info was not inserted
+ </pre></code>
+ </td>
+ </tr>
+ </table>
+ </center>
+
+ <p>Note: The warning message is the result of a comment of the
+ form <code>/*NO TRACE*/</code> somewhere in the function
+ body. Tracing information will not be updated or inserted if
+ such a comment exists.
+
+ <p>Error messages have the same format as a compiler so that they
+ can be parsed from program development environments like
+ Emacs. Any function which generates an error will not be
+ modified.
+
+
+ <hr>
+ <address><a href="mailto:matzke@llnl.gov">Robb Matzke</a></address>
+<!-- Created: Wed Jun 17 12:29:12 EDT 1998 -->
+<!-- hhmts start -->
+Last modified: Wed Aug 19 15:21:35 PDT 1998
+<!-- hhmts end -->
+ </body>
+</html>
diff --git a/doc/html/H5.user.html b/doc/html/H5.user.html
index c090922..a7b59e8 100644
--- a/doc/html/H5.user.html
+++ b/doc/html/H5.user.html
@@ -32,7 +32,7 @@
A guide to the H5Z interface.
<li><a href="Caching.html">Caching</a> -
A guide for meta and raw data caching.
- <li><a href="tracing.html">API Tracing</a> -
+ <li><a href="Debugging.html">Debugging</a> -
A guide to debugging HDF5 API calls.
</ul>
@@ -66,7 +66,7 @@
<address><a href="mailto:koziol@ncsa.uiuc.edu">Quincey Koziol</a></address>
<address><a href="mailto:matzke@llnl.gov">Robb Matzke</a></address>
<!-- hhmts start -->
-Last modified: Wed Aug 5 17:02:57 EDT 1998
+Last modified: Wed Aug 19 15:29:11 PDT 1998
<!-- hhmts end -->
</body>
diff --git a/doc/html/tracing.html b/doc/html/tracing.html
deleted file mode 100644
index 8d3c677..0000000
--- a/doc/html/tracing.html
+++ /dev/null
@@ -1,193 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
-<html>
- <head>
- <title>API Tracing</title>
- </head>
-
- <body>
- <h1>API Tracing</h1>
-
- <h2>Introduction</h2>
-
- <p>The HDF5 library is now able to trace API calls by printing the
- function name, the argument names and their values, and the
- return value. Some people like to see lots of output during
- program execution instead of using a good symbolic debugger, and
- this feature is intended for their consumption. For example,
- the output from <code>h5ls foo</code> after turning on tracing,
- includes:
-
- <p>
- <center>
- <table border align=center width="100%">
- <caption align=top><b>Sample Output</b></caption>
- <tr>
- <td>
- <code><pre>
-H5Tcopy(type=184549388) = 184549419 (type);
-H5Tcopy(type=184549392) = 184549424 (type);
-H5Tlock(type=184549424) = SUCCEED;
-H5Tcopy(type=184549393) = 184549425 (type);
-H5Tlock(type=184549425) = SUCCEED;
-H5Fopen(filename="foo", flags=0, access=H5P_DEFAULT) = FAIL;
-HDF5-DIAG: Error detected in thread 0. Back trace follows.
- #000: H5F.c line 1245 in H5Fopen(): unable to open file
- major(04): File interface
- minor(10): Unable to open file
- #001: H5F.c line 846 in H5F_open(): file does not exist
- major(04): File interface
- minor(10): Unable to open file
- </pre></code>
- </td>
- </tr>
- </table>
- </center>
-
- <h2>Configuation</h2>
-
- <p>This all happens with some magic in the configuration script,
- the makefiles, and macros. First, from the end-user point of
- view, the library must be configured with the
- <code>--enable-trace</code> switch (the default;
- `--disable-trace' is the alternative). This causes the library
- to include the support necessary for API tracing.
-
- <p>
- <center>
- <table border align=center width="100%">
- <caption align=top><b>Configuration</b></caption>
- <tr>
- <td>
- <code><pre>
-$ make distclean
-$ sh configure --enable-trace
-$ make
- </pre></code>
- </td>
- </tr>
- </table>
- </center>
-
- <h2>Execution</h2>
-
- <p>In order to actually get tracing output one must turn tracing
- on and specify a file descriptor where the tracing output should
- be written. This is done by assigning a file descriptor number
- to the <code>HDF5_TRACE</code> environment variable.
-
- <p>
- <center>
- <table border align=center width="100%">
- <caption align=top><b>Execution Examples</b></caption>
- <tr>
- <td>To display the trace on the standard error stream:
- <code><pre>
-$ export HDF5_TRACE=2
-$ a.out
- </pre></code>
- </td>
- </tr>
- <tr>
- <td>To send the trace to a file:
- <code><pre>
-$ export HDF5_TRACE=255
-$ a.out 255>trace-output
- </pre></code>
- </td>
- </tr>
- </table>
- </center>
-
- <h2>Performance</h2>
-
- <p>If the library was not configured for tracing then there is no
- unnecessary overhead since all tracing code is
- excluded.
-
- <p>However, if tracing is enabled but not used there is a
- small penalty. First, code size is larger because of extra
- statically-declared character strings used to store argument
- types and names and extra auto variable pointer in each
- function. Also, execution is slower because each function sets
- and tests a local variable and each API function calls the
- <code>H5_trace()</code> function.
-
- <p>If tracing is enabled and turned on then the penalties from the
- previous paragraph apply plus the time required to format each
- line of tracing information. There is also an extra call to
- H5_trace() for each API function to print the return value.
-
- <h2>Safety</h2>
-
- <p>The tracing mechanism is invoked for each API function before
- arguments are checked for validity. If bad arguments are passed
- to an API function it could result in a segmentation fault.
- However, the tracing output is line-buffered so all previous
- output will appear.
-
- <h2>Completeness</h2>
-
- <p>There are two API functions that don't participate in
- tracing. They are <code>H5Eprint()</code> and
- <code>H5Eprint_cb()</code> because their participation would
- mess up output during automatic error reporting.
-
- <p>On the other hand, a number of API functions are called during
- library initialization and they print tracing information.
-
- <h2>Implementation</h2>
-
- <p>For those interested in the implementation here is a
- description. Each API function should have a call to one of the
- <code>H5TRACE()</code> macros immediately after the
- <code>FUNC_ENTER()</code> macro. The first argument is the
- return type encoded as a string. The second argument is the
- types of all the function arguments encoded as a string. The
- remaining arguments are the function arguments. This macro was
- designed to be as terse and unobtrousive as possible.
-
- <p>In order to keep the <code>H5TRACE()</code> calls synchronized
- with the source code we've written a perl script which gets
- called automatically just before Makefile dependencies are
- calculated for the file. However, this only works when one is
- using GNU make. To reinstrument the tracing explicitly, invoke
- the <code>trace</code> program from the hdf5 bin directory with
- the names of the source files that need to be updated. If any
- file needs to be modified then a backup is created by appending
- a tilde to the file name.
-
- <p>
- <center>
- <table border align=center width="100%">
- <caption align=top><b>Explicit Instrumentation</b></caption>
- <tr>
- <td>
- <code><pre>
-$ ../bin/trace *.c
-H5E.c: in function `H5Ewalk_cb':
-H5E.c:336: warning: trace info was not inserted
- </pre></code>
- </td>
- </tr>
- </table>
- </center>
-
- <p>Note: The warning message is the result of a comment of the
- form <code>/*NO TRACE*/</code> somewhere in the function
- body. Tracing information will not be updated or inserted if
- such a comment exists.
-
- <p>Error messages have the same format as a compiler so that they
- can be parsed from program development environments like
- Emacs. Any function which generates an error will not be
- modified.
-
-
- <hr>
- <address><a href="mailto:matzke@llnl.gov">Robb Matzke</a></address>
-<!-- Created: Wed Jun 17 12:29:12 EDT 1998 -->
-<!-- hhmts start -->
-Last modified: Wed Jul 8 14:07:23 EDT 1998
-<!-- hhmts end -->
- </body>
-</html>
diff --git a/src/.distdep b/src/.distdep
index 9f9d5a9..e5d6c0d 100644
--- a/src/.distdep
+++ b/src/.distdep
@@ -1,34 +1,3 @@
-H5.o: \
- H5.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Iprivate.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Pprivate.h \
- H5Ppublic.h \
- H5Zpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h
H5A.o: \
H5A.c \
H5private.h \
@@ -62,111 +31,6 @@ H5A.o: \
H5Ppublic.h \
H5Apkg.h \
H5Aprivate.h
-H5AC.o: \
- H5AC.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Eprivate.h \
- H5Epublic.h
-H5B.o: \
- H5B.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MFprivate.h \
- H5MFpublic.h \
- H5MMprivate.h
-H5D.o: \
- H5D.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
- H5Dprivate.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5HLprivate.h \
- H5HLpublic.h \
- H5MFprivate.h \
- H5MFpublic.h
-H5E.o: \
- H5E.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
- H5Eprivate.h
-H5F.o: \
- H5F.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Aprivate.h \
- H5Apublic.h \
- H5Ipublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
- H5Dprivate.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5Iprivate.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MMprivate.h \
- H5MMpublic.h
H5Farray.o: \
H5Farray.c \
H5private.h \
@@ -203,55 +67,6 @@ H5Fcore.o: \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h
-H5Ffamily.o: \
- H5Ffamily.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h
-H5Fistore.o: \
- H5Fistore.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Dprivate.h \
- H5Dpublic.h \
- H5Ipublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
- H5Zprivate.h \
- H5Zpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MFprivate.h \
- H5MFpublic.h
-H5Flow.o: \
- H5Flow.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
- H5MMprivate.h \
- H5MMpublic.h
H5Fmpio.o: \
H5Fmpio.c \
H5private.h \
@@ -450,24 +265,6 @@ H5HG.o: \
H5MFprivate.h \
H5MFpublic.h \
H5MMprivate.h
-H5HL.o: \
- H5HL.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5HLprivate.h \
- H5HLpublic.h \
- H5MFprivate.h \
- H5MFpublic.h \
- H5MMprivate.h
H5I.o: \
H5I.c \
H5private.h \
@@ -476,14 +273,6 @@ H5I.o: \
H5Iprivate.h \
H5Ipublic.h \
H5Eprivate.h
-H5MF.o: \
- H5MF.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5Ipublic.h
H5MM.o: \
H5MM.c \
H5private.h \
@@ -492,34 +281,6 @@ H5MM.o: \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h
-H5O.o: \
- H5O.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5ACprivate.h \
- H5ACpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Ipublic.h \
- H5Dpublic.h \
- H5Eprivate.h \
- H5Epublic.h \
- H5MFprivate.h \
- H5MFpublic.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h \
- H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Sprivate.h
H5Oattr.o: \
H5Oattr.c \
H5private.h \
@@ -829,31 +590,31 @@ H5P.o: \
H5Eprivate.h \
H5Epublic.h \
H5MMprivate.h
-H5S.o: \
- H5S.c \
+H5Sall.o: \
+ H5Sall.c \
H5private.h \
H5public.h \
H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5MMprivate.h \
- H5MMpublic.h \
- H5Oprivate.h \
- H5Opublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
+ H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
H5Gprivate.h \
H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
H5HGprivate.h \
H5HGpublic.h \
- H5Tprivate.h
-H5Sall.o: \
- H5Sall.c \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5Shyper.o: \
+ H5Shyper.c \
H5private.h \
H5public.h \
H5config.h \
@@ -875,14 +636,16 @@ H5Sall.o: \
H5HGpublic.h \
H5Tprivate.h \
H5Tpublic.h
-H5Shyper.o: \
- H5Shyper.c \
+H5Spoint.o: \
+ H5Spoint.c \
H5private.h \
H5public.h \
H5config.h \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
H5Sprivate.h \
H5Spublic.h \
H5Gprivate.h \
@@ -895,17 +658,18 @@ H5Shyper.o: \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
- H5HGpublic.h \
- H5Tprivate.h \
- H5Tpublic.h
-H5Smpio.o: \
- H5Smpio.c \
+ H5HGpublic.h
+H5Sselect.o: \
+ H5Sselect.c \
H5private.h \
H5public.h \
H5config.h \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h \
+ H5Iprivate.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
H5Sprivate.h \
H5Spublic.h \
H5Gprivate.h \
@@ -920,60 +684,245 @@ H5Smpio.o: \
H5HGprivate.h \
H5HGpublic.h \
H5Tprivate.h \
- H5Tpublic.h
-H5Spoint.o: \
- H5Spoint.c \
+ H5Tpublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h
+H5Tbit.o: \
+ H5Tbit.c \
H5private.h \
H5public.h \
H5config.h \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h \
+ H5Iprivate.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Gprivate.h
+H5Tconv.o: \
+ H5Tconv.c \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5public.h \
+ H5config.h \
+ H5private.h \
+ H5Eprivate.h \
+ H5Epublic.h \
H5MMprivate.h \
H5MMpublic.h \
- H5Sprivate.h \
- H5Spublic.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
H5Gprivate.h \
H5Gpublic.h \
H5Bprivate.h \
- H5Bpublic.h \
+ H5Bpublic.h
+H5Tinit.o: \
+ H5Tinit.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h \
+ H5Tpkg.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
+ H5Tprivate.h
+H5TB.o: \
+ H5TB.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
+H5V.o: \
+ H5V.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h \
H5Oprivate.h \
H5Opublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5HGprivate.h \
- H5HGpublic.h
-H5Sselect.o: \
- H5Sselect.c \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h
+H5.o: \
+ H5.c \
H5private.h \
H5public.h \
H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5Eprivate.h \
H5Epublic.h \
- H5Ipublic.h \
H5Iprivate.h \
H5MMprivate.h \
H5MMpublic.h \
+ H5Pprivate.h \
+ H5Ppublic.h \
+ H5Zpublic.h \
H5Sprivate.h \
H5Spublic.h \
H5Gprivate.h \
H5Gpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5AC.o: \
+ H5AC.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h
+H5B.o: \
+ H5B.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
H5Bprivate.h \
H5Bpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h
+H5D.o: \
+ H5D.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
+ H5Dprivate.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5Oprivate.h \
H5Opublic.h \
H5HGprivate.h \
H5HGpublic.h \
H5Tprivate.h \
H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
H5Zprivate.h \
- H5Zpublic.h
-H5T.o: \
- H5T.c \
+ H5Zpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h
+H5E.o: \
+ H5E.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Iprivate.h \
+ H5Ipublic.h \
+ H5Eprivate.h
+H5F.o: \
+ H5F.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Aprivate.h \
+ H5Apublic.h \
+ H5Ipublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
+ H5Dprivate.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Iprivate.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5Ffamily.o: \
+ H5Ffamily.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h
+H5Fistore.o: \
+ H5Fistore.c \
H5private.h \
H5public.h \
H5config.h \
@@ -996,53 +945,79 @@ H5T.o: \
H5Spublic.h \
H5Zprivate.h \
H5Zpublic.h \
- H5Iprivate.h \
H5Eprivate.h \
H5Epublic.h \
- H5MMprivate.h
-H5Tbit.o: \
- H5Tbit.c \
+ H5MFprivate.h \
+ H5MFpublic.h
+H5Flow.o: \
+ H5Flow.c \
H5private.h \
H5public.h \
H5config.h \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h \
- H5Iprivate.h \
- H5Tpkg.h \
- H5HGprivate.h \
- H5HGpublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
- H5Tprivate.h \
- H5Tpublic.h \
- H5Gprivate.h
-H5Tconv.o: \
- H5Tconv.c \
- H5Iprivate.h \
+ H5MMprivate.h \
+ H5MMpublic.h
+H5HL.o: \
+ H5HL.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
H5Ipublic.h \
+ H5Dpublic.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5HLprivate.h \
+ H5HLpublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
+ H5MMprivate.h
+H5MF.o: \
+ H5MF.c \
+ H5private.h \
H5public.h \
H5config.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5Ipublic.h
+H5O.o: \
+ H5O.c \
H5private.h \
+ H5public.h \
+ H5config.h \
+ H5ACprivate.h \
+ H5ACpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Ipublic.h \
+ H5Dpublic.h \
H5Eprivate.h \
H5Epublic.h \
+ H5MFprivate.h \
+ H5MFpublic.h \
H5MMprivate.h \
H5MMpublic.h \
- H5Tpkg.h \
+ H5Oprivate.h \
+ H5Opublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
H5HGprivate.h \
H5HGpublic.h \
- H5Fprivate.h \
- H5Fpublic.h \
- H5Dpublic.h \
H5Tprivate.h \
H5Tpublic.h \
- H5Gprivate.h \
- H5Gpublic.h \
- H5Bprivate.h \
- H5Bpublic.h
-H5Tinit.o: \
- H5Tinit.c \
+ H5Sprivate.h
+H5S.o: \
+ H5S.c \
H5private.h \
H5public.h \
H5config.h \
@@ -1052,44 +1027,69 @@ H5Tinit.o: \
H5Epublic.h \
H5MMprivate.h \
H5MMpublic.h \
- H5Tpkg.h \
- H5HGprivate.h \
- H5HGpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
H5Fprivate.h \
H5Fpublic.h \
H5Dpublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
H5Tprivate.h
-H5TB.o: \
- H5TB.c \
- H5private.h \
- H5public.h \
- H5config.h \
- H5Iprivate.h \
- H5Ipublic.h \
- H5Eprivate.h
-H5V.o: \
- H5V.c \
+H5Smpio.o: \
+ H5Smpio.c \
H5private.h \
H5public.h \
H5config.h \
H5Eprivate.h \
H5Epublic.h \
H5Ipublic.h \
+ H5Sprivate.h \
+ H5Spublic.h \
+ H5Gprivate.h \
+ H5Gpublic.h \
+ H5Bprivate.h \
+ H5Bpublic.h \
+ H5Fprivate.h \
+ H5Fpublic.h \
+ H5Dpublic.h \
H5Oprivate.h \
H5Opublic.h \
+ H5HGprivate.h \
+ H5HGpublic.h \
+ H5Tprivate.h \
+ H5Tpublic.h
+H5T.o: \
+ H5T.c \
+ H5private.h \
+ H5public.h \
+ H5config.h \
+ H5Dprivate.h \
+ H5Dpublic.h \
+ H5Ipublic.h \
H5Fprivate.h \
H5Fpublic.h \
- H5Dpublic.h \
H5Gprivate.h \
H5Gpublic.h \
H5Bprivate.h \
H5Bpublic.h \
+ H5Oprivate.h \
+ H5Opublic.h \
H5HGprivate.h \
H5HGpublic.h \
H5Tprivate.h \
H5Tpublic.h \
H5Sprivate.h \
- H5Spublic.h
+ H5Spublic.h \
+ H5Zprivate.h \
+ H5Zpublic.h \
+ H5Iprivate.h \
+ H5Eprivate.h \
+ H5Epublic.h \
+ H5MMprivate.h
H5Z.o: \
H5Z.c \
H5private.h \
diff --git a/src/H5.c b/src/H5.c
index 3b412db..072f6d0 100644
--- a/src/H5.c
+++ b/src/H5.c
@@ -62,7 +62,8 @@ FILE *fdopen(int fd, const char *mode);
hbool_t library_initialize_g = FALSE;
hbool_t thread_initialize_g = FALSE;
hbool_t install_atexit_g = TRUE;
-static FILE *H5_trace_g = NULL;
+H5_debug_t H5_debug_g; /*debugging info */
+static void H5_debug_mask(const char*);
typedef struct H5_exit {
void (*func) (void); /* Interface function to call during exit */
@@ -91,14 +92,40 @@ DESCRIPTION
herr_t
H5_init_library(void)
{
+ const char *s = NULL;
+
FUNC_ENTER_INIT(H5_init_library, NULL, FAIL);
- /* Install atexit() library cleanup routine */
- if (install_atexit_g == TRUE)
- if (HDatexit(&H5_term_library) != 0)
- HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
- "unable to register atexit function");
+ /*
+ * Make sure the package information is updated.
+ */
+ HDmemset(&H5_debug_g, 0, sizeof H5_debug_g);
+ H5_debug_g.pkg[H5_PKG_A].name = "a";
+ H5_debug_g.pkg[H5_PKG_AC].name = "ac";
+ H5_debug_g.pkg[H5_PKG_B].name = "b";
+ H5_debug_g.pkg[H5_PKG_D].name = "d";
+ H5_debug_g.pkg[H5_PKG_E].name = "e";
+ H5_debug_g.pkg[H5_PKG_F].name = "f";
+ H5_debug_g.pkg[H5_PKG_G].name = "g";
+ H5_debug_g.pkg[H5_PKG_HG].name = "hg";
+ H5_debug_g.pkg[H5_PKG_HL].name = "hl";
+ H5_debug_g.pkg[H5_PKG_I].name = "i";
+ H5_debug_g.pkg[H5_PKG_MF].name = "mf";
+ H5_debug_g.pkg[H5_PKG_MM].name = "mm";
+ H5_debug_g.pkg[H5_PKG_O].name = "o";
+ H5_debug_g.pkg[H5_PKG_P].name = "p";
+ H5_debug_g.pkg[H5_PKG_S].name = "s";
+ H5_debug_g.pkg[H5_PKG_T].name = "t";
+ H5_debug_g.pkg[H5_PKG_V].name = "v";
+ H5_debug_g.pkg[H5_PKG_Z].name = "z";
+ /* Install atexit() library cleanup routine */
+ if (install_atexit_g == TRUE &&
+ HDatexit(&H5_term_library) != 0) {
+ HRETURN_ERROR(H5E_FUNC, H5E_CANTINIT, FAIL,
+ "unable to register atexit function");
+ }
+
/*
* Initialize interfaces that might not be able to initialize themselves
* soon enough.
@@ -108,16 +135,9 @@ H5_init_library(void)
"unable to initialize type interface");
}
-#ifdef H5_DEBUG_API
- {
- /* Turn on tracing? */
- const char *s = getenv ("HDF5_TRACE");
- if (s && isdigit(*s)) {
- int fd = (int)HDstrtol (s, NULL, 0);
- H5_trace_g = HDfdopen (fd, "w");
- }
- }
-#endif
+ /* Debugging? */
+ H5_debug_mask("-all");
+ H5_debug_mask(getenv("HDF5_DEBUG"));
FUNC_LEAVE(SUCCEED);
}
@@ -297,10 +317,91 @@ H5dont_atexit(void)
install_atexit_g = FALSE;
FUNC_LEAVE(SUCCEED);
-} /* end H5dont_atexit() */
+}
/*-------------------------------------------------------------------------
+ * Function: H5_debug_mask
+ *
+ * Purpose: Set runtime debugging flags according to the string S. The
+ * string should contain file numbers and package names
+ * separated by other characters. A file number applies to all
+ * following package names up to the next file number. The
+ * initial file number is `2' (the standard error stream). Each
+ * package name can be preceded by a `+' or `-' to add or remove
+ * the package from the debugging list (`+' is the default). The
+ * special name `all' means all packages.
+ *
+ * The name `trace' indicates that API tracing is to be turned
+ * on or off.
+ *
+ * Return: void
+ *
+ * Programmer: Robb Matzke
+ * Wednesday, August 19, 1998
+ *
+ * Modifications:
+ *
+ *-------------------------------------------------------------------------
+ */
+static void
+H5_debug_mask(const char *s)
+{
+ FILE *stream = stderr;
+ char pkg_name[32], *rest;
+ int i, clear;
+
+ while (s && *s) {
+ if (isalpha(*s) || '-'==*s || '+'==*s) {
+ /* Enable or Disable debugging? */
+ if ('-'==*s) {
+ clear = TRUE;
+ s++;
+ } else if ('+'==*s) {
+ clear = FALSE;
+ s++;
+ } else {
+ clear = FALSE;
+ }
+
+ /* Get the name */
+ for (i=0; isalpha(*s); i++, s++) {
+ if (i<sizeof pkg_name) pkg_name[i] = *s;
+ }
+ pkg_name[MIN(sizeof(pkg_name)-1, i)] = '\0';
+
+ /* Trace, all, or one? */
+ if (!strcmp(pkg_name, "trace")) {
+ H5_debug_g.trace = clear?NULL:stream;
+ } else if (!strcmp(pkg_name, "all")) {
+ for (i=0; i<H5_NPKGS; i++) {
+ H5_debug_g.pkg[i].stream = clear?NULL:stream;
+ }
+ } else {
+ for (i=0; i<H5_NPKGS; i++) {
+ if (!strcmp(H5_debug_g.pkg[i].name, pkg_name)) {
+ H5_debug_g.pkg[i].stream = clear?NULL:stream;
+ break;
+ }
+ }
+ if (i>=H5_NPKGS) {
+ fprintf(stderr, "HDF5_DEBUG: ignored %s\n", pkg_name);
+ }
+ }
+
+ } else if (isdigit(*s)) {
+ int fd = (int)HDstrtol (s, &rest, 0);
+ stream = HDfdopen (fd, "w");
+ setvbuf (stream, NULL, _IOLBF, 0);
+ s = rest;
+ } else {
+ s++;
+ }
+ }
+}
+
+
+/*-------------------------------------------------------------------------
* Function: H5version
*
* Purpose: Returns the library version numbers through arguments. MAJNUM
@@ -1058,7 +1159,7 @@ H5_trace (hbool_t returning, const char *func, const char *type, ...)
hssize_t asize[16];
hssize_t i;
void *vp = NULL;
- FILE *out = H5_trace_g;
+ FILE *out = H5_debug_g.trace;
if (!out) return; /*tracing is off*/
va_start (ap, type);
diff --git a/src/H5AC.c b/src/H5AC.c
index b932f53..a51a3c2 100644
--- a/src/H5AC.c
+++ b/src/H5AC.c
@@ -649,9 +649,9 @@ H5AC_protect(H5F_t *f, const H5AC_class_t *type, const haddr_t *addr,
H5AC_slot_t *slot = NULL;
#ifdef H5AC_DEBUG
- static int ncalls = 0;
+ static int ncalls = 0;
if (0 == ncalls++) {
- fprintf(stderr, "H5AC: debugging cache (expensive)\n");
+ fprintf(stderr, "H5AC: debugging cache (expensive)\n");
}
#endif
@@ -857,55 +857,58 @@ H5AC_debug(H5F_t __unused__ *f)
FUNC_ENTER(H5AC_debug, FAIL);
#ifdef H5AC_DEBUG
- fprintf(stderr, "H5AC: meta data cache statistics for file %s\n", f->name);
- fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n",
- "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n",
- "-----", "----", "------", "--------", "-----", "-------");
-
- for (i = H5AC_BT_ID; i < H5AC_NTYPES; i++) {
-
- switch (i) {
- case H5AC_BT_ID:
- strcpy(s, "B-tree nodes");
- break;
- case H5AC_SNODE_ID:
- strcpy(s, "symbol table nodes");
- break;
- case H5AC_LHEAP_ID:
- strcpy (s, "local heaps");
- break;
- case H5AC_GHEAP_ID:
- strcpy (s, "global heaps");
- break;
- case H5AC_OHDR_ID:
- strcpy(s, "object headers");
- break;
- default:
- sprintf(s, "unknown id %d", i);
- }
-
- if (cache->diagnostics[i].nhits>0 ||
- cache->diagnostics[i].nmisses>0) {
- miss_rate = 100.0 * cache->diagnostics[i].nmisses /
- (cache->diagnostics[i].nhits+
- cache->diagnostics[i].nmisses);
- } else {
- miss_rate = 0.0;
- }
-
- if (miss_rate > 100) {
- sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
- } else {
- sprintf(ascii, "%7.2f%%", miss_rate);
- }
- fprintf(stderr, " %-18s %8u %8u %7s %8u%+-9ld\n", s,
- cache->diagnostics[i].nhits,
- cache->diagnostics[i].nmisses,
- ascii,
- cache->diagnostics[i].ninits,
- ((long)(cache->diagnostics[i].nflushes) -
- (long)(cache->diagnostics[i].ninits)));
+ if (H5DEBUG(AC)) {
+ fprintf(H5DEBUG(AC), "H5AC: meta data cache statistics for file %s\n",
+ f->name);
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
+ "Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
+ "-----", "----", "------", "--------", "-----", "-------");
+
+ for (i = H5AC_BT_ID; i < H5AC_NTYPES; i++) {
+
+ switch (i) {
+ case H5AC_BT_ID:
+ strcpy(s, "B-tree nodes");
+ break;
+ case H5AC_SNODE_ID:
+ strcpy(s, "symbol table nodes");
+ break;
+ case H5AC_LHEAP_ID:
+ strcpy (s, "local heaps");
+ break;
+ case H5AC_GHEAP_ID:
+ strcpy (s, "global heaps");
+ break;
+ case H5AC_OHDR_ID:
+ strcpy(s, "object headers");
+ break;
+ default:
+ sprintf(s, "unknown id %d", i);
+ }
+
+ if (cache->diagnostics[i].nhits>0 ||
+ cache->diagnostics[i].nmisses>0) {
+ miss_rate = 100.0 * cache->diagnostics[i].nmisses /
+ (cache->diagnostics[i].nhits+
+ cache->diagnostics[i].nmisses);
+ } else {
+ miss_rate = 0.0;
+ }
+
+ if (miss_rate > 100) {
+ sprintf(ascii, "%7d%%", (int) (miss_rate + 0.5));
+ } else {
+ sprintf(ascii, "%7.2f%%", miss_rate);
+ }
+ fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8u%+-9ld\n", s,
+ cache->diagnostics[i].nhits,
+ cache->diagnostics[i].nmisses,
+ ascii,
+ cache->diagnostics[i].ninits,
+ ((long)(cache->diagnostics[i].nflushes) -
+ (long)(cache->diagnostics[i].ninits)));
+ }
}
#endif
diff --git a/src/H5B.c b/src/H5B.c
index a834bef..7491ed2 100644
--- a/src/H5B.c
+++ b/src/H5B.c
@@ -1680,7 +1680,7 @@ H5B_assert(H5F_t *f, const haddr_t *addr, const H5B_class_t *type,
} *head = NULL, *tail = NULL, *prev = NULL, *cur = NULL, *tmp = NULL;
FUNC_ENTER(H5B_assert, FAIL);
- if (0 == ncalls++) {
+ if (0==ncalls++) {
fprintf(stderr, "H5B: debugging B-trees (expensive)\n");
}
/* Initialize the queue */
diff --git a/src/H5D.c b/src/H5D.c
index e033e93..36792a2 100644
--- a/src/H5D.c
+++ b/src/H5D.c
@@ -1370,8 +1370,11 @@ H5D_read(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
"collective read failed");
#endif
#ifdef H5D_DEBUG
- fprintf (stderr, "H5D: data space conversion could not be optimized "
- "for this case (using general method instead)\n");
+ if (H5DEBUG(D)) {
+ fprintf (H5DEBUG(D), "H5D: data space conversion could not be "
+ "optimized for this case (using general method "
+ "instead)\n");
+ }
#endif
H5E_clear ();
}
@@ -1715,8 +1718,11 @@ H5D_write(H5D_t *dataset, const H5T_t *mem_type, const H5S_t *mem_space,
"collective write failed");
#endif
#ifdef H5D_DEBUG
- fprintf (stderr, "H5D: data space conversion could not be optimized "
- "for this case (using general method instead)\n");
+ if (H5DEBUG(D)) {
+ fprintf (H5DEBUG(D), "H5D: data space conversion could not be "
+ "optimized for this case (using general method "
+ "instead)\n");
+ }
#endif
H5E_clear ();
}
diff --git a/src/H5Distore.c b/src/H5Distore.c
index efeb7d7..94d3590 100644
--- a/src/H5Distore.c
+++ b/src/H5Distore.c
@@ -1699,7 +1699,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ )
/*-------------------------------------------------------------------------
* Function: H5F_istore_stats
*
- * Purpose: Print raw data cache statistics to the stderr stream. If
+ * Purpose: Print raw data cache statistics to the debug stream. If
* HEADERS is non-zero then print table column headers,
* otherwise assume that the H5AC layer has already printed them.
*
@@ -1722,23 +1722,22 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
char ascii[32];
FUNC_ENTER (H5F_istore_stats, FAIL);
+ if (!H5DEBUG(AC)) HRETURN(SUCCEED);
if (headers) {
- fprintf(stderr, "H5F: raw data cache statistics for file %s\n",
+ fprintf(H5DEBUG(AC), "H5F: raw data cache statistics for file %s\n",
f->name);
- fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n",
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
"Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n",
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
"-----", "----", "------", "--------", "-----", "-------");
}
-#ifndef H5AC_DEBUG
- /*
- * If we're not debugging the H5AC layer then print these statistics only
- * if we printed the headers that go with them.
- */
- if (headers) {
+#ifdef H5AC_DEBUG
+ if (H5DEBUG(AC)) headers = TRUE;
#endif
+
+ if (headers) {
if (rdcc->nhits>0 || rdcc->nmisses>0) {
miss_rate = 100.0 * rdcc->nmisses /
(rdcc->nhits + rdcc->nmisses);
@@ -1751,12 +1750,10 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
sprintf(ascii, "%7.2f%%", miss_rate);
}
- fprintf(stderr, " %-18s %8u %8u %7s %8d+%-9ld\n",
+ fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
"raw data chunks", rdcc->nhits, rdcc->nmisses, ascii,
rdcc->ninits, (long)(rdcc->nflushes)-(long)(rdcc->ninits));
-#ifndef H5AC_DEBUG
}
-#endif
FUNC_LEAVE (SUCCEED);
}
diff --git a/src/H5E.c b/src/H5E.c
index 71f5187..87de26c 100644
--- a/src/H5E.c
+++ b/src/H5E.c
@@ -123,7 +123,6 @@ H5E_t H5E_stack_g[1];
* Automatic error stack traversal occurs if the traversal callback function
* is non null and an API function is about to return an error. These should
* probably be part of the error stack so they're local to a thread.
- *
*/
herr_t (*H5E_auto_g)(void*) = (herr_t(*)(void*))H5Eprint;
void *H5E_auto_data_g = stderr;
diff --git a/src/H5F.c b/src/H5F.c
index b218931..fe04b9d 100644
--- a/src/H5F.c
+++ b/src/H5F.c
@@ -1062,11 +1062,10 @@ H5F_open(const char *name, uintn flags,
* hdf5 data.
*/
#ifdef H5F_DEBUG
- fprintf(stderr, "H5F: resetting EOF from ");
- H5F_addr_print(stderr, &addr1);
- fprintf(stderr, " to ");
- H5F_addr_print(stderr, &addr2);
- fprintf(stderr, " (abs)\n");
+ if (H5DEBUG(F)) {
+ HDfprintf(H5DEBUG(F), "H5F: resetting EOF from %a to %a (abs)\n",
+ &addr1, &addr2);
+ }
#endif
H5F_low_seteof(f->shared->lf, &addr2);
}
@@ -1531,19 +1530,23 @@ H5F_close(H5F_t *f)
* forgetting to close everything is not a major problem.
*/
if (f->nopen>0) {
-#ifndef NDEBUG
- fprintf(stderr, "H5F: H5F_close(%s): %u object header%s still "
- "open (file close will complete when %s closed)\n",
- f->name,
- f->nopen,
- 1 == f->nopen ? " is" : "s are",
- 1 == f->nopen ? "that header is" : "those headers are");
+#ifdef H5F_DEBUG
+ if (H5DEBUG(F)) {
+ fprintf(H5DEBUG(F), "H5F: H5F_close(%s): %u object header%s still "
+ "open (file close will complete when %s closed)\n",
+ f->name,
+ f->nopen,
+ 1 == f->nopen ? " is" : "s are",
+ 1 == f->nopen ? "that header is" : "those headers are");
+ }
#endif
f->close_pending = TRUE;
HRETURN(SUCCEED);
} else if (f->close_pending) {
-#ifndef NDEBUG
- fprintf(stderr, "H5F: H5F_close: operation completed\n");
+#ifdef H5F_DEBUG
+ if (H5DEBUG(F)) {
+ fprintf(H5DEBUG(F), "H5F: H5F_close: operation completed\n");
+ }
#endif
}
diff --git a/src/H5Ffamily.c b/src/H5Ffamily.c
index fd876c0..464ffa1 100644
--- a/src/H5Ffamily.c
+++ b/src/H5Ffamily.c
@@ -177,9 +177,11 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
* the same as the actual member size, but at least 1kB
*/
#ifdef H5F_DEBUG
- HDfprintf (stderr, "H5F: family member size has been increased "
- "from %a to %a\n", &(access_parms->u.fam.memb_size),
- &tmp_addr);
+ if (H5DEBUG(F)) {
+ HDfprintf (H5DEBUG(F), "H5F: family member size has been "
+ "increased from %a to %a\n",
+ &(access_parms->u.fam.memb_size), &tmp_addr);
+ }
#endif
if (tmp_addr.offset<1024) tmp_addr.offset = 1024;
lf->u.fam.memb_size = tmp_addr;
@@ -198,8 +200,11 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
* member as the member size.
*/
#ifdef H5F_DEBUG
- HDfprintf (stderr, "H5F: family member size adjusted from %a to %a\n",
- &(access_parms->u.fam.memb_size), &tmp_addr);
+ if (H5DEBUG(F)) {
+ HDfprintf (H5DEBUG(F), "H5F: family member size adjusted from "
+ "%a to %a\n", &(access_parms->u.fam.memb_size),
+ &tmp_addr);
+ }
#endif
lf->u.fam.memb_size = tmp_addr;
for (membno=1; membno<lf->u.fam.nmemb; membno++) {
@@ -221,9 +226,10 @@ H5F_fam_open(const char *name, const H5F_access_t *access_parms,
* member size but on a 32-bit machine this isn't possible. The largest
* file on a 32-bit machine is 2^32-1.
*/
- if (lf->u.fam.memb_size.offset == ((size_t)1<<(sizeof(off_t)-1))) {
- HDfprintf (stderr, "H5F: family member size may be too large: %a\n",
- &(lf->u.fam.memb_size));
+ if (H5DEBUG(F) &&
+ lf->u.fam.memb_size.offset == ((size_t)1<<(sizeof(off_t)-1))) {
+ HDfprintf(H5DEBUG(F), "H5F: family member size may be too large: %a\n",
+ &(lf->u.fam.memb_size));
}
#endif
diff --git a/src/H5Fistore.c b/src/H5Fistore.c
index efeb7d7..94d3590 100644
--- a/src/H5Fistore.c
+++ b/src/H5Fistore.c
@@ -1699,7 +1699,7 @@ H5F_istore_create(H5F_t *f, H5O_layout_t *layout /*out */ )
/*-------------------------------------------------------------------------
* Function: H5F_istore_stats
*
- * Purpose: Print raw data cache statistics to the stderr stream. If
+ * Purpose: Print raw data cache statistics to the debug stream. If
* HEADERS is non-zero then print table column headers,
* otherwise assume that the H5AC layer has already printed them.
*
@@ -1722,23 +1722,22 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
char ascii[32];
FUNC_ENTER (H5F_istore_stats, FAIL);
+ if (!H5DEBUG(AC)) HRETURN(SUCCEED);
if (headers) {
- fprintf(stderr, "H5F: raw data cache statistics for file %s\n",
+ fprintf(H5DEBUG(AC), "H5F: raw data cache statistics for file %s\n",
f->name);
- fprintf(stderr, " %-18s %8s %8s %8s %8s+%-8s\n",
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s+%-8s\n",
"Layer", "Hits", "Misses", "MissRate", "Inits", "Flushes");
- fprintf(stderr, " %-18s %8s %8s %8s %8s-%-8s\n",
+ fprintf(H5DEBUG(AC), " %-18s %8s %8s %8s %8s-%-8s\n",
"-----", "----", "------", "--------", "-----", "-------");
}
-#ifndef H5AC_DEBUG
- /*
- * If we're not debugging the H5AC layer then print these statistics only
- * if we printed the headers that go with them.
- */
- if (headers) {
+#ifdef H5AC_DEBUG
+ if (H5DEBUG(AC)) headers = TRUE;
#endif
+
+ if (headers) {
if (rdcc->nhits>0 || rdcc->nmisses>0) {
miss_rate = 100.0 * rdcc->nmisses /
(rdcc->nhits + rdcc->nmisses);
@@ -1751,12 +1750,10 @@ H5F_istore_stats (H5F_t *f, hbool_t headers)
sprintf(ascii, "%7.2f%%", miss_rate);
}
- fprintf(stderr, " %-18s %8u %8u %7s %8d+%-9ld\n",
+ fprintf(H5DEBUG(AC), " %-18s %8u %8u %7s %8d+%-9ld\n",
"raw data chunks", rdcc->nhits, rdcc->nmisses, ascii,
rdcc->ninits, (long)(rdcc->nflushes)-(long)(rdcc->ninits));
-#ifndef H5AC_DEBUG
}
-#endif
FUNC_LEAVE (SUCCEED);
}
diff --git a/src/H5Flow.c b/src/H5Flow.c
index 5ddc299..73a5125 100644
--- a/src/H5Flow.c
+++ b/src/H5Flow.c
@@ -312,7 +312,11 @@ H5F_low_write(H5F_low_t *lf, const H5F_access_t *access_parms,
tmp_addr = *addr;
H5F_addr_inc(&tmp_addr, (hsize_t)size);
if (H5F_addr_gt(&tmp_addr, &(lf->eof))) {
- fprintf(stderr, "H5F: extending file w/o allocation\n");
+#ifdef H5F_DEBUG
+ if (H5DEBUG(F)) {
+ fprintf(H5DEBUG(F), "H5F: extending file w/o allocation\n");
+ }
+#endif
lf->eof = tmp_addr;
}
#ifdef HAVE_PARALLEL
diff --git a/src/H5Fprivate.h b/src/H5Fprivate.h
index 1dba61c..396b448 100644
--- a/src/H5Fprivate.h
+++ b/src/H5Fprivate.h
@@ -36,7 +36,7 @@
/*
* Feature: Define this constant on the compiler command-line if you want to
- * see some debugging messages on stderr.
+ * see some debugging messages on the debug stream.
*/
#ifdef NDEBUG
# undef H5F_DEBUG
diff --git a/src/H5HL.c b/src/H5HL.c
index 88ee521..a960c80 100644
--- a/src/H5HL.c
+++ b/src/H5HL.c
@@ -643,8 +643,8 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
if (max_fl->size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
- if (max_fl->size) {
- fprintf(stderr, "H5HL: lost %lu bytes at line %d\n",
+ if (H5DEBUG(HL) && max_fl->size) {
+ fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes at line %d\n",
(unsigned long)(max_fl->size), __LINE__);
}
#endif
@@ -670,17 +670,21 @@ H5HL_insert(H5F_t *f, const haddr_t *addr, size_t buf_size, const void *buf)
if (heap->freelist) heap->freelist->prev = fl;
heap->freelist = fl;
#ifdef H5HL_DEBUG
- } else if (need_more > need_size) {
- fprintf(stderr, "H5HL_insert: lost %lu bytes at line %d\n",
+ } else if (H5DEBUG(HL) && need_more > need_size) {
+ fprintf(H5DEBUG(HL),
+ "H5HL_insert: lost %lu bytes at line %d\n",
(unsigned long)(need_more - need_size), __LINE__);
#endif
}
}
#ifdef H5HL_DEBUG
- fprintf(stderr, "H5HL: resize mem buf from %lu to %lu bytes\n",
- (unsigned long)(heap->mem_alloc),
- (unsigned long)(heap->mem_alloc + need_more));
+ if (H5DEBUG(HL)) {
+ fprintf(H5DEBUG(HL),
+ "H5HL: resize mem buf from %lu to %lu bytes\n",
+ (unsigned long)(heap->mem_alloc),
+ (unsigned long)(heap->mem_alloc + need_more));
+ }
#endif
old_size = heap->mem_alloc;
heap->mem_alloc += need_more;
@@ -859,7 +863,10 @@ H5HL_remove(H5F_t *f, const haddr_t *addr, size_t offset, size_t size)
*/
if (size < H5HL_SIZEOF_FREE(f)) {
#ifdef H5HL_DEBUG
- fprintf(stderr, "H5HL: lost %lu bytes\n", (unsigned long) size);
+ if (H5DEBUG(HL)) {
+ fprintf(H5DEBUG(HL), "H5HL: lost %lu bytes\n",
+ (unsigned long) size);
+ }
#endif
HRETURN(SUCCEED);
}
diff --git a/src/H5MF.c b/src/H5MF.c
index ddd29ec..b469f4b 100644
--- a/src/H5MF.c
+++ b/src/H5MF.c
@@ -71,12 +71,7 @@ H5MF_alloc(H5F_t *f, intn op, hsize_t size, haddr_t *addr/*out*/)
assert(H5MF_META == op || H5MF_RAW == op);
assert(size > 0);
assert(addr);
-
-#if 0
- HDfprintf (stderr, "A %Hu\n", size);
-#endif
-
/* Fail if we don't have write access */
if (0==(f->intent & H5F_ACC_RDWR)) {
HRETURN_ERROR (H5E_RESOURCE, H5E_CANTINIT, FAIL, "file is read-only");
@@ -226,8 +221,11 @@ H5MF_xfree(H5F_t *f, const haddr_t *addr, hsize_t size)
for (i=0; i<H5MF_NFREE; i++) {
if (f->shared->fl_free[i].size<size) {
#ifdef H5MF_DEBUG
- fprintf(stderr, "H5MF_free: lost %lu bytes of file storage\n",
- (unsigned long) f->shared->fl_free[i].size);
+ if (H5DEBUG(MF)) {
+ fprintf(H5DEBUG(MF),
+ "H5MF_free: lost %lu bytes of file storage\n",
+ (unsigned long) f->shared->fl_free[i].size);
+ }
#endif
f->shared->fl_free[i].addr = *addr;
f->shared->fl_free[i].size = size;
@@ -315,8 +313,8 @@ H5MF_realloc (H5F_t *f, intn op, hsize_t orig_size, const haddr_t *orig_addr,
} else {
/* New size is not larger */
#ifdef H5MF_DEBUG
- if (new_size<orig_size) {
- HDfprintf (stderr, "H5MF: realloc lost %Hd bytes\n",
+ if (H5DEBUG(MF) && new_size<orig_size) {
+ HDfprintf (H5DEBUG(MF), "H5MF: realloc lost %Hd bytes\n",
orig_size-new_size);
}
#endif
diff --git a/src/H5O.c b/src/H5O.c
index ca8e402..81efca7 100644
--- a/src/H5O.c
+++ b/src/H5O.c
@@ -238,9 +238,9 @@ H5O_open(H5G_entry_t *obj_ent)
assert(obj_ent->file);
#ifdef H5O_DEBUG
- fprintf(stderr, ">");
- H5F_addr_print(stderr, &(obj_ent->header));
- fprintf(stderr, "\n");
+ if (H5DEBUG(O)) {
+ HDfprintf(H5DEBUG(O), "> %a\n", &(obj_ent->header));
+ }
#endif
/* Increment open-lock counters */
@@ -286,9 +286,9 @@ H5O_close(H5G_entry_t *obj_ent)
H5F_close(obj_ent->file);
}
#ifdef H5O_DEBUG
- fprintf(stderr, "<");
- H5F_addr_print(stderr, &(obj_ent->header));
- fprintf(stderr, "\n");
+ if (H5DEBUG(O)) {
+ HDfprintf(H5DEBUG(O), "< %a\n", &(obj_ent->header));
+ }
#endif
FUNC_LEAVE(SUCCEED);
diff --git a/src/H5S.c b/src/H5S.c
index 7fb1088..48bde7c 100644
--- a/src/H5S.c
+++ b/src/H5S.c
@@ -105,73 +105,77 @@ H5S_term_interface(void)
/*
* Print statistics about each conversion path.
*/
- for (i=0; i<H5S_nconv_g; i++) {
- path = H5S_conv_g[i];
- for (j=0; j<2; j++) {
- if (0==path->stats[j].gath_ncalls &&
- 0==path->stats[j].scat_ncalls &&
- 0==path->stats[j].bkg_ncalls) {
- continue;
- }
- if (0==nprints++) {
- fprintf(stderr, "H5S: data space conversion statistics "
- "accumulated over life of library:\n");
- fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
- "Memory <> File", "Bytes", "Calls",
- "User", "System", "Elapsed", "Bandwidth");
- fprintf(stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
- "--------------", "-----", "-----",
- "----", "------", "-------", "---------");
- }
-
- /* Summary */
- sprintf(buf, "%s %c %s",
- path->m->name, 0==j?'>':'<', path->f->name);
- fprintf(stderr, " %-16s\n", buf);
-
- /* Gather */
- if (path->stats[j].gath_ncalls) {
- H5_bandwidth(buf, (double)(path->stats[j].gath_nbytes),
- path->stats[j].gath_timer.etime);
- HDfprintf(stderr,
- " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
- "gather",
- path->stats[j].gath_nbytes,
- path->stats[j].gath_ncalls,
- path->stats[j].gath_timer.utime,
- path->stats[j].gath_timer.stime,
- path->stats[j].gath_timer.etime,
- buf);
- }
-
- /* Scatter */
- if (path->stats[j].scat_ncalls) {
- H5_bandwidth(buf, (double)(path->stats[j].scat_nbytes),
- path->stats[j].scat_timer.etime);
- HDfprintf(stderr,
- " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
- "scatter",
- path->stats[j].scat_nbytes,
- path->stats[j].scat_ncalls,
- path->stats[j].scat_timer.utime,
- path->stats[j].scat_timer.stime,
- path->stats[j].scat_timer.etime,
- buf);
- }
-
- /* Background */
- if (path->stats[j].bkg_ncalls) {
- H5_bandwidth(buf, (double)(path->stats[j].bkg_nbytes),
- path->stats[j].bkg_timer.etime);
- HDfprintf(stderr,
- " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
- "background",
- path->stats[j].bkg_nbytes,
- path->stats[j].bkg_ncalls,
- path->stats[j].bkg_timer.utime,
- path->stats[j].bkg_timer.stime,
- path->stats[j].bkg_timer.etime,
- buf);
+ if (H5DEBUG(S)) {
+ for (i=0; i<H5S_nconv_g; i++) {
+ path = H5S_conv_g[i];
+ for (j=0; j<2; j++) {
+ if (0==path->stats[j].gath_ncalls &&
+ 0==path->stats[j].scat_ncalls &&
+ 0==path->stats[j].bkg_ncalls) {
+ continue;
+ }
+ if (0==nprints++) {
+ fprintf(H5DEBUG(S), "H5S: data space conversion "
+ "statistics accumulated over life of library:\n");
+ fprintf(H5DEBUG(S),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "Memory <> File", "Bytes", "Calls",
+ "User", "System", "Elapsed", "Bandwidth");
+ fprintf(H5DEBUG(S),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "--------------", "-----", "-----",
+ "----", "------", "-------", "---------");
+ }
+
+ /* Summary */
+ sprintf(buf, "%s %c %s",
+ path->m->name, 0==j?'>':'<', path->f->name);
+ fprintf(H5DEBUG(S), " %-16s\n", buf);
+
+ /* Gather */
+ if (path->stats[j].gath_ncalls) {
+ H5_bandwidth(buf, (double)(path->stats[j].gath_nbytes),
+ path->stats[j].gath_timer.etime);
+ HDfprintf(H5DEBUG(S),
+ " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
+ "gather",
+ path->stats[j].gath_nbytes,
+ path->stats[j].gath_ncalls,
+ path->stats[j].gath_timer.utime,
+ path->stats[j].gath_timer.stime,
+ path->stats[j].gath_timer.etime,
+ buf);
+ }
+
+ /* Scatter */
+ if (path->stats[j].scat_ncalls) {
+ H5_bandwidth(buf, (double)(path->stats[j].scat_nbytes),
+ path->stats[j].scat_timer.etime);
+ HDfprintf(H5DEBUG(S),
+ " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
+ "scatter",
+ path->stats[j].scat_nbytes,
+ path->stats[j].scat_ncalls,
+ path->stats[j].scat_timer.utime,
+ path->stats[j].scat_timer.stime,
+ path->stats[j].scat_timer.etime,
+ buf);
+ }
+
+ /* Background */
+ if (path->stats[j].bkg_ncalls) {
+ H5_bandwidth(buf, (double)(path->stats[j].bkg_nbytes),
+ path->stats[j].bkg_timer.etime);
+ HDfprintf(H5DEBUG(S),
+ " %16s %10Hu %10Hu %8.2f %8.2f %8.2f %10s\n",
+ "background",
+ path->stats[j].bkg_nbytes,
+ path->stats[j].bkg_ncalls,
+ path->stats[j].bkg_timer.utime,
+ path->stats[j].bkg_timer.stime,
+ path->stats[j].bkg_timer.etime,
+ buf);
+ }
}
}
}
diff --git a/src/H5T.c b/src/H5T.c
index 9be5749..15f2bef 100644
--- a/src/H5T.c
+++ b/src/H5T.c
@@ -727,20 +727,24 @@ H5T_term_interface(void)
path->cdata.command = H5T_CONV_FREE;
if ((path->func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "H5T: conversion function failed "
- "to free private data\n");
+ if (H5DEBUG(T)) {
+ fprintf (H5DEBUG(T), "H5T: conversion function failed "
+ "to free private data\n");
+ }
#endif
H5E_clear(); /*ignore the error*/
}
#ifdef H5T_DEBUG
- if (path->cdata.stats->ncalls>0) {
+ if (H5DEBUG(T) && path->cdata.stats->ncalls>0) {
if (0==nprint++) {
- HDfprintf (stderr, "H5T: type conversion statistics "
+ HDfprintf (H5DEBUG(T), "H5T: type conversion statistics "
"accumulated over life of library:\n");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
+ HDfprintf (H5DEBUG(T),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
"Conversion", "Elmts", "Calls", "User",
"System", "Elapsed", "Bandwidth");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
+ HDfprintf (H5DEBUG(T),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
"----------", "-----", "-----", "----",
"------", "-------", "---------");
}
@@ -749,7 +753,7 @@ H5T_term_interface(void)
nbytes *= path->cdata.stats->nelmts;
H5_bandwidth(bandwidth, (double)nbytes,
path->cdata.stats->timer.etime);
- HDfprintf (stderr,
+ HDfprintf (H5DEBUG(T),
" %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n",
path->name,
path->cdata.stats->nelmts,
@@ -770,21 +774,22 @@ H5T_term_interface(void)
#ifdef H5T_DEBUG
/* Print debugging infor for the `noop' conversion */
- if (H5T_conv_noop==H5T_find(NULL, NULL, H5T_BKG_NO, &cdata)) {
+ if (H5DEBUG(T) &&
+ H5T_conv_noop==H5T_find(NULL, NULL, H5T_BKG_NO, &cdata)) {
if (cdata->stats->ncalls>0) {
if (0==nprint++) {
- HDfprintf (stderr, "H5T: type conversion statistics "
+ HDfprintf (H5DEBUG(T), "H5T: type conversion statistics "
"accumulated over life of library:\n");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
+ HDfprintf (H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
"Conversion", "Elmts", "Calls", "User",
"System", "Elapsed", "Bandwidth");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
+ HDfprintf (H5DEBUG(T), " %-16s %10s %10s %8s %8s %8s %10s\n",
"----------", "-----", "-----", "----",
"------", "-------", "---------");
}
nbytes = cdata->stats->nelmts;
H5_bandwidth(bandwidth, (double)nbytes, cdata->stats->timer.etime);
- HDfprintf (stderr,
+ HDfprintf (H5DEBUG(T),
" %-16s %10Hd %10d %8.2f %8.2f %8.2f %10s\n",
"no-op",
cdata->stats->nelmts,
@@ -3091,8 +3096,10 @@ H5Tregister_soft (const char *name, H5T_class_t src_cls, H5T_class_t dst_cls,
if ((path->func)(src_id, dst_id, &(path->cdata),
0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "H5T: conversion function failed "
- "to free private data.\n");
+ if (H5DEBUG(T)) {
+ fprintf (H5DEBUG(T), "H5T: conversion function failed "
+ "to free private data.\n");
+ }
#endif
H5E_clear();
}
@@ -3170,8 +3177,10 @@ H5Tunregister (H5T_conv_t func)
path->cdata.command = H5T_CONV_FREE;
if ((func)(FAIL, FAIL, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "H5T: conversion function failed to "
+ if (H5DEBUG(T)) {
+ fprintf (H5DEBUG(T), "H5T: conversion function failed to "
"free private data.\n");
+ }
#endif
H5E_clear();
}
@@ -4486,8 +4495,10 @@ H5T_path_find(const char *name, const H5T_t *src, const H5T_t *dst,
}
if ((func)(src_id, dst_id, &(path->cdata), 0, NULL, NULL)<0) {
#ifdef H5T_DEBUG
- fprintf (stderr, "H5T: conversion function init "
- "failed\n");
+ if (H5DEBUG(T)) {
+ fprintf (H5DEBUG(T), "H5T: conversion function init "
+ "failed\n");
+ }
#endif
H5E_clear(); /*ignore the failure*/
}
diff --git a/src/H5Z.c b/src/H5Z.c
index b6d44f8..f7a410d 100644
--- a/src/H5Z.c
+++ b/src/H5Z.c
@@ -86,45 +86,49 @@ H5Z_term_interface (void)
int dir, nprint=0;
char comment[16], bandwidth[32];
- for (i=0; i<H5Z_table_used_g; i++) {
- for (dir=0; dir<2; dir++) {
- if (0==H5Z_table_g[i].stats[dir].total) continue;
-
- if (0==nprint++) {
- /* Print column headers */
- HDfprintf (stderr, "H5Z: filter statistics accumulated "
- "over life of library:\n");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
- "Filter", "Total", "Errors", "User",
- "System", "Elapsed", "Bandwidth");
- HDfprintf (stderr, " %-16s %10s %10s %8s %8s %8s %10s\n",
- "------", "-----", "------", "----",
- "------", "-------", "---------");
- }
+ if (H5DEBUG(Z)) {
+ for (i=0; i<H5Z_table_used_g; i++) {
+ for (dir=0; dir<2; dir++) {
+ if (0==H5Z_table_g[i].stats[dir].total) continue;
+
+ if (0==nprint++) {
+ /* Print column headers */
+ HDfprintf (H5DEBUG(Z), "H5Z: filter statistics "
+ "accumulated over life of library:\n");
+ HDfprintf (H5DEBUG(Z),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "Filter", "Total", "Errors", "User",
+ "System", "Elapsed", "Bandwidth");
+ HDfprintf (H5DEBUG(Z),
+ " %-16s %10s %10s %8s %8s %8s %10s\n",
+ "------", "-----", "------", "----",
+ "------", "-------", "---------");
+ }
- /* Truncate the comment to fit in the field */
- strncpy(comment, H5Z_table_g[i].name, sizeof comment);
- comment[sizeof(comment)-1] = '\0';
-
- /*
- * Format bandwidth to have four significant digits and units
- * of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or the word
- * `Inf' if the elapsed time is zero.
- */
- H5_bandwidth(bandwidth,
- (double)(H5Z_table_g[i].stats[dir].total),
- H5Z_table_g[i].stats[dir].timer.etime);
-
- /* Print the statistics */
- HDfprintf (stderr,
- " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f "
- "%10s\n", dir?"<":">", comment,
- H5Z_table_g[i].stats[dir].total,
- H5Z_table_g[i].stats[dir].errors,
- H5Z_table_g[i].stats[dir].timer.utime,
- H5Z_table_g[i].stats[dir].timer.stime,
- H5Z_table_g[i].stats[dir].timer.etime,
- bandwidth);
+ /* Truncate the comment to fit in the field */
+ strncpy(comment, H5Z_table_g[i].name, sizeof comment);
+ comment[sizeof(comment)-1] = '\0';
+
+ /*
+ * Format bandwidth to have four significant digits and units
+ * of `B/s', `kB/s', `MB/s', `GB/s', or `TB/s' or the word
+ * `Inf' if the elapsed time is zero.
+ */
+ H5_bandwidth(bandwidth,
+ (double)(H5Z_table_g[i].stats[dir].total),
+ H5Z_table_g[i].stats[dir].timer.etime);
+
+ /* Print the statistics */
+ HDfprintf (H5DEBUG(Z),
+ " %s%-15s %10Hd %10Hd %8.2f %8.2f %8.2f "
+ "%10s\n", dir?"<":">", comment,
+ H5Z_table_g[i].stats[dir].total,
+ H5Z_table_g[i].stats[dir].errors,
+ H5Z_table_g[i].stats[dir].timer.utime,
+ H5Z_table_g[i].stats[dir].timer.stime,
+ H5Z_table_g[i].stats[dir].timer.etime,
+ bandwidth);
+ }
}
}
#endif
diff --git a/src/H5private.h b/src/H5private.h
index 0b2aba8..e0147e5 100644
--- a/src/H5private.h
+++ b/src/H5private.h
@@ -472,6 +472,49 @@ int64 HDstrtoll (const char *s, const char **rest, int base);
extern char *strdup(const char *s);
#define HDstrdup(S) strdup(S)
+/*
+ * These macros check whether debugging has been requested for a certain
+ * package at run-time. Code for debugging is conditionally compiled by
+ * defining constants like `H5X_DEBUG'. In order to see the output though
+ * the code must be enabled at run-time with an environment variable
+ * HDF5_DEBUG which is a list of packages to debug.
+ *
+ * Note: If you add/remove items from this enum then be sure to update the
+ * information about the package in H5_init_library().
+ */
+typedef enum {
+ H5_PKG_A, /*Attributes */
+ H5_PKG_AC, /*Meta data cache */
+ H5_PKG_B, /*B-trees */
+ H5_PKG_D, /*Datasets */
+ H5_PKG_E, /*Error handling */
+ H5_PKG_F, /*Files */
+ H5_PKG_G, /*Groups */
+ H5_PKG_HG, /*Global heap */
+ H5_PKG_HL, /*Local heap */
+ H5_PKG_I, /*Interface */
+ H5_PKG_MF, /*File memory management */
+ H5_PKG_MM, /*Core memory management */
+ H5_PKG_O, /*Object headers */
+ H5_PKG_P, /*Property lists */
+ H5_PKG_S, /*Data spaces */
+ H5_PKG_T, /*Data types */
+ H5_PKG_V, /*Vector functions */
+ H5_PKG_Z, /*Raw data filters */
+ H5_NPKGS /*Must be last */
+} H5_pkg_t;
+
+typedef struct H5_debug_t {
+ FILE *trace; /*API trace output stream */
+ struct {
+ const char *name; /*package name */
+ FILE *stream; /*output stream or NULL */
+ } pkg[H5_NPKGS];
+} H5_debug_t;
+
+extern H5_debug_t H5_debug_g;
+#define H5DEBUG(X) (H5_debug_g.pkg[H5_PKG_##X].stream)
+
/*-------------------------------------------------------------------------
* Purpose: These macros are inserted automatically just after the
* FUNC_ENTER() macro of API functions and are used to trace
diff --git a/test/.distdep b/test/.distdep
index b04981b..35e17f6 100644
--- a/test/.distdep
+++ b/test/.distdep
@@ -268,22 +268,6 @@ shtype.o: \
../src/H5Ppublic.h \
../src/H5Zpublic.h \
../src/H5Spublic.h
-bittests.o: \
- bittests.c \
- ../src/H5Tpkg.h \
- ../src/H5HGprivate.h \
- ../src/H5HGpublic.h \
- ../src/H5public.h \
- ../src/H5config.h \
- ../src/H5Fprivate.h \
- ../src/H5Fpublic.h \
- ../src/H5Ipublic.h \
- ../src/H5private.h \
- ../src/H5Dpublic.h \
- ../src/H5Tprivate.h \
- ../src/H5Tpublic.h \
- ../src/H5Gprivate.h \
- ../src/H5Gpublic.h
big.o: \
big.c \
../src/hdf5.h \
@@ -494,3 +478,19 @@ dsets.o: \
../src/H5Zpublic.h \
../src/H5Spublic.h \
../src/H5Tpublic.h
+bittests.o: \
+ bittests.c \
+ ../src/H5Tpkg.h \
+ ../src/H5HGprivate.h \
+ ../src/H5HGpublic.h \
+ ../src/H5public.h \
+ ../src/H5config.h \
+ ../src/H5Fprivate.h \
+ ../src/H5Fpublic.h \
+ ../src/H5Ipublic.h \
+ ../src/H5private.h \
+ ../src/H5Dpublic.h \
+ ../src/H5Tprivate.h \
+ ../src/H5Tpublic.h \
+ ../src/H5Gprivate.h \
+ ../src/H5Gpublic.h
diff --git a/test/bittests.c b/test/bittests.c
index 88c48dc..520bace 100644
--- a/test/bittests.c
+++ b/test/bittests.c
@@ -520,5 +520,11 @@ main (void)
nerrors += test_clear()<0?1:0;
nerrors += test_copy ()<0?1:0;
- return nerrors?1:0;
+ if (nerrors) {
+ printf("***** %lu FAILURE%s! *****\n",
+ nerrors, 1==nerrors?"":"S");
+ exit(1);
+ }
+ printf("All bit tests passed.\n");
+ return 0;
}