由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Computation版 - 请教fortran debuger
相关主题
偶也问一fortran问题Re: fortran subroutine and function
a question about mpi-fortranFortran code optimization
problem about Fortran 77 in unixMPI Write?
请教一个程序调用问题(FORTRAN DLL),谢谢![转载] 问一个fortran的问题
谁给说说fortran的几个标准Fotran77程序的移植问题
有人用过Matlab的Compiler吗?或者是否有什么工具能把Matlab程序转成C, C++?Problems about Mex-file to call Fortran
Fortran里面哪个函数显示系统时间?fortran的random number 相关的函数lib是啥?
help on interface for Matlab and Fortran再问个Fortran得问题
相关话题的讨论汇总
话题: fortran话题: gdb话题: parameter话题: debuger话题: 512
进入Computation版参与讨论
1 (共1页)
x*****u
发帖数: 3419
1
大家在linux下用什么?谢谢!
n****g
发帖数: 150
2
ifort 用idb
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
1 (共1页)
进入Computation版参与讨论
相关主题
再问个Fortran得问题谁给说说fortran的几个标准
发现一个有趣的事情,关于fortran IMSL library有人用过Matlab的Compiler吗?或者是否有什么工具能把Matlab程序转成C, C++?
问个fortran和python编程的问题Fortran里面哪个函数显示系统时间?
Fortran里面子程序用END和END SUBROUTINE结尾有什么区别?help on interface for Matlab and Fortran
偶也问一fortran问题Re: fortran subroutine and function
a question about mpi-fortranFortran code optimization
problem about Fortran 77 in unixMPI Write?
请教一个程序调用问题(FORTRAN DLL),谢谢![转载] 问一个fortran的问题
相关话题的讨论汇总
话题: fortran话题: gdb话题: parameter话题: debuger话题: 512