Greetings,
I want to call a function that takes as an argument a derived type from within the Gnu Debugger (gdb).
Say I have this code:
module modSimpleClass
type Person
character(len=20) :: Name
contains
procedure PrintName
end type
contains
subroutine PrintName(a)
class(Person) :: a
print *, a%Name
end subroutine
subroutine Print42()
print *, "42"
end subroutine
subroutine Outsider(a)
class(Person) :: a
print *, a%Name
end subroutine
end module
program testgdb
use modSimpleClass
implicit none
type(Person) :: JoeJohnson
JoeJohnson%Name = "Joe Johnson"
call JoeJohnson%PrintName
end program testgdb
I run it from gdb and stop it before its end.
The following things work:
call Print42()
print JoeJohnson%Name
The following things don’t work:
call JoeJohnson%PrintName()!There is no member named PrintName.
call PrintName(JoeJohnson)!Error then segfault
call Outsider(JoeJohnson)!Error then segfault
The error is as follows:
The program being debugged was signaled while in a function called from GDB.
GDB remains in the frame where the signal was received.
To change this behavior use “set unwindonsignal on”.
Evaluation of the expression containing the function
(modsimpleclass::printname) will be abandoned.
When the function is done executing, GDB will silently stop.
Thank you in advance