HOWTO: Use IFort Traceback Error Message for Own Purposes
While using the IFort compilers, you may get at failure a listing of routines (and lines) where the code came from until it crashed. The following shows an example:
Image PC Routine Line Source ... ... ... ....... ... main.x 080C9CCA collisionterm_mp_ 811 collisionTerm.f90 main.x 080C44DB collisionterm_mp_ 410 collisionTerm.f90 main.x 0804A69D gibuu_.run_ 1101 main.f90 main.x 08048839 MAIN__ 154 main.f90
It is possible to use the same machinery for your own programmer purposes.
It is also possible, to emit an error message just as a warning and return to the calling routines.
See also: Ifort documentation, TraceBackQQ
Using GiBUU:
Insert at the beginning of your module:
USE CallStack
and at the position, where you want to get the error message:
call TRACEBACK([string],[user_exit_code])
The both optional arguments are:
- string: Text to be written
- user_exit_code: By specifying a user exit code of -1, control returns to the calling program. Specifying a user exit code with a positive value requests that specified value be returned to the operating system. The default value is 0, which causes the application to abort execution.
If you are not compiling with ifort: the behavior of the module stays the same, just without printing the call stack; text is written or not, code stops or not.
In General:
Insert at the beginning of your module:
USE IFCORE
and at the position, where you want to get the error message:
call TraceBackQQ