Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
RE: [photran] Global Variables

Fortran uses nested stack frames if I am not mistaken in order to
enforce local scope rules for the variables. GDB I believe only lets you
see variables at the local scope level. Usually if you want to access
variables in surrounding scopes in gdb you need to navigate up the stack
frame hierarchy using the "up" command, because only variables
accessible in the current stack frame are visible.

So if you want to access a variable in the surrounding scope to the
current routine you need to use the "up" frame command to move to that
next higher stack frame. If the scope is more nested do to multiple
function calls you may need to use the "up" command several times until
you are at the proper stack frame level.

Naturally there is a "down" command as well so that you go back down
deeper in the nested stack frame back to where you started.

See the online user manual for GDB.

About the PHOTRAN wrapper, it probably doesn't have the stack frame
manipulation commands included. 
   

-----Original Message-----
From: photran-bounces@xxxxxxxxxxx [mailto:photran-bounces@xxxxxxxxxxx]
On Behalf Of Lear, Matthew H.
Sent: Thursday, October 11, 2007 3:26 PM
To: Photran Information
Subject: RE: [photran] Global Variables

I'm not sure if it is GDB specific.  I've never just used GDB.  I recall
that Code Forge (using IDB) couldn't do this without finding the global
variable name by greping the binary.  It ended up looking something like
mp_routinename_variablename.  In the end it wasn't very useful.  I don't
recall if DDD in ladebug mode (also using IDB) could do it.  I really
wish I was able to help more but I am more applications oriented --
Mechanical Engineer vs Software Engineer, but please let me know and
I'll do what I can.

BTW I am an instructor/research faculty at Johns Hopkins.  Not sure if
anyone here participates in Photran/Eclipse, but if you have contacts
I'd be willing to coordinate with them if it's helpful.

Regards,
Matt

-----Original Message-----
From: photran-bounces@xxxxxxxxxxx on behalf of Ralph Johnson
Sent: Thu 10/11/2007 6:03 PM
To: Photran Information
Subject: Re: [photran] Global Variables
 
On 10/11/07, Lear, Matthew H. <Matthew.Lear@xxxxxxxxxx> wrote:
> Ralph,
>
> Thanks for your reply.  I have the opposite problem as you: I am a 
> reasonably good Fortran programmer with little/no JAVA/C experience.  
> What I would love to see in Photran is the ability to monitor global 
> variables in local subroutines.

Is this a gdb problem?  Can gdb display these variables?

The CDT/Photran debugger is just a shell around gdb, so if gdb can't do
it then it will be hard for Photran to, but if gdb can do it then we
ought to figure out a way for Photran to, too.

-Ralph
_______________________________________________
photran mailing list
photran@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/photran



Back to the top