Moving back a level... [message #42698] |
Tue, 22 February 2005 12:17  |
Tdogg
Messages: 7 Registered: February 2005
|
Junior Member |
|
|
Hi there folks,
I've come here for a quick where-can-I-find type of question. If you
have more to add, well, that'd be swell. I'm at a telescope and am so
wrapped up with observing I figured some of you guys could save me a
few minutes by steering me in the right direction.
Here goes. If I put a STOP in a subroutine (or if I've encountered an
error and I'm stuck inside one) and I'd like to see what the variables
look like in the calling routine using HELP, is there any way to move
back to the calling routine but remain "stopped"? I can get back to
the calling routine by entering a return (sometimes I need a few
.skip's) but then it's off and running. This all sounds like I should
learn to make use of some type of debugging software associated with
IDL but I've never looked into any such thing. Any advice on where to
start would be hugely, hugely appreciated.
Best -Tim.
|
|
|
Re: Moving back a level... [message #42790 is a reply to message #42698] |
Thu, 24 February 2005 01:45  |
Ben Panter
Messages: 102 Registered: July 2003
|
Senior Member |
|
|
JD Smith wrote:
>> Access to the variable watch window is one thing that I miss when I use
>> idlwave...
>
>
> Well, you shouldn't miss it, because IDLWAVE can traverse the calling
> stack quite easily when you're stopped (at a breakpoint, error, etc.).
The things you learn!
Thanks JD.
Ben
--
-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
Ben Panter, Garching, Germany
email via www.benpanter.co.uk
|
|
|
Re: Moving back a level... [message #42793 is a reply to message #42698] |
Wed, 23 February 2005 18:51  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
savoie@nsidc.org writes:
> "Tdogg" <timrobishaw@yahoo.com> writes:
>
>> Well, in that case, Craig should start chargin!
>
> I think you're supposed to give it away for a while first, so you get hooked.
Exactly. Now watch while I magically disable all copies of MPFIT
until my 1 million dollar license fee is paid.
(Evil) Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Moving back a level... [message #42796 is a reply to message #42698] |
Wed, 23 February 2005 17:55  |
JD Smith
Messages: 850 Registered: December 1999
|
Senior Member |
|
|
On Tue, 22 Feb 2005 21:48:37 +0100, Ben Panter wrote:
> Hi Tim,
>
>> Here goes. If I put a STOP in a subroutine (or if I've encountered an
>> error and I'm stuck inside one) and I'd like to see what the variables
>> look like in the calling routine using HELP, is there any way to move
>> back to the calling routine but remain "stopped"? I can get back to
>> the calling routine by entering a return (sometimes I need a few
>> .skip's) but then it's off and running. This all sounds like I should
>> learn to make use of some type of debugging software associated with
>> IDL but I've never looked into any such thing. Any advice on where to
>> start would be hugely, hugely appreciated.
>
> I have an answer to a question that you might be asking, but I'm not
> entirely sure if I understand you!
>
> My answer would be to fire up idlde instead of idl, and run your code.
> Then there are a few buttons at the top which allow you to move up and
> down the calling stack from where you stopped. The variable watch area
> then changes to the variables in that level.
>
> Access to the variable watch window is one thing that I miss when I use
> idlwave...
Well, you shouldn't miss it, because IDLWAVE can traverse the calling
stack quite easily when you're stopped (at a breakpoint, error, etc.).
By default C-C C-d C-Up and Down will move you anywhere up and down
the stack, and you'll see your location in the minibar: [0:MyPro],
[-1:CallingPro] etc. As you navigate the stack, IDLWAVE brings you to
the exact line of source code through which the stack threads. Then
you can use the examine commands (a fun one is C-S-middle-click) which
will let you see variables at any place in the stack.
Suppose you do a lot of widget programming, and you'd like, at a
click, to know if a widget id is valid any longer. Just
C-S-middle-click it and select "Widget Valid" from the examine menu.
And the sky's the limit for your own custom examine commands: just
customize Idlwave Shell Command Setup->Idlwave Shell Examine Alist,
and make up your own crazy examine commands, like:
IsOdd
print,___ & 1L?"Odd":"Even"
If you have electric debug mode active (which happens by default on
breakpoints, and can be enabled on errors as well), all these features
are a single keystroke away. And you're not limited to examining
single variables: you can examine arbitrary expressions, function
results, essentially anything that IDL can evaluate.
I use this all the time when a routine stops at an error. Examine a
few variables in the current routine to see that all is well, and then
jump up the stack one level, examine some variables there to see if
the inputs were kosher, etc. A real time saver.
JD
|
|
|
|
Re: Moving back a level... [message #42811 is a reply to message #42698] |
Wed, 23 February 2005 10:31  |
Tdogg
Messages: 7 Registered: February 2005
|
Junior Member |
|
|
Well, in that case, Craig should start chargin!
Craig Markwardt wrote:
> mperrin+news@cymric.berkeley.edu (Marshall Perrin) writes:
> ...
>> You want Craig Markwardt's DXDEBUG package:
> ...
>> This routine, plus dxup, dxhelp and dxget, have completely
revolutionized how
>> I debug IDL programs. It's as good as crack, man. ;-)
>
> Umm, thanks, I guess. :-)
>
> Craig
|
|
|
Re: Moving back a level... [message #42812 is a reply to message #42698] |
Wed, 23 February 2005 10:27  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
Craig Markwardt <craigmnet@REMOVEcow.physics.wisc.edu> wrote:
>
> mperrin+news@cymric.berkeley.edu (Marshall Perrin) writes:
> ...
>> You want Craig Markwardt's DXDEBUG package:
> ...
>> This routine, plus dxup, dxhelp and dxget, have completely revolutionized how
>> I debug IDL programs. It's as good as crack, man. ;-)
>
> Umm, thanks, I guess. :-)
Hey, after four years living in Oakland, is it any surprise that a little
local color has slipped into my speech? ;-)
- Marshall
|
|
|
Re: Moving back a level... [message #42821 is a reply to message #42698] |
Wed, 23 February 2005 06:06  |
Craig Markwardt
Messages: 1869 Registered: November 1996
|
Senior Member |
|
|
mperrin+news@cymric.berkeley.edu (Marshall Perrin) writes:
...
> You want Craig Markwardt's DXDEBUG package:
...
> This routine, plus dxup, dxhelp and dxget, have completely revolutionized how
> I debug IDL programs. It's as good as crack, man. ;-)
Umm, thanks, I guess. :-)
Craig
--
------------------------------------------------------------ --------------
Craig B. Markwardt, Ph.D. EMAIL: craigmnet@REMOVEcow.physics.wisc.edu
Astrophysics, IDL, Finance, Derivatives | Remove "net" for better response
------------------------------------------------------------ --------------
|
|
|
Re: Moving back a level... [message #42825 is a reply to message #42698] |
Tue, 22 February 2005 20:21  |
mperrin+news
Messages: 81 Registered: May 2001
|
Member |
|
|
Hey there Tim!
Tdogg <timrobishaw@yahoo.com> wrote:
> Here goes. If I put a STOP in a subroutine (or if I've encountered an
> error and I'm stuck inside one) and I'd like to see what the variables
> look like in the calling routine using HELP, is there any way to move
> back to the calling routine but remain "stopped"? I can get back to
> the calling routine by entering a return (sometimes I need a few
> .skip's) but then it's off and running. This all sounds like I should
> learn to make use of some type of debugging software associated with
> IDL but I've never looked into any such thing. Any advice on where to
> start would be hugely, hugely appreciated.
You want Craig Markwardt's DXDEBUG package:
http://cow.physics.wisc.edu/~craigm/idl/idl.html
The 'dxfinish' routine does exactly what you want. It sets a breakpoint right
after the current function returns to the calling routine, so as soon as you
return, it stops again rather than running off.
This routine, plus dxup, dxhelp and dxget, have completely revolutionized how
I debug IDL programs. It's as good as crack, man. ;-)
- Marshall
|
|
|
Re: Moving back a level... [message #42827 is a reply to message #42698] |
Tue, 22 February 2005 16:53  |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Tdogg wrote:
> Benjamin Hornberger wrote:
>
>> If I understand right, what you need is one of these:
>>
>> .return
>> .out
>
>
> Hey, wow, thanks a bunch Benjamain! .out is PRECISELY what I needed.
> I have no idea how it is that I'd never learned about this.
>
I think I know why you never learned about this. In general, if you look
up the reference for something in the IDL help, links to all related
functions and procedures are given at the bottom.
But have a look at the documentation (reference) for .step, .continue,
.return, .out etc. No hint whatsoever about the other ones. I just
stumbled over it by chance.
Benjamin
|
|
|
Re: Moving back a level... [message #42828 is a reply to message #42698] |
Tue, 22 February 2005 16:41  |
Tdogg
Messages: 7 Registered: February 2005
|
Junior Member |
|
|
Benjamin Hornberger wrote:
> If I understand right, what you need is one of these:
>
> .return
> .out
Hey, wow, thanks a bunch Benjamain! .out is PRECISELY what I needed.
I have no idea how it is that I'd never learned about this.
Foldy wrote:
> help, level=-1
This keyword is new to me too, and damn useful. Thanks a bunch.
David Fanning wrote:
> Well, you could start on this newsgroup. I think we just
> answered this question yesterday. :-)
Thanks for the pointer, David. Weird thing is, I had just finished
perusing that thread this morning (I mean, How To Rerun Subroutine
ain't exactly what I was looking for, but it seemed interesting to see
what the reponses would be) but I didn't really make it past your
authoritative reply: "No." Who knew you'd have to waste keystrokes
explaining where to find an answer-in-waiting because your conservative
response suggested I needn't bother looking on? Might be a karma
thing. At any rate, thanks for pointing me there. I love to find
these new things that I wish I'd known about years ago.
Thanks everybody. -Tim.
|
|
|
Re: Moving back a level... [message #42839 is a reply to message #42698] |
Tue, 22 February 2005 15:07  |
Benjamin Hornberger
Messages: 258 Registered: March 2004
|
Senior Member |
|
|
Tdogg wrote:
> Hi there folks,
>
> I've come here for a quick where-can-I-find type of question. If you
> have more to add, well, that'd be swell. I'm at a telescope and am so
> wrapped up with observing I figured some of you guys could save me a
> few minutes by steering me in the right direction.
>
> Here goes. If I put a STOP in a subroutine (or if I've encountered an
> error and I'm stuck inside one) and I'd like to see what the variables
> look like in the calling routine using HELP, is there any way to move
> back to the calling routine but remain "stopped"? I can get back to
> the calling routine by entering a return (sometimes I need a few
> .skip's) but then it's off and running. This all sounds like I should
> learn to make use of some type of debugging software associated with
> IDL but I've never looked into any such thing. Any advice on where to
> start would be hugely, hugely appreciated.
>
> Best -Tim.
>
If I understand right, what you need is one of these:
.return
.out
Benjamin
|
|
|
Re: Moving back a level... [message #42843 is a reply to message #42698] |
Tue, 22 February 2005 12:48  |
Ben Panter
Messages: 102 Registered: July 2003
|
Senior Member |
|
|
Hi Tim,
> Here goes. If I put a STOP in a subroutine (or if I've encountered an
> error and I'm stuck inside one) and I'd like to see what the variables
> look like in the calling routine using HELP, is there any way to move
> back to the calling routine but remain "stopped"? I can get back to
> the calling routine by entering a return (sometimes I need a few
> .skip's) but then it's off and running. This all sounds like I should
> learn to make use of some type of debugging software associated with
> IDL but I've never looked into any such thing. Any advice on where to
> start would be hugely, hugely appreciated.
I have an answer to a question that you might be asking, but I'm not
entirely sure if I understand you!
My answer would be to fire up idlde instead of idl, and run your code.
Then there are a few buttons at the top which allow you to move up and
down the calling stack from where you stopped. The variable watch area
then changes to the variables in that level.
Access to the variable watch window is one thing that I miss when I use
idlwave...
Ben
|
|
|
|
Re: Moving back a level... [message #42845 is a reply to message #42698] |
Tue, 22 February 2005 12:31  |
David Fanning
Messages: 11724 Registered: August 2001
|
Senior Member |
|
|
Tdogg writes:
> Any advice on where to
> start would be hugely, hugely appreciated.
Well, you could start on this newsgroup. I think we just
answered this question yesterday. :-)
Try searching the newsgroup archives with the keywords
"stop subroutine" and look for a Feb 21st date. You should
find something.
Cheers,
David
--
David Fanning, Ph.D.
Fanning Software Consulting, Inc.
Coyote's Guide to IDL Programming: http://www.dfanning.com/
|
|
|
Re: Moving back a level... [message #42846 is a reply to message #42698] |
Tue, 22 February 2005 12:30  |
Foldy Lajos
Messages: 268 Registered: October 2001
|
Senior Member |
|
|
Hi,
help, level=-1
regards,
lajos
On Tue, 22 Feb 2005, Tdogg wrote:
> Hi there folks,
>
> I've come here for a quick where-can-I-find type of question. If you
> have more to add, well, that'd be swell. I'm at a telescope and am so
> wrapped up with observing I figured some of you guys could save me a
> few minutes by steering me in the right direction.
>
> Here goes. If I put a STOP in a subroutine (or if I've encountered an
> error and I'm stuck inside one) and I'd like to see what the variables
> look like in the calling routine using HELP, is there any way to move
> back to the calling routine but remain "stopped"? I can get back to
> the calling routine by entering a return (sometimes I need a few
> .skip's) but then it's off and running. This all sounds like I should
> learn to make use of some type of debugging software associated with
> IDL but I've never looked into any such thing. Any advice on where to
> start would be hugely, hugely appreciated.
>
> Best -Tim.
>
>
|
|
|