Public Member Functions | Public Attributes | Private Member Functions

alize::Exception Class Reference

#include <Exception.h>

Inheritance diagram for alize::Exception:
Inheritance graph
[legend]
Collaboration diagram for alize::Exception:
Collaboration graph
[legend]

List of all members.

Public Member Functions

 Exception (const String &msg, const String &sourceFile, int line)
 Exception (const String &msg, const String &sourceFile, int line, const String callerName)
 Exception (const Exception &)
virtual ~Exception ()
virtual String toString () const
virtual String getClassName () const
String stackTrace (const String callerName) const
 Tries to get the stack trace of current point.

Public Attributes

const String msg
const String sourceFile
const int line
String trace
 gets filled by sTrace upon throwing time to fetch current stack trace

Private Member Functions

bool operator== (const Exception &) const
bool operator!= (const Exception &e) const
const Exceptionoperator= (const Exception &)

Detailed Description

Base class for exceptions

Author:
Frederic Wils frederic.wils@lia.univ-avignon.fr
Version:
1.0
Date:
2003

Definition at line 81 of file Exception.h.


Constructor & Destructor Documentation

Exception::Exception ( const String msg,
const String sourceFile,
int  line 
) [explicit]

Create an Exception object Also tries to fetch a stack trace and stores it in the trace field.

Parameters:
msgdetailed message
sourceFilename of the source file that thrown the exception
lineline number in the souce file

Definition at line 72 of file Exception.cpp.

Exception::Exception ( const String msg,
const String sourceFile,
int  line,
const String  callerName 
) [explicit]

Definition at line 79 of file Exception.cpp.

Exception::Exception ( const Exception e )

Definition at line 82 of file Exception.cpp.

Exception::~Exception (  ) [virtual]

Definition at line 197 of file Exception.cpp.


Member Function Documentation

String Exception::getClassName (  ) const [virtual]
bool alize::Exception::operator!= ( const Exception e ) const [private]

Not implemented

const Exception& alize::Exception::operator= ( const Exception  ) [private]

Not implemented

bool alize::Exception::operator== ( const Exception  ) const [private]
String Exception::stackTrace ( const String  callerName ) const

Tries to get the stack trace of current point.

Parameters:
callerNamename of the class derived FooException class (used to avoid gathering stack trace for EOFException which are non-failing)
Note:
ATTENTION: works only on GNU/Linux systems, because:
  • it calls gdb
  • it accesses the symlink /proc/self/exe to fetch the name of current executable
Date:
20080904120004
Author:
Florian Verdet _goto. <florian.verdet@univ-avignon.fr>,<hacking@verdet.ch> CREDITS: Idea to call gdb from within exception/crash handler to get a correct stack trace comes from: Mark Kretschmann markey, prominent Amarok hacker / C++ guru

/brief stackTrace - tries to get the stack trace of current point. If (libALIZE and) MISTRAL bits were compiled with -g or -ggdb option, prints srcFile+line and method parameters. Otherwise, just method names.

ATTENTION: works only on GNU/Linux systems, because:

  • it calls gdb
  • it accesses the symlink /proc/self/exe to fetch the name of current executable EXAMPLES: standalone gdb call for testing: gdb -ex run --batch --args ../EigenChannel/EigenChannel --config /users/verdet/lid/fa1-30sSeg-CMSSDCCMS/cfg/EigenChannel.cfg --ndxFilename foo --inputWorldFilename foo --channelMatrix foo gdb call attaching to running process: gdb -ex run --batch ../EigenChannel/EigenChannel 1234

CREDITS: Idea to call gdb from within exception/crash handler to get a correct stack trace comes from: Mark Kretschmann markey, prominent Amarok hacker / C++ guru 20080904120004 Florian Verdet _goto. <florian.verdet@univ-avignon.fr>,<hacking@verdet.ch>

TODO: make gdb call etc. parametrable through a config option (i.e. debugLevel) for:

  • do a 'bt full' to show also local variables
  • launch interactive gdb to be able to analyze manually (without '--batch')

EOFException is usually catched non-failing and occurs for every file read. Thus we don't build a stack trace (otherwise, we loose far too much time.

FileNotFoundException may be catched non-failing in EnergyDetectorMain.cpp(1*), SegTools.cpp(each lblFile, currently unused), LabelFusion.cpp(1*). Since there's no so many (useless) cases, we build a stack trace anyway (no special handling)

< fetch required bits (workaround the fact we don't have access to any info (argv[0] i.e.) )

Definition at line 122 of file Exception.cpp.

References NULL.

String Exception::toString (  ) const [virtual]

This method is frequently overridden in the derived classes. If it is not, it returns the name of the class of the object and the address of the object

Returns:
a description of the object

Reimplemented from alize::Object.

Reimplemented in alize::IndexOutOfBoundsException, and alize::IOException.

Definition at line 85 of file Exception.cpp.

References line, msg, sourceFile, trace, and alize::String::valueOf().

Referenced by alize::ULongVector::load(), alize::Matrix< T >::loadDB(), alize::Matrix< T >::randomInit(), alize::ULongVector::save(), and alize::Matrix< T >::saveDB().


Member Data Documentation

Definition at line 121 of file Exception.h.

Referenced by toString().

Definition at line 119 of file Exception.h.

Referenced by toString().

Definition at line 120 of file Exception.h.

Referenced by toString().

gets filled by sTrace upon throwing time to fetch current stack trace

Definition at line 122 of file Exception.h.

Referenced by toString().


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