When launching a “controlled” error it can be useful to show the whole stack trace. In such way, it is easier for the developer to find out where the problem might come.

Check below how to do it:

!< declare the interface
interface
    subroutine abort() bind(C, name="abort")
    end subroutine
end interface

!< an example
print *,1
call abort()
print *,2

The output:

Program received signal SIGABRT: Process abort signal.

Backtrace for this error:
#0  0x7f11ec6bc0c0 in ???
#1  0x7f11ec6bb2f5 in ???
#2  0x7f11ebb2d95f in ???
#3  0x7f11ebb2d8df in ???
#4  0x7f11ebb17cf4 in ???
#5  0x40b47e in __mo_exception_MOD_finish
	at ../src/echam/mo_exception.f90:140
#6  0x18c91b7 in __mo_jsb_grid_MOD_get_vgrid
	at ../src/base/mo_jsb_grid.f90:143
#7  0x1559997 in __mo_dfire_memory_class_MOD_init_dfire_memory
	at ../src/dist_fire/mo_dfire_memory_class.f90:168
#8  0x44e2a7 in __mo_jsb_tile_MOD_init_tile
	at ../src/base/mo_jsb_tile.f90:308
#9  0x41b7fa in __mo_jsb_model_init_MOD_quincy_init
	at ../src/base/mo_jsb_model_init.f90:209
#10  0x401f23 in land_model_driver
	at ../src/drivers/land_model_driver.f90:775
#11  0x40a5d8 in main
	at ../src/drivers/land_model_driver.f90:33
./run-slm_test-bed.sh: line 1176: 56256 Aborted                 (core dumped) ./land.x

Found at Stackoverflow

Leave a Reply

Your email address will not be published. Required fields are marked *