install_lwcf_handler Subroutine

Purpose

Registers the signal handler to dump a lightweight core file for signals that normally cause the generation of a core file.

Library

PTools Library (libptools_ptr.a)

Syntax

void install_lwcf_handler (void);

Description

The install_lwcf_handler subroutine registers the signal handler to dump a lightweight core file for signals that normally cause a core file to be generated. The format of lightweight core files complies with the Parallel Tools Consortium Lightweight Core File Format.

The install_lwcf_handler subroutine uses the LIGHTWEIGHT_CORE environment variable to determine the target lightweight core file. If the LIGHTWEIGHT_CORE environment variable is defined, a lightweight core file will be generated. Otherwise, a normal core file will be generated.

If the LIGHTWEIGHT_CORE environment variable is defined without a value, the lightweight core file is assigned the default file name lw_core and is created under the current working directory if it does not already exist.

If the LIGHTWEIGHT_CORE environment variable is defined with a value of STDERR, the lightweight core file is output to the standard error output device of the process. Keyword STDERR is not case-sensitive.

If the LIGHTWEIGHT_CORE environment variable is defined with the value of a character string other than STDERR, the string is used as a path name for the lightweight core file generated.

If the target lightweight core file already exists, the traceback information is appended to the file.

The install_lwcf_handler subroutine can be called directly from an application to register the signal handler. Alternatively, linker option -binitfini:install_lwcf_handler can be used when linking an application, which specifies to execute the install_lwcf_handler subroutine when the application is initialized. The advantage of the second method is that the application code does not need to change to invoke the install_lwcf_handler subroutine.