Eclipse: how to force a specific java statement to execute while debugging?

I searched and found that indeed Eclipse does not support this "direct" feature. But have I missed something? and is it present in other IDEs?

Let me elaborate on my question in more detail -

if a statement gets caught in the flow of execution based on the evaluation of an expression, then why can't we force it to execute it? (without executing the expression).

For example, consider this -

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

      

Can the "if" execution be skipped and the statement must be executed as the "next statement"? (I can obviously control the value of "returnAsBoolean" in the Variables view, but can I not skip (in control) all instructions before a certain statement when executed?)

+3


source to share


4 answers


The question was to set the instruction pointer optionally. This was discussed and via the url i inserted in the comments above - this is not an eclipse function (yet).



+1


source


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



As an alternative to Run, use Display ( Ctrl+ Shift+ D) or Inspect ( Ctrl+ Shift+ I) to see the result.

+3


source


Debugging

allows you to run a program interactively while viewing source code and variables at runtime.

Thus, debugging is nothing more than executing a program, but checking items at runtime, but you cannot jump into something that is not in execution.

You can use the keypad buttons F5, F6, F8etc. (for Eclipse) and other shortcuts while debugging for your convenience, but you can't jump to something straight, out of sequence.

Debugging shortcuts:

F5Step into
F6 Step by
F8 Resume and take you to a breakpoint
Ctrl + Shift+ BToggle breakpoint
Ctrl+ Shift+ DDisplay current statement information
Ctrl+ Shift+ IInspect selected item

You can skip some code with a breakpoint , you can go directly to a specific point and avoid debugging the code you think works fine. Or you can pop out the code snippet if you like.

+1


source


It sounds like you want the View - in the Debug perspective, do: Window -> ShowView -> Display.

You can enter Java instructions to execute there (you need to select a bit of text every time you want to execute)

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

+1


source







All Articles