debugging fortran in xcode -- where are local variables?

Hi,
I have xcode 2.4.1 running on PowerPC with MacResearch's latest fortran plugin.
The debugger is sort of working -- I can step through my programs, and it stops at breakpoints. So far so good. However, I am having issues with watching variables.
According to
http://developer.apple.com/documentation/DeveloperTools/Conceptual/XcodeUserGuide/Contents/Resources/en.lproj/06_04_db_view_info/chapter_42_section_3.html#//apple_ref/doc/uid/TP40002701-BABGJCIF
I should see an item "Local Variables" and "Arguments" -- right?
Does anybody have an idea as to why I see only "Globals", "Registers", "Float Registers" and "Vector Registers"?

**How can I watch a variable** (right clicking on it doesn't offer an option "watch")?

So far I have:
- added the flag -g
- unchecked zerolink
- added libfortran.a to the project
- set the architecture to ppc for the project and the target

Thanks for your help,
Claus

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.

Re: debugging fortran in xcode -- where are local variables?

Hi Claus,

I can see something similar for some functions but not others.
Below is a mixed C/Fortran project screen shot (click on it for a larger image).

This seems similar to what you are observing. Only arguments, but no locals.

In the next Fortran code (same program, larger function):

You can see that there are local variables in this call.

In the first case, the function is very small, so I'm assuming the compiler is doing something smart like doing everything in register and not creating any local variables on the stack.

In the latter case, the compiler doesn't and hence the local variables appear as a distinct group. I'm make a semi-educated guess, though. I could be wrong.

A couple of questions.

1) Are the functions you breaking in relatively small or are they doing a sizeable amount of work?

2) Are there any cases where you can see local variables (do you at least see Arguments, if there are Arguments being passed in that is)?

In the case of Arguments you'll only get that option if call takes actual arguments.
The code I'm showing was compiled with -O3 -g in "OTHER_FORTRANFLAGS" portion of the build settings.

Dave

Re: debugging fortran in xcode -- where are local variables?

Hi Dave,

1) right now, the project is very (extremely) small, which might support your line of thought

2) I added the -O3 flag (I previously had only -g). That gave me local variables. -- where could I find an explanation for different flags for the compiler? Is there something like a gfortran manual (ok, I am asking this without having googled)

3) I still do NOT see arguments. That is I still see no way of adding a variable for a watch. Especially I still don't see arrays (they do not show up as local variable)

--> I will try and compile a larger fortran file and let you know what happens

general questions about gfortran

Here are a few tips about finding help with gfortran:
1. there's a manual online: http://gcc.gnu.org/onlinedocs/gfortran
2. if you haven't found the answer to your question by googling and reading through the manual, you can ask it on the developer mailing-list: fortran@gcc.gnu.org. Usual advice on how to post to technical lists (like: be short, include a self-contained and reproducible example) does apply
3. if your question is more about Fortran in general than the GNU compiler, you can ask on the Usenet comp.lang.fortran newsgroup.

I think the limitation comes

I think the limitation comes from gdb which does not provide a good fortran support. From my experience, local variables fail to display when the fortran code contains user types. For example, look at the following tiny program:

program test

type mytype
integer myval
end type mytype

type (mytype) my_var
integer a

my_var%myval = 2
a=0

write(6,*) "hello, world"

end

With this example, the local variable a does not display in the debugger. If you delete all references to the custom type 'mytype', then the local variable a will show in the debugger.

Bernard.

ps: I am using intel compiler...