From fff75d9ab5d235c393a19f0c5880116d522f48fb Mon Sep 17 00:00:00 2001 From: Allen Byrne <50328838+byrnHDF@users.noreply.github.com> Date: Wed, 27 Nov 2024 07:34:26 -0600 Subject: [PATCH 1/2] Convert Debugging HDF5 Applications to doxygen (#5139) * Remove TRACE macro section --- doxygen/dox/TechnicalNotes.dox | 156 ++++++- .../examples/DebuggingHDF5Applications.html | 394 ------------------ 2 files changed, 155 insertions(+), 395 deletions(-) delete mode 100644 doxygen/examples/DebuggingHDF5Applications.html diff --git a/doxygen/dox/TechnicalNotes.dox b/doxygen/dox/TechnicalNotes.dox index b0f1c8f4cbc..8bea54bfb25 100644 --- a/doxygen/dox/TechnicalNotes.dox +++ b/doxygen/dox/TechnicalNotes.dox @@ -1063,7 +1063,161 @@ been used at the lowest level to process the request. /** \page APPDBG Debugging HDF5 Applications -\htmlinclude DebuggingHDF5Applications.html +\section sec_adddbg_intro Introduction +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. + +\subsection subsec_adddbg_intro_err Error Messages +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. + +\subsection subsec_adddbg_intro_invar Invariant Conditions +Unless NDEBUG 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. + +\subsection subsec_adddbg_intro_stats Timings and Statistics +The library can be configured to accumulate certain statistics about things like cache +performance, datatype conversion, data space conversion, and data filters. The code is +included on a per-package basis and enabled at runtime by an environment variable. + +\subsection subsec_adddbg_intro_trace API Tracing +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. + +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. + +\section sec_adddbg_msg Error Messages +By default any API function that fails will print an error stack to the standard error stream. +\code +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 +\endcode +The error handling package (H5E) is described elsewhere. + +\section sec_adddbg_invars Invariant Conditions +To include checks for invariant conditions the library should be configured +with --disable-production, 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: +\code +Assertion failed: H5.c:123: i + +Name + +Default + +Description + + + +aNoAttributes + + +acYesMeta data cache + + +bYesB-Trees + + +dYesDatasets + + +eYesError handling + + +fYesFiles + + +gYesGroups + + +hgYesGlobal heap + + +hlNoLocal heaps + + +iYesInterface abstraction + + +mfNoFile memory management + + +mmYesLibrary memory management + + +oNoObject headers and messages + + +pYesProperty lists + + +sYesData spaces + + +tYesDatatypes + + +vYesVectors + + +zYesRaw data filters + + + +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 HDF5_DEBUG 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 'all' refers to all packages. Any +word my be preceded by a minus sign to turn debugging off for the package. + +\subsection subsec_adddbg_stats_sample Sample debug specifications + + + + + + + + + + + + + +
all +This causes debugging output from all packages to be sent to the standard error stream. +
all -t -s +Debugging output for all packages except datatypes and data spaces will appear on the standard error stream. +
-all ac 255 t,s +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. +
+The components of the HDF5_DEBUG value may be separated by any non-lowercase letter. */ diff --git a/doxygen/examples/DebuggingHDF5Applications.html b/doxygen/examples/DebuggingHDF5Applications.html deleted file mode 100644 index 495a87c6676..00000000000 --- a/doxygen/examples/DebuggingHDF5Applications.html +++ /dev/null @@ -1,394 +0,0 @@ - - - Debugging HDF5 Applications - - -
-

Introduction

- -

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. - -

-
Error Messages -
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. - -

-
Invariant Conditions -
Unless NDEBUG 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. - -

-
Timings and Statistics -
The library can be configured to accumulate certain - statistics about things like cache performance, datatype - conversion, data space conversion, and data filters. The code - is included on a per-package basis and enabled at runtime by - an environment variable. - -

-
API Tracing -
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. -
- -

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. - -

Error Messages

- -

By default any API function that fails will print an error - stack to the standard error stream. - -

-

- - - - -
-


-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
-	      
-
-
- -

The error handling package (H5E) is described - elsewhere. - -

Invariant Conditions

- -

To include checks for invariant conditions the library should - be configured with --disable-production, 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: - -

-

- - - - -
-


-Assertion failed: H5.c:123: i<NELMTS(H5_debug_g)
-IOT Trap, core dumped.
-	      
-
-
- -

Timings and Statistics

- -

Code to accumulate statistics is included at compile time by - using the --enable-debug 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. - -

-

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
NameDefaultDescription
aNoAttributes
acYesMeta data cache
bYesB-Trees
dYesDatasets
eYesError handling
fYesFiles
gYesGroups
hgYesGlobal heap
hlNoLocal heaps
iYesInterface abstraction
mfNoFile memory management
mmYesLibrary memory management
oNoObject headers and messages
pYesProperty lists
sYesData spaces
tYesDatatypes
vYesVectors
zYesRaw data filters
-
- -

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 HDF5_DEBUG - 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 all refers to all packages. Any word my be - preceded by a minus sign to turn debugging off for the package. - -

-

- - - - - - - - - - - - - - -
Sample debug specifications
allThis causes debugging output from all packages to be - sent to the standard error stream.
all -t -sDebugging output for all packages except datatypes - and data spaces will appear on the standard error - stream.
-all ac 255 t,sThis 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.
-
- -

The components of the HDF5_DEBUG value may be - separated by any non-lowercase letter. - -

API Tracing

- -

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 h5ls foo after turning on tracing, - includes: - -

-

- - - - -
-
-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
-	      
-
-
- -

The code that performs the tracing must be included in the - library by specifying the --enable-trace - configuration switch (the default for versions before 1.2). Then - the word trace must appear in the value of the - HDF5_DEBUG variable. The output will appear on the - last file descriptor before the word trace or two - (standard error) by default. - -

-

- - - - - - - -
To display the trace on the standard error stream: -
$ env HDF5_DEBUG=trace a.out
-	      
-
To send the trace to a file: -
$ env HDF5_DEBUG="55 trace" a.out 55>trace-output
-	      
-
-
- -

Performance

- -

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 - H5_trace() function. - -

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. - -

Safety

- -

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. - -

Completeness

- -

There are two API functions that don't participate in - tracing. They are H5Eprint() and - H5Eprint_cb() because their participation would - mess up output during automatic error reporting. - -

On the other hand, a number of API functions are called during - library initialization and they print tracing information. - -

Implementation

- -

For those interested in the implementation here is a - description. Each API function should have a call to one of the - H5TRACE() macros immediately after the - FUNC_ENTER() 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. - -

In order to keep the H5TRACE() 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 trace 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. - -

-

- - - - - -
Explicit Instrumentation
-
-$ ../bin/trace *.c
-H5E.c: in function `H5Ewalk_cb':
-H5E.c:336: warning: trace info was not inserted
-	      
-
-
- -

Note: The warning message is the result of a comment of the - form /*NO TRACE*/ somewhere in the function - body. Tracing information will not be updated or inserted if - such a comment exists. - -

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.

-
- From 460e70cc42fb56561c7eea72d8852044a5046590 Mon Sep 17 00:00:00 2001 From: "H. Joe Lee" Date: Wed, 27 Nov 2024 07:49:21 -0600 Subject: [PATCH 2/2] Add check for broken links in Doxygen generated html docs (#5138) --- .github/workflows/linkchecker.yml | 46 +++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+) create mode 100644 .github/workflows/linkchecker.yml diff --git a/.github/workflows/linkchecker.yml b/.github/workflows/linkchecker.yml new file mode 100644 index 00000000000..d6a861d7bf7 --- /dev/null +++ b/.github/workflows/linkchecker.yml @@ -0,0 +1,46 @@ +name: linkchecker + +on: + workflow_dispatch: + push: + pull_request: + branches: [ develop ] + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref && github.ref || github.run_id }} + cancel-in-progress: true + +permissions: + contents: read + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: get + uses: actions/checkout@v4 + + - name: install + run: | + sudo apt update -y + sudo apt install -y libunwind-dev + sudo apt install -y graphviz + sudo apt install -y --no-install-recommends doxygen + sudo apt install -y cmake + sudo apt install -y texlive-full + sudo apt install -y texlive-fonts-extra + sudo apt install -y texlive-latex-extra + pip3 install linkchecker + + - name: build + run: | + mkdir build + cd build + cmake -DHDF5_BUILD_DOC:BOOL=ON .. + make doxygen + + - name: check + run: | + cd build/hdf5lib_docs/html + linkchecker --check-extern ./index.html +