Question & Answer
Question
I have a module procedure in a Fortran program as follows:
### Start Program: test.f ###
[]
module u777
contains
subroutine sub1
return
end subroutine
end module u777
program u001
use u777
call sub1
end
[]
### End Program: test.f ###
After compiling the program using the following command
$ xlf -g test.f
I use dbx to debug the executable:
$ dbx a.out
If I attempt to put a stop at sub1, I receive an error:
(dbx) stop in sub1
"sub1" is not defined
If I use the full external symbol name, the same problem occurs:
(dbx) stop in __u777_MOD_sub1
"__u777_mod_sub1" is not defined
Cause
The command "stop in sub1" produces an error because dbx can not predict what the final external symbol name will be after compilation. Depending on the compiler used, the final symbol name can be different. Therefore, dbx does not recognize the naming convention used. Instead of "sub1" you must specify the full external symbol name.
In XL Fortran, external names for module procedures are formed by two underscores, the module name, _MOD_, and the procedure name. When dbx opens a file, the case subcommand sets the default case value based on the language the executable was created from. For a XL Fortran executable, the 'case' value is set to 'lower'.
When you try the command "stop in __u777_MOD_sub1", because case is set to lower, dbx interprets it as "stop in __u777_mod_sub1", which does not exist.
Answer
To avoid the problem, set the dbx case value to "case mixed" before using the "stop in __u777_MOD_sub1" command. The case command allows both upper and lower case letters to be used. This means that instead of all the characters being folded into lower case, which is the default behavior, the characters will be interpreted as they appear. Remember that with case mixed set, sub1 is now different from SUB1.
Once "case mixed" has been set, you can now enter "stop in __u777_MOD_sub1" and the debugger will interpret it properly.
To avoid setting the case value every time you start dbx, create a file in your home directory named ".dbxinit" and add the line "case mixed". The next time you start dbx, "case mixed" will be set automatically.
Related Information
Was this topic helpful?
Document Information
Modified date:
24 February 2022
UID
swg21177843