x*****u 发帖数: 3419 | | n****g 发帖数: 150 | | k*******n 发帖数: 116 | 3 用 “print *”
【在 x*****u 的大作中提到】 : 大家在linux下用什么?谢谢!
| l******n 发帖数: 9344 | 4 gdb
【在 n****g 的大作中提到】 : ifort 用idb
| x*****u 发帖数: 3419 | 5 Thanks!
It works...
However, I found that I cannot see parameter, for example
parameter (n = 512)
using
(gdb) print n
gives
No symbol "n" in current context.
Any suggestion? //bow..
【在 n****g 的大作中提到】 : ifort 用idb
| h*******s 发帖数: 11 | 6 In Fortran, "parameters" must be resolvable at compile time, and most
compilers will only retain the literal value of the constant and throw
away the symbol. If you know C, then the Fortran declaration
integer n; parameter(n=512)
is effectively the same as
#define N 512
in C, where the token "N" is lost after the macro is expanded.
If you want to be able to access the value of a parameter by a
symbolic name, try
integer n; parameter(n=512)
integer n_gdb=n
and then query n_gdb in the debugger fo
【在 x*****u 的大作中提到】 : Thanks! : It works... : However, I found that I cannot see parameter, for example : parameter (n = 512) : using : (gdb) print n : gives : No symbol "n" in current context. : Any suggestion? //bow..
| x*****u 发帖数: 3419 | 7 解释的很清楚,谢谢!
只是觉得程序调试的时候,一查没有context,就得到源头去找赋值,很不方便。不知
道有没有别法?再谢!
【在 h*******s 的大作中提到】 : In Fortran, "parameters" must be resolvable at compile time, and most : compilers will only retain the literal value of the constant and throw : away the symbol. If you know C, then the Fortran declaration : integer n; parameter(n=512) : is effectively the same as : #define N 512 : in C, where the token "N" is lost after the macro is expanded. : If you want to be able to access the value of a parameter by a : symbolic name, try : integer n; parameter(n=512)
| h*******s 发帖数: 11 | 8 I don't think there is a general way to retain the
symbolic name of a parameter constant--the value of
constant is resolved at compile time and the name is
lost forever. Even if you save the value of a parameter
in a regular variable, as in the example I gave above
using n_gdb, if you do not actually use n_gdb in your
program, the Fortran compiler could optimize away
n_gdb and you would lose the hook to peek at the value
of n in the debugger.
Another way might be to include a subroutine that
co
【在 x*****u 的大作中提到】 : 解释的很清楚,谢谢! : 只是觉得程序调试的时候,一查没有context,就得到源头去找赋值,很不方便。不知 : 道有没有别法?再谢!
| x*****u 发帖数: 3419 | 9 gdb对fortran 90的支持如何?比如allocated array
【在 l******n 的大作中提到】 : gdb
|
|