963: Set next statement


First of all, a big "Thank you" to you folks at JetBrains for this valuable new feature!

A few questions about it:
1. Could this functionality be made more easily accessible by adding an "pop up one level" entry in the "Run" menu (something like an inverse "Step out"; "Back out" might be a suitable name)?
2. Is there any hope that popping up could somehow be forced to restore the previous state? Otherwise this feature could only be really useful in "read-only" sections of the code.

Regards,
Jens

P.S.: For readers unfamiliar with this enhancement, read http://www.intellij.net/tracker/idea/viewSCR?publicId=10992

23 comments

Where do I access this new feature? I just downloaded and installed 963, wrote a class with three println()'s in the main() method, stopped at the third (and last) and looked through the menu system, tried right-clicking, and looked at tool buttons in various visible panels.

Nowhere can I find anything called "Set next statement". Can anyone please enlighten me?

Best regards,
Lars Ugleberg

0

This feature just lets you hop up the call stack, you can't jump about
within a method. Go to the Threads tab in the debugger and you'll find a
menu item "Pop stack frame" which changes the debugger context to just
before the relevant method call. Check out the related bug for the
horse's mouth description!
http://www.intellij.net/tracker/idea/viewSCR?publicId=10992

Robbie

0

Why do you need it in run menu? Probably you need a hotkey... Keymaps->Debugger Actions->Pop frame

0

Why do you need it in run menu? Probably you need a
hotkey... Keymaps->Debugger Actions->Pop frame


Sorry, but that does not really help since the key map is only recognized if the "Threads" tab of the debug window has the focus (which is hardly ever the case for me).

Regards,
Jens

0

This feature just lets you hop up the call stack, you can't jump about
within a method.


Sorry, but then it's completely useless.

Tom


1

I agree with Tom. I have never experienced a need for this feature.

What I expected - and what I can really use - is to move the execution point back to a previously executed line of code in the current scope/method body. Of course, I would change the value of variables that control the flow first.

I always found this very useful when working with C++. It's a mystery to me why this feature can't be implemented in a Java debugger.

Best regards,
Lars Ugleberg

0

I always found this very useful when working with C++.


When reading the feature posting, I thought it is this feature (like in
Visual C++ 6).

It's a mystery to me why this feature can't be implemented in a Java
debugger.


Maybe the Java debugger framework from the JDK does not allow it?

Tom


0

Yeah, me too. I hardly ever use the thread tab. It would seem much more visible and intuitive to have a button in the side toolbar of the debug tool window, so it's always visible.

0

I think it can be done and that it is support through the HotSwap feature of the JDK. I just read the feature list for Borland's new JBuilder X and it has a new feature called "Set Execution Point", which refers to HotSwap.

HotSwap also supports reloading of modified classes without interrupting the debugging session, but that is listed as a separate feature, so I guess they actually does what we need.

Which also means that IDEA could do it. I suspect that JetBrains missunderstood the original feature request.

Best regards,
Lars Ugleberg

0

I'm not sure I see why. If you want to jump around within the method, just set the breakpoint where you want to hop, pop the frame, and press the play button.

0

I'm not sure I see why. If you want to jump around within the method, just set the breakpoint where you want to hop, pop the frame, and press the play button.


In Visual C++ you could set the execution point to an already executed
point in the same method while in stopped mode. Using breakpoints does
not allow this feature.

Tom

0

It sort of does. Let's say you're on line 5 of a method. Set a breakpoint at line 2 (already executed), pop the frame, (execution returns the calling line of the method you were in), and press play. Execution breaks at line 2.

0

But it's not the same, because in your described scenario the method
will be executed from start. Not so in VC++.

Tom

0

But it's not the same, because in your described scenario the method
will be executed from start. Not so in VC++.

Tom


0

Just from the start of that method, not from the start of the application. So rather than being able to jump from line 5 to line 2 or 3 or 4, you can only jump to line 1. It doesn't seem like that would make the feature totally useless. You can still do the same thing as VC++, you just have to hit the step over button a couple times.

And actually, given the present functionality, it wouldn't be hard to implement this feature. Call it "Step back to cursor" or something, and idea will automatically pop the frame and stop forward to the line the cursor is on.

0

Currently I don't see any ability to implement 'Set Execution Point' feature as it was for C++. JVM does not provide any API to change Execution point directly. It alows only to pop frames from the stack.

I can't implement Set Execution Point as 'Pop Frame' and 'Run to Cursor' because of side effects will spoil everything.

Probably, it's possible to Pop Frame and replace the method with generated one so you will jump to the needed statement. Certanly, this needs some investigation and is rather hard to implement for we should implement some functionality to generate code on the fly.

PS. Borland's 'Set Execution Point' feature allows to set a new stack frame for resume operations. Consequntly it does exactly the same as our 'Pop Frame' action.

0


Russell Egan wrote:

Just from the start of that method, not from the start of the application. So rather than being able to jump from line 5 to line

2 or 3 or 4, you can only jump to line 1. It doesn't seem like that would make the feature totally useless. You can still do the
same thing as VC++, you just have to hit the step over button a couple times.

The problem is that if you want to repeat, say line 10, of your method
and one or more of the lines 1-9 have side-effects, using this like you
describied is impossibe and dangerous. And I dare to say that this is a
very common use case.


Sascha


0

You can do the same right now. Pop curent frame, position cursor in the popped method and 'Run to Cursor'.

Thomas is right. If I would implement 'Set Execution Point' action as 'Pop Frame' and 'Run to Cursor' you would probably forget about side effects (you code will be reexecuted from the top of the method).

0

True. I guess I'm just not used to the feature. I used VAJ for a couple years, and that only supported pop frame. But I found that almost everytime, I wanted to rerun the method from the top, because I wanted to retest the whole recompiled method, with a fresh set of local vars.

Moving back up a couple lines would present similar side-effect issues. Where popping the frame leaves your heap is a funny state, just going up a few lines in the current frame leaves both your heap and your local variables in a funny state.

I see the difference between going up a line and going up a method call, I just don't see it as a big. I certainly don't think the costs of going up a method call make the feature "useless". It certainly is useless to me.

0

I have filed a feature request with Sun for enhanced debugger support in JDK 1.5 that will enable debuggers to offer the same functionality as is typically available in C and C++ debuggers, allowing us to set the exact execution point within the current scope.

If admitted into the bug/feature database (which most requests are), it will appear with 2-3 weeks. I'll watch out for it and post its ID here if and when it appears.

If you are interested in this enhanced debugger feature, please feel free to vote for the feature request when it becomes available.

Best regards,
Lars Ugleberg

0

On Tue, 04 Nov 2003 11:58:44 +0000, Jens Voss wrote:

>> Why do you need it in run menu? Probably you need a hotkey...
>> Keymaps->Debugger Actions->Pop frame


Sorry, but that does not really help since the key map is only recognized
if the "Threads" tab of the debug window has the focus (which is hardly
ever the case for me).


So two bug fixes - provide it as a keymap, and allow keymaps to work in
other debug windows?

--
"It's all in the heat of the moment, it's all in the pain..." Devy.
Mark Derricutt @ mark@talios.com @ talios.blog-city.com

0

Please sign in to leave a comment.