PCL
pcl::UnixSignalException Class Reference

A UNIX synchronous signal handler that throws C++ exceptions. More...

#include <UnixSignalException.h>

+ Inheritance diagram for pcl::UnixSignalException:

Public Member Functions

 UnixSignalException (const UnixSignalException &)=default
 
 UnixSignalException (int signal, const IsoString &details=IsoString())
 
String Caption () const override
 
const IsoStringDetails () const
 
String FormatInfo () const override
 
String Message () const override
 
void Show () const override
 
int SignalNumber () const
 
- Public Member Functions inherited from pcl::Exception
 Exception ()=default
 
 Exception (const pcl::Exception &)=default
 
virtual ~Exception ()
 
virtual String ExceptionClass () const
 
PCL_FORCE_INLINE void ShowOnConsole () const
 

Static Public Member Functions

static void Initialize ()
 
- Static Public Member Functions inherited from pcl::Exception
static void DisableConsoleOutput (bool disable=true)
 
static void DisableGUIOutput (bool disable=true)
 
static void EnableConsoleOutput (bool=true)
 
static void EnableGUIOutput (bool=true)
 
static bool IsConsoleOutputEnabled ()
 
static bool IsGUIOutputEnabled ()
 

Detailed Description

This class can only be used on Linux, FreeBSD and macOS platforms. On Windows platforms, including this header file from compilable code raises a compilation error.

For this handler to work properly, all code that may raise synchronous signals (SIGSEGV and the like) must be compiled with GCC's '-fnon-call-exceptions' flag. Otherwise the exceptions will be thrown but terminate() will be called, which is the default critical signal management behavior.

To generate a backtrace report (see the UnixSignalException::Details() member function), the code must be compiled with the '-rdynamic' GCC flag, which instructs the linker to add all symbols to the dynamic symbol table. In addition, the generated binaries should not be stripped with the '-s' linker flag.

Definition at line 92 of file UnixSignalException.h.

Constructor & Destructor Documentation

◆ UnixSignalException() [1/2]

pcl::UnixSignalException::UnixSignalException ( int  signal,
const IsoString details = IsoString() 
)
inline

Constructs a new UnixSignalException object with the specified signal number and optional backtrace details.

Definition at line 100 of file UnixSignalException.h.

◆ UnixSignalException() [2/2]

pcl::UnixSignalException::UnixSignalException ( const UnixSignalException )
default

Copy constructor.

Member Function Documentation

◆ Caption()

String pcl::UnixSignalException::Caption ( ) const
inlineoverridevirtual

Returns the type of this exception, intended to be used as a caption for a message box. As reimplemented in this class, this member function returns the string "PCL Unix Signal Handler".

Reimplemented from pcl::Exception.

Definition at line 162 of file UnixSignalException.h.

◆ Details()

const IsoString& pcl::UnixSignalException::Details ( ) const
inline

Returns the backtrace information associated with this exception.

The returned string will be empty if no backtrace data were available at the time this signal exception was generated. This happens when the code has not been compiled and linked with the appropriate options (see the -rdynamic compiler flag).

Definition at line 127 of file UnixSignalException.h.

◆ FormatInfo()

String pcl::UnixSignalException::FormatInfo ( ) const
inlineoverridevirtual

Returns a formatted error message with information on this signal exception.

Reimplemented from pcl::Exception.

Definition at line 146 of file UnixSignalException.h.

◆ Initialize()

static void pcl::UnixSignalException::Initialize ( )
static

Initializes the UNIX synchronous signal handler. This static member function must be called before the calling process can raise any synchronous signal.

Note
A module should never call this member function. It is invoked when appropriate by the PixInsight core application and internal PCL routines.

◆ Message()

String pcl::UnixSignalException::Message ( ) const
inlineoverridevirtual

Returns an error or warning message corresponding to this signal exception. Typical messages are "segmentation violation", "bus error" and "floating point exception", returned by specific derived classes.

Reimplemented from pcl::Exception.

Definition at line 137 of file UnixSignalException.h.

◆ Show()

void pcl::UnixSignalException::Show ( ) const
overridevirtual

Writes a formatted representation of this exception on the platform console. A plain text version of the same textual representation will also be written on stdout.

Note
UNIX synchronous interrupts are never reported on interactive graphical interfaces, such as message boxes, irrespective of global platform settings or local settings defined through calls to EnableGUIOutput() and similar functions.

Reimplemented from pcl::Exception.

◆ SignalNumber()

int pcl::UnixSignalException::SignalNumber ( ) const
inline

Returns the signal number associated with this object.

Definition at line 114 of file UnixSignalException.h.


The documentation for this class was generated from the following file: