Interactive Debugging Tools [message #67160] |
Thu, 02 July 2009 11:54 |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Folks,
I've been debugging a program this week that uses a large
image cube. I peel one image after the other off the cube
because I can't load the whole cube into memory at once.
But that's neither here nor there. The point is,
there is a problem with some of the image data and
I've been trying to track it down. I have some very
nice tools for interactively looking at images and
their values at specific locations (I am thinking
in particular of ImgWin.) The problem is, I can't use
ImgWin to look at my image data when I am stopped
inside my program, because as a widget program, ImgWin
needs access to the command interpreter at the main
IDL level. A dilemma, as they say.
If I could only get my image data back to the IDL
main IDL command level where I could look at it.
Well, now I can. I wrote a new Coyote Library program
this morning, named SaveToMain. I can use it to export
any IDL variable from within any IDL procedure or function
back to the main IDL level:
IDL> SaveToMain, thisImage
If I call the program as above, the variable is
exported to the main level with the same name as it
has in the local procedure or function. If I wish
to give it a new name, I just do this:
IDL> SaveToMain, thisImage, 'problemImage'
This allows me to be in my stopped code somewhere. Find a
variable I want to look at, export it back to the main level
of IDL, type RETALL to return to the main IDL level, and
use my interactive widget tools to further investigate the
variable. I just find this extremely useful. Maybe you
will, too.
http://www.dfanning.com/programs/savetomain.pro
Cheers,
David
--
David Fanning, Ph.D.
Coyote's Guide to IDL Programming (www.dfanning.com)
Sepore ma de ni thui. ("Perhaps thou speakest truth.")
|
|
|