3

I have searched and found that indeed Eclipse does not support this 'direct' feature. But, Did I stil miss something? and Is it present in other IDEs?

Let me elaborate my question more -

if a statement falls under execution flow based on an expression evaluation, then why can't we force execute it? (without the execution of the expression).

For example consider this -

... if(bool returnsABoolean) { 
<execute some statement>; 
} 
... 

Can the execution of 'if' be skipped and the statement be executed as a 'next statement'? (I obviously can control the value of 'returnAsBoolean' in the Variables view; but can I not skip (in a controlloed manner) all the statements until a particular statement in the execution?)

3

4 Answers 4

3

Highlight the code you want to run and right-click/Execute or press Ctrl+U.

Alternatively to "Execute", use "Display" (Ctrl+Shift+D) or "Inspect" (Ctrl+Shift+I) to see the result.

Sign up to request clarification or add additional context in comments.

Comments

1

Looks like you want the 'Display' view - in the Debug perspective, do : Window -> ShowView -> Display.

You can enter Java statements to execute there (you have to select the bit of text each time that you want to execute)

http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fviews%2Fdisplay%2Fref-display_view.htm

Comments

1

Debugging allows you to run a program interactively while watching the source code and the variables during the execution.

So debugging is nothing but executing program but inspecting the elements during execution but you can not jump into something which is not there in execution.

You can use keyboard buttons F5,F6 ,F8 etc. (For Eclipse) and other Shortcuts during debugging for your convinience but you can't jump to something directly which is not in the execution sequence.

Debugging Shortcuts:

F5 Step into
F6 Step over
F8 Resume and will take you to the break point
Ctrl+Shift+B Toggle breakpoint
Ctrl+Shift+D Display Info of current statement
Ctrl+Shift+I Inspect the selected element

You can Skip some code by the use of breakpoint you can directly jump to specific point and avoid debugging of code which you believe works fine.Or you can jump out code snippet if you want to.

Comments

1

The question really was to set the Instruction pointer at will. This has been discussed and through url's i pasted on the comments above - this is not an eclipse feature (yet).

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.