Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Moving the instruction pointer while debugging Java in Eclipse

Can I move the instruction pointer directly to a line of my choice (within the current method) while debugging a Java program in Eclipse (Galileo)?

It's straightforward to drag the instruction pointer to the desired line within a method in Visual Studio, but I don't see a way to do that in Eclipse (and don't find anything about it in the docs or on google).

like image 927
Eric J. Avatar asked Oct 30 '09 17:10

Eric J.


People also ask

How do I move the debug pointer in Eclipse?

Press F8 (which is also Resume button),that will take you to the break point. From there debug each line with F6. If you want to go to next break point press F8.

How do I change the debug current pointer?

You need to get out of the current debug session. Go to the debug console and end the current session by hitting the red square button. This should remove all the debug current instruction pointers.

How do I move forward in debug mode?

Open Debug Configuration -> Debugger -> Enable Reverse Debugging at startup . Than you can press shift+F5 or shift+F6 for step back like F5 or F6 for step forward.


2 Answers

This is possible...

http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse.jdt.doc.user/tips/jdt_tips.html

Drop to frame - When stepping through your code, you might occasionally step too far, or step over a line you meant to step into. Rather than restarting your debug session, you can use the Drop to Frame action to quickly go back to the beginning of a method. Select the stack frame corresponding to the Java method you wish to restart, and select Drop to Frame from Debug view toolbar or the stack frame's context menu. The current instruction pointer will be reset to the first executable statement in the method. This works for non-top stack frames as well.

Note that Drop to frame is only available when debugging with a 1.4 or higher VM, or the J9 VM. There are some situations where a JVM may be unable to pop the desired frames from the stack. For example, it is generally impossible to drop to the bottom frame of the stack or to any frame below a native method.

like image 193
John S. Avatar answered Sep 21 '22 07:09

John S.


This is not possible.

If you simply want to execute some code at the current place you can use the Expressions view and enter your code as an expression. The methods called by the expression evaluation will run in the current debugging context.

like image 32
ankon Avatar answered Sep 23 '22 07:09

ankon